diff options
Diffstat (limited to 'apps/theming/tests/UtilTest.php')
-rw-r--r-- | apps/theming/tests/UtilTest.php | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/apps/theming/tests/UtilTest.php b/apps/theming/tests/UtilTest.php index 1ad77be72d5..247bcbae0b2 100644 --- a/apps/theming/tests/UtilTest.php +++ b/apps/theming/tests/UtilTest.php @@ -189,7 +189,6 @@ class UtilTest extends TestCase { } public function testIsAlreadyThemedFalse() { - $theme = $this->config->getSystemValue('theme', ''); $this->config->expects($this->once()) ->method('getSystemValue') ->with('theme', '') @@ -199,7 +198,6 @@ class UtilTest extends TestCase { } public function testIsAlreadyThemedTrue() { - $theme = $this->config->getSystemValue('theme', ''); $this->config->expects($this->once()) ->method('getSystemValue') ->with('theme', '') @@ -208,4 +206,35 @@ class UtilTest extends TestCase { $this->assertTrue($actual); } + public function dataIsBackgroundThemed() { + return [ + [false, false, false], + ['png', true, true], + ['backgroundColor', false, false], + ]; + } + /** + * @dataProvider dataIsBackgroundThemed + */ + public function testIsBackgroundThemed($backgroundMime, $fileFound, $expected) { + $this->config->expects($this->once()) + ->method('getAppValue') + ->with('theming', 'backgroundMime', false) + ->willReturn($backgroundMime); + $folder = $this->createMock(ISimpleFolder::class); + if ($fileFound) { + $folder->expects($this->once()) + ->method('getFile') + ->willReturn($this->createMock(ISimpleFile::class)); + } else { + $folder->expects($this->once()) + ->method('getFile') + ->willThrowException(new NotFoundException()); + } + $this->appData->expects($this->once()) + ->method('getFolder') + ->willReturn($folder); + $this->assertEquals($expected, $this->util->isBackgroundThemed()); + } + } |