diff options
Diffstat (limited to 'apps/theming/tests')
-rw-r--r-- | apps/theming/tests/Controller/IconControllerTest.php | 7 | ||||
-rw-r--r-- | apps/theming/tests/ImageManagerTest.php | 14 |
2 files changed, 13 insertions, 8 deletions
diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php index 98fa4f1a243..69bbfa0e45e 100644 --- a/apps/theming/tests/Controller/IconControllerTest.php +++ b/apps/theming/tests/Controller/IconControllerTest.php @@ -28,6 +28,7 @@ use OCA\Theming\ImageManager; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataDisplayResponse; use OCP\Files\IRootFolder; +use OCP\Files\NotFoundException; use OCP\IConfig; use OCP\IL10N; use OCP\IRequest; @@ -131,6 +132,9 @@ class IconControllerTest extends TestCase { ->willReturn('filecontent'); $file = $this->iconFileMock('filename', 'filecontent'); $this->imageManager->expects($this->once()) + ->method('getCachedImage') + ->will($this->throwException(new NotFoundException())); + $this->imageManager->expects($this->once()) ->method('setCachedImage') ->willReturn($file); @@ -172,6 +176,9 @@ class IconControllerTest extends TestCase { ->willReturn('filecontent'); $file = $this->iconFileMock('filename', 'filecontent'); $this->imageManager->expects($this->once()) + ->method('getCachedImage') + ->will($this->throwException(new NotFoundException())); + $this->imageManager->expects($this->once()) ->method('setCachedImage') ->willReturn($file); diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php index b52d557ab67..4df49633d80 100644 --- a/apps/theming/tests/ImageManagerTest.php +++ b/apps/theming/tests/ImageManagerTest.php @@ -86,10 +86,6 @@ class ImageManager extends TestCase { public function testGetCachedImage() { $folder = $this->setupCacheFolder(); $folder->expects($this->once()) - ->method('fileExists') - ->with('filename') - ->willReturn(true); - $folder->expects($this->once()) ->method('getFile') ->with('filename') ->willReturn('filecontent'); @@ -97,14 +93,16 @@ class ImageManager extends TestCase { $this->assertEquals($expected, $this->imageManager->getCachedImage('filename')); } + /** + * @expectedException \OCP\Files\NotFoundException + */ public function testGetCachedImageNotFound() { $folder = $this->setupCacheFolder(); $folder->expects($this->once()) - ->method('fileExists') + ->method('getFile') ->with('filename') - ->willReturn(false); - $expected = null; - $this->assertEquals($expected, $this->imageManager->getCachedImage('filename')); + ->will($this->throwException(new \OCP\Files\NotFoundException())); + $image = $this->imageManager->getCachedImage('filename'); } public function testSetCachedImage() { |