[Translator] Default value for 'sort' option in translation:update should be 'asc'

This commit is contained in:
Guillaume Verstraete 2020-01-27 18:27:28 +01:00 committed by Fabien Potencier
parent 592a31a5e6
commit fdb13c8ab8
2 changed files with 9 additions and 1 deletions

View File

@ -83,7 +83,7 @@ class TranslationUpdateCommand extends Command
new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'),
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to update'),
new InputOption('xliff-version', null, InputOption::VALUE_OPTIONAL, 'Override the default xliff version', '1.2'),
new InputOption('sort', null, InputOption::VALUE_OPTIONAL, 'Return list of messages sorted alphabetically'),
new InputOption('sort', null, InputOption::VALUE_OPTIONAL, 'Return list of messages sorted alphabetically', 'asc'),
])
->setDescription('Updates the translation file')
->setHelp(<<<'EOF'

View File

@ -48,6 +48,14 @@ class TranslationUpdateCommandTest extends TestCase
$this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay());
}
public function testDumpSortWithoutValueAndClean()
{
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]);
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--sort']);
$this->assertRegExp("/\*bar\*foo\*test/", preg_replace('/\s+/', '', $tester->getDisplay()));
$this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay());
}
public function testDumpWrongSortAndClean()
{
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]);