From 64737b741b50bed42a8cfbe1b9f290b5daf65e2e Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 18 Nov 2018 19:55:23 +0100 Subject: [PATCH] Removed CLI language param from installation --- .../src/Config/Plugin/LanguageConfigCustomizer.php | 6 +----- module/Installer/src/Model/CustomizableAppConfig.php | 4 ---- .../Config/Plugin/LanguageConfigCustomizerTest.php | 11 ++--------- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/module/Installer/src/Config/Plugin/LanguageConfigCustomizer.php b/module/Installer/src/Config/Plugin/LanguageConfigCustomizer.php index 96b8b2cb..fa157dfb 100644 --- a/module/Installer/src/Config/Plugin/LanguageConfigCustomizer.php +++ b/module/Installer/src/Config/Plugin/LanguageConfigCustomizer.php @@ -11,10 +11,8 @@ use function array_keys; class LanguageConfigCustomizer implements ConfigCustomizerInterface { public const DEFAULT_LANG = 'DEFAULT'; - public const CLI_LANG = 'CLI'; private const EXPECTED_KEYS = [ self::DEFAULT_LANG, - self::CLI_LANG, ]; private const SUPPORTED_LANGUAGES = ['en', 'es']; @@ -41,9 +39,7 @@ class LanguageConfigCustomizer implements ConfigCustomizerInterface { switch ($key) { case self::DEFAULT_LANG: - return $this->chooseLanguage($io, 'Select default language for the application in general'); - case self::CLI_LANG: - return $this->chooseLanguage($io, 'Select default language for CLI executions'); + return $this->chooseLanguage($io, 'Select default language for the application error pages'); } return ''; diff --git a/module/Installer/src/Model/CustomizableAppConfig.php b/module/Installer/src/Model/CustomizableAppConfig.php index f347519f..3ee01bc9 100644 --- a/module/Installer/src/Model/CustomizableAppConfig.php +++ b/module/Installer/src/Model/CustomizableAppConfig.php @@ -138,7 +138,6 @@ final class CustomizableAppConfig implements ArraySerializableInterface $this->setLanguage($this->mapExistingPathsToKeys([ LanguageConfigCustomizer::DEFAULT_LANG => ['translator', 'locale'], - LanguageConfigCustomizer::CLI_LANG => ['cli', 'locale'], ], $pathCollection)); $this->setUrlShortener($this->mapExistingPathsToKeys([ @@ -191,9 +190,6 @@ final class CustomizableAppConfig implements ArraySerializableInterface 'translator' => [ 'locale' => $this->language[LanguageConfigCustomizer::DEFAULT_LANG] ?? 'en', ], - 'cli' => [ - 'locale' => $this->language[LanguageConfigCustomizer::CLI_LANG] ?? 'en', - ], 'url_shortener' => [ 'domain' => [ 'schema' => $this->urlShortener[UrlShortenerConfigCustomizer::SCHEMA] ?? 'http', diff --git a/module/Installer/test/Config/Plugin/LanguageConfigCustomizerTest.php b/module/Installer/test/Config/Plugin/LanguageConfigCustomizerTest.php index 1b54048c..f73b496e 100644 --- a/module/Installer/test/Config/Plugin/LanguageConfigCustomizerTest.php +++ b/module/Installer/test/Config/Plugin/LanguageConfigCustomizerTest.php @@ -41,9 +41,8 @@ class LanguageConfigCustomizerTest extends TestCase $this->assertTrue($config->hasLanguage()); $this->assertEquals([ 'DEFAULT' => 'en', - 'CLI' => 'en', ], $config->getLanguage()); - $choice->shouldHaveBeenCalledTimes(2); + $choice->shouldHaveBeenCalledOnce(); } /** @@ -53,15 +52,11 @@ class LanguageConfigCustomizerTest extends TestCase { $choice = $this->io->choice(Argument::cetera())->willReturn('es'); $config = new CustomizableAppConfig(); - $config->setLanguage([ - 'DEFAULT' => 'en', - ]); $this->plugin->process($this->io->reveal(), $config); $this->assertEquals([ - 'DEFAULT' => 'en', - 'CLI' => 'es', + 'DEFAULT' => 'es', ], $config->getLanguage()); $choice->shouldHaveBeenCalledOnce(); } @@ -76,14 +71,12 @@ class LanguageConfigCustomizerTest extends TestCase $config = new CustomizableAppConfig(); $config->setLanguage([ 'DEFAULT' => 'es', - 'CLI' => 'es', ]); $this->plugin->process($this->io->reveal(), $config); $this->assertEquals([ 'DEFAULT' => 'es', - 'CLI' => 'es', ], $config->getLanguage()); $choice->shouldNotHaveBeenCalled(); }