From 1999e89e7c213d33d221288687a4658fb712ee05 Mon Sep 17 00:00:00 2001 From: Abdellatif Ait boudad Date: Thu, 10 Dec 2015 19:14:16 +0000 Subject: [PATCH] [TranslationUpdateCommand] fixed undefined resultMessage var. --- .../FrameworkBundle/Command/TranslationUpdateCommand.php | 4 ++-- .../Tests/Command/TranslationUpdateCommandTest.php | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php index 01678dd890..cb3dd0092c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php @@ -150,6 +150,8 @@ EOF return; } + $resultMessage = 'Translation files were successfully updated.'; + // show compiled list of messages if (true === $input->getOption('dump-messages')) { $extractedMessagesCount = 0; @@ -205,8 +207,6 @@ EOF if (true === $input->getOption('dump-messages')) { $resultMessage .= ' and translation files were updated.'; - } else { - $resultMessage = 'Translation files were successfully updated.'; } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php index a04a0cccad..f7eca9d366 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php @@ -28,6 +28,14 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase $tester = $this->createCommandTester($this->getContainer(array('foo' => 'foo'))); $tester->execute(array('command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true)); $this->assertRegExp('/foo/', $tester->getDisplay()); + $this->assertRegExp('/2 messages were successfully extracted/', $tester->getDisplay()); + } + + public function testWriteMessages() + { + $tester = $this->createCommandTester($this->getContainer(array('foo' => 'foo'))); + $tester->execute(array('command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--force' => true)); + $this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay()); } protected function setUp()