diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-03-28 15:56:31 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-04-19 21:14:40 +0300 |
commit | b385f1c7d58561d41c952748e85e77806dc9de06 (patch) | |
tree | d433213d2ce6e8ff7bf3554845586391cf50c517 /apps/theming/tests/ImageManagerTest.php | |
parent | 7f9dabd984282c1ed5d62132c6137a8e88dea925 (diff) |
Fix theming tests
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/tests/ImageManagerTest.php')
-rw-r--r-- | apps/theming/tests/ImageManagerTest.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php index 6c0b31528fc..03fff089c69 100644 --- a/apps/theming/tests/ImageManagerTest.php +++ b/apps/theming/tests/ImageManagerTest.php @@ -23,14 +23,16 @@ */ namespace OCA\Theming\Tests; +use OCA\Theming\ImageManager; use OCP\Files\SimpleFS\ISimpleFile; use OCP\IConfig; +use OCP\IURLGenerator; use Test\TestCase; use OCP\Files\SimpleFS\ISimpleFolder; use OCP\Files\IAppData; use OCP\Files\NotFoundException; -class ImageManager extends TestCase { +class ImageManagerTest extends TestCase { /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */ protected $config; @@ -38,14 +40,18 @@ class ImageManager extends TestCase { protected $appData; /** @var ImageManager */ protected $imageManager; + /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ + private $urlGenerator; protected function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder(IConfig::class)->getMock(); - $this->appData = $this->getMockBuilder('OCP\Files\IAppData')->getMock(); - $this->imageManager = new \OCA\Theming\ImageManager( + $this->config = $this->createMock(IConfig::class); + $this->appData = $this->createMock(IAppData::class); + $this->urlGenerator = $this->createMock(IURLGenerator::class); + $this->imageManager = new ImageManager( $this->config, - $this->appData + $this->appData, + $this->urlGenerator ); } @@ -85,12 +91,12 @@ class ImageManager extends TestCase { } public function testGetCachedImage() { + $expected = $this->createMock(ISimpleFile::class); $folder = $this->setupCacheFolder(); $folder->expects($this->once()) ->method('getFile') ->with('filename') - ->willReturn('filecontent'); - $expected = 'filecontent'; + ->willReturn($expected); $this->assertEquals($expected, $this->imageManager->getCachedImage('filename')); } |