diff options
author | Olivier Paroz <github@oparoz.com> | 2015-09-07 03:11:47 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-09-07 03:11:47 +0300 |
commit | 312bb863ccc318872661d048c9e1c8ee6ac17fe0 (patch) | |
tree | 4ca8947c9d4b93fc23be18c06a83a8b37889d73c /tests/unit | |
parent | f012d8240fc95af570496672600a2b8cdd54cb95 (diff) |
Add test for ServicePreview->createPreview when broken
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/service/PreviewServiceTest.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/service/PreviewServiceTest.php b/tests/unit/service/PreviewServiceTest.php index e7245a30..0de4ce59 100644 --- a/tests/unit/service/PreviewServiceTest.php +++ b/tests/unit/service/PreviewServiceTest.php @@ -185,6 +185,19 @@ class PreviewServiceTest extends \Test\GalleryUnitTest { $this->service->isPreviewRequired($file, $animatedPreview); } + /** + * @expectedException \OCA\Gallery\Service\InternalServerErrorServiceException + */ + public function testCreatePreviewWithBrokenSystem() { + /** @type File $file */ + $file = $this->mockJpgFile(12345); + $this->mockGetUserIdFails(); + + $this->service->createPreview( + $file, $maxX = 0, $maxY = 0, $keepAspect = true, $base64Encode = false + ); + } + public function providesPreviewValidatorData() { return [ [true, true], @@ -310,4 +323,9 @@ class PreviewServiceTest extends \Test\GalleryUnitTest { ->willThrowException(new \Exception('Boom')); } + private function mockGetUserIdFails() { + $this->environment->expects($this->once()) + ->method('getUserId') + ->willThrowException(new \Exception('Boom')); + } } |