diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-01-05 15:56:22 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2022-02-02 11:26:36 +0100 |
commit | 3d0b5c1ff9725b9babb8c92d0549613b64b6296e (patch) | |
tree | f57d3f8ad69bf827e6f410fccab9af449fbee039 /apps/theming/tests | |
parent | 5e5c31ea845c9551e3846a193f9e00c212b9b4ce (diff) | |
download | nextcloud-server-3d0b5c1ff9725b9babb8c92d0549613b64b6296e.tar.gz nextcloud-server-3d0b5c1ff9725b9babb8c92d0549613b64b6296e.zip |
Avoid file system access on checking if an image exists
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/tests')
-rw-r--r-- | apps/theming/tests/ImageManagerTest.php | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/apps/theming/tests/ImageManagerTest.php b/apps/theming/tests/ImageManagerTest.php index 71752e99a2c..10faf6c1da1 100644 --- a/apps/theming/tests/ImageManagerTest.php +++ b/apps/theming/tests/ImageManagerTest.php @@ -136,7 +136,6 @@ class ImageManagerTest extends TestCase { ['theming', 'logoMime', ''] ) ->willReturn(0); - $this->mockGetImage('logo', $file); $this->urlGenerator->expects($this->once()) ->method('linkToRoute') ->willReturn('url-to-image'); @@ -148,9 +147,9 @@ class ImageManagerTest extends TestCase { ->method('getAppValue') ->withConsecutive( ['theming', 'cachebuster', '0'], - ['theming', 'logoMime', false] + ['theming', 'logoMime', ''] ) - ->willReturnOnConsecutiveCalls(0, false); + ->willReturnOnConsecutiveCalls(0, ''); $this->urlGenerator->expects($this->once()) ->method('imagePath') ->with('core', 'logo/logo.png') @@ -167,15 +166,8 @@ class ImageManagerTest extends TestCase { ['theming', 'cachebuster', '0'], ['theming', 'logoMime', ''] ) - ->willReturn(0); - $this->mockGetImage('logo', $file); - $this->urlGenerator->expects($this->at(0)) - ->method('getBaseUrl') - ->willReturn('baseurl'); - $this->urlGenerator->expects($this->at(1)) - ->method('getAbsoluteUrl') - ->willReturn('url-to-image-absolute?v=0'); - $this->urlGenerator->expects($this->at(2)) + ->willReturnOnConsecutiveCalls(0, 0); + $this->urlGenerator->expects($this->any()) ->method('getAbsoluteUrl') ->willReturn('url-to-image-absolute?v=0'); $this->assertEquals('url-to-image-absolute?v=0', $this->imageManager->getImageUrlAbsolute('logo', false)); @@ -207,7 +199,7 @@ class ImageManagerTest extends TestCase { ->method('getAppValue') ->with('theming', 'cachebuster', '0') ->willReturn('0'); - $this->appData->expects($this->at(0)) + $this->appData->expects($this->once()) ->method('getFolder') ->with('0') ->willReturn($folder); |