Removed CLI language param from installation

This commit is contained in:
Alejandro Celaya 2018-11-18 19:55:23 +01:00
parent d4d65bdf37
commit 64737b741b
3 changed files with 3 additions and 18 deletions

View file

@ -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 '';

View file

@ -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',

View file

@ -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();
}