diff --git a/apps/theming/lib/Command/UpdateConfig.php b/apps/theming/lib/Command/UpdateConfig.php index 14f8e1d5f04bd..5a6edea4b779f 100644 --- a/apps/theming/lib/Command/UpdateConfig.php +++ b/apps/theming/lib/Command/UpdateConfig.php @@ -86,7 +86,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if ($value === null) { - $value = $this->config->getAppValue('theming', $key, ''); + $storageKey = in_array($key, ImageManager::SUPPORTED_IMAGE_KEYS, true) ? $key . 'Mime' : $key; + $value = $this->config->getAppValue('theming', $storageKey, ''); if ($value !== '') { $output->writeln('' . $key . ' is currently set to ' . $value . ''); } else { diff --git a/apps/theming/tests/Command/UpdateConfigTest.php b/apps/theming/tests/Command/UpdateConfigTest.php new file mode 100644 index 0000000000000..3a15ed69e6d68 --- /dev/null +++ b/apps/theming/tests/Command/UpdateConfigTest.php @@ -0,0 +1,70 @@ +themingDefaults = $this->createMock(ThemingDefaults::class); + $this->imageManager = $this->createMock(ImageManager::class); + $this->config = $this->createMock(IConfig::class); + + $command = new UpdateConfig($this->themingDefaults, $this->imageManager, $this->config); + $this->cmd = new CommandTester($command); + } + + public function testReadRegularKeyThatIsSet(): void { + $this->config->expects($this->once()) + ->method('getAppValue') + ->with('theming', 'name', '') + ->willReturn('My Cloud'); + + $this->cmd->execute(['key' => 'name']); + + $this->assertStringContainsString('name is currently set to My Cloud', $this->cmd->getDisplay()); + } + + public function testReadImageKeyThatIsSetReadsFromMimeSuffixedStorageKey(): void { + $this->config->expects($this->once()) + ->method('getAppValue') + ->with('theming', 'logoMime', '') + ->willReturn('image/png'); + + $this->cmd->execute(['key' => 'logo']); + + $this->assertStringContainsString('logo is currently set to image/png', $this->cmd->getDisplay()); + } + + public function testReadImageKeyThatIsNotSet(): void { + $this->config->expects($this->once()) + ->method('getAppValue') + ->with('theming', 'logoMime', '') + ->willReturn(''); + + $this->cmd->execute(['key' => 'logo']); + + $this->assertStringContainsString('logo is currently not set', $this->cmd->getDisplay()); + } +}