From 7dc1d80fe40835f404dbb51875bca3ed1fe1b162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 5 Oct 2015 12:54:31 +0200 Subject: Add unit test for too big files --- tests/controller/filehandlingcontrollertest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/controller/filehandlingcontrollertest.php b/tests/controller/filehandlingcontrollertest.php index 8f9617b..59f75a3 100644 --- a/tests/controller/filehandlingcontrollertest.php +++ b/tests/controller/filehandlingcontrollertest.php @@ -177,6 +177,19 @@ class FileHandlingControllerTest extends TestCase { } + public function testFileTooBig() { + $this->viewMock->expects($this->any()) + ->method('filesize') + ->willReturn(4194304 + 1); + + $result = $this->controller->load('/', 'foo.bar'); + $data = $result->getData(); + $status = $result->getStatus(); + $this->assertSame(400, $status); + $this->assertArrayHasKey('message', $data); + $this->assertSame('The file is too big.', $data['message']); + } + public function dataTestSave() { return array ( array('/test.txt', 'file content', 65638643, 65638643, true, 200, ''), -- cgit v1.2.3