diff --git a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php index 7e4369b259..ea994fcec7 100644 --- a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php @@ -53,7 +53,7 @@ class SymfonyQuestionHelper extends QuestionHelper */ protected function writePrompt(OutputInterface $output, Question $question) { - $text = OutputFormatter::escape($question->getQuestion()); + $text = $question->getQuestion(); $default = $question->getDefault(); switch (true) { diff --git a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php index f57d65070e..e26a254baa 100644 --- a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php @@ -79,7 +79,9 @@ class SymfonyQuestionHelperTest extends \PHPUnit_Framework_TestCase $questionHelper = new SymfonyQuestionHelper(); $questionHelper->setInputStream($this->getInputStream("\n")); $question = new Question('What is your favorite superhero?'); - $question->setValidator(function ($value) { return $value; }); + $question->setValidator(function ($value) { + return $value; + }); $this->assertNull($questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); } @@ -92,13 +94,13 @@ class SymfonyQuestionHelperTest extends \PHPUnit_Framework_TestCase $this->assertOutputContains('Can I have a backslash? [\]', $output); } - public function testAskEscapeLabel() + public function testAskEscapeAndFormatLabel() { $helper = new SymfonyQuestionHelper(); - $helper->setInputStream($this->getInputStream('sure')); - $helper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), new Question('Do you want a \?')); + $helper->setInputStream($this->getInputStream('Foo\\Bar')); + $helper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), new Question('Do you want to use Foo\\Bar or Foo\\Baz\\?', 'Foo\\Baz')); - $this->assertOutputContains('Do you want a \?', $output); + $this->assertOutputContains('Do you want to use Foo\\Bar or Foo\\Baz\\? [Foo\\Baz]:', $output); } /**