diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-06-14 10:04:31 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-06-20 08:53:37 +0200 |
commit | ff3f63fd4746441c08bdb79d771b5c3e3da259c8 (patch) | |
tree | 40e219e4b3a759b68bdf3471c6bab6a642394866 /apps | |
parent | 20e514690c46c2874bd2819942b0beb46015027a (diff) | |
download | nextcloud-server-ff3f63fd4746441c08bdb79d771b5c3e3da259c8.tar.gz nextcloud-server-ff3f63fd4746441c08bdb79d771b5c3e3da259c8.zip |
Fix PublicPreviewControllerTests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php index 174abbb6f60..27e13bc8ced 100644 --- a/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php +++ b/apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php @@ -33,6 +33,7 @@ use OCP\Files\NotFoundException; use OCP\Files\SimpleFS\ISimpleFile; use OCP\IPreview; use OCP\IRequest; +use OCP\ISession; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; use OCP\Share\IShare; @@ -60,26 +61,27 @@ class PublicPreviewControllerTest extends TestCase { 'files_sharing', $this->createMock(IRequest::class), $this->shareManager, + $this->createMock(ISession::class), $this->previewManager ); } public function testInvalidToken() { - $res = $this->controller->getPreview('file', 10, 10, ''); + $res = $this->controller->getPreview('', 'file', 10, 10, ''); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } public function testInvalidWidth() { - $res = $this->controller->getPreview('file', 0); + $res = $this->controller->getPreview('token', 'file', 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); } public function testInvalidHeight() { - $res = $this->controller->getPreview('file', 10, 0); + $res = $this->controller->getPreview('token', 'file', 10, 0); $expected = new DataResponse([], Http::STATUS_BAD_REQUEST); $this->assertEquals($expected, $res); @@ -90,7 +92,7 @@ class PublicPreviewControllerTest extends TestCase { ->with($this->equalTo('token')) ->willThrowException(new ShareNotFound()); - $res = $this->controller->getPreview('file', 10, 10, 'token'); + $res = $this->controller->getPreview('token', 'file', 10, 10); $expected = new DataResponse([], Http::STATUS_NOT_FOUND); $this->assertEquals($expected, $res); @@ -105,7 +107,7 @@ class PublicPreviewControllerTest extends TestCase { $share->method('getPermissions') ->willReturn(0); - $res = $this->controller->getPreview('file', 10, 10, 'token'); + $res = $this->controller->getPreview('token', 'file', 10, 10); $expected = new DataResponse([], Http::STATUS_FORBIDDEN); $this->assertEquals($expected, $res); @@ -132,7 +134,7 @@ class PublicPreviewControllerTest extends TestCase { $preview->method('getMimeType') ->willReturn('myMime'); - $res = $this->controller->getPreview('file', 10, 10, 'token', true); + $res = $this->controller->getPreview('token', 'file', 10, 10, true); $expected = new FileDisplayResponse($preview, Http::STATUS_OK, ['Content-Type' => 'myMime']); $this->assertEquals($expected, $res); } @@ -154,7 +156,7 @@ class PublicPreviewControllerTest extends TestCase { ->with($this->equalTo('file')) ->willThrowException(new NotFoundException()); - $res = $this->controller->getPreview('file', 10, 10, 'token', true); + $res = $this->controller->getPreview('token', 'file', 10, 10, true); $expected = new DataResponse([], Http::STATUS_NOT_FOUND); $this->assertEquals($expected, $res); } @@ -186,7 +188,7 @@ class PublicPreviewControllerTest extends TestCase { $preview->method('getMimeType') ->willReturn('myMime'); - $res = $this->controller->getPreview('file', 10, 10, 'token', true); + $res = $this->controller->getPreview('token', 'file', 10, 10, true); $expected = new FileDisplayResponse($preview, Http::STATUS_OK, ['Content-Type' => 'myMime']); $this->assertEquals($expected, $res); } |