public function QuestionHelperTest::testAskWithAutocomplete in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Tests/Helper/QuestionHelperTest.php \Symfony\Component\Console\Tests\Helper\QuestionHelperTest::testAskWithAutocomplete()
File
- vendor/
symfony/ console/ Tests/ Helper/ QuestionHelperTest.php, line 103
Class
- QuestionHelperTest
- @group tty
Namespace
Symfony\Component\Console\Tests\HelperCode
public function testAskWithAutocomplete() {
if (!$this
->hasSttyAvailable()) {
$this
->markTestSkipped('`stty` is required to test autocomplete functionality');
}
// Acm<NEWLINE>
// Ac<BACKSPACE><BACKSPACE>s<TAB>Test<NEWLINE>
// <NEWLINE>
// <UP ARROW><UP ARROW><NEWLINE>
// <UP ARROW><UP ARROW><UP ARROW><UP ARROW><UP ARROW><TAB>Test<NEWLINE>
// <DOWN ARROW><NEWLINE>
// S<BACKSPACE><BACKSPACE><DOWN ARROW><DOWN ARROW><NEWLINE>
// F00<BACKSPACE><BACKSPACE>oo<TAB><NEWLINE>
$inputStream = $this
->getInputStream("Acm\nAcs\tTest\n\n\33[A\33[A\n\33[A\33[A\33[A\33[A\33[A\tTest\n\33[B\nS\33[B\33[B\nF00oo\t\n");
$dialog = new QuestionHelper();
$dialog
->setInputStream($inputStream);
$helperSet = new HelperSet(array(
new FormatterHelper(),
));
$dialog
->setHelperSet($helperSet);
$question = new Question('Please select a bundle', 'FrameworkBundle');
$question
->setAutocompleterValues(array(
'AcmeDemoBundle',
'AsseticBundle',
'SecurityBundle',
'FooBundle',
));
$this
->assertEquals('AcmeDemoBundle', $dialog
->ask($this
->createInputInterfaceMock(), $this
->createOutputInterface(), $question));
$this
->assertEquals('AsseticBundleTest', $dialog
->ask($this
->createInputInterfaceMock(), $this
->createOutputInterface(), $question));
$this
->assertEquals('FrameworkBundle', $dialog
->ask($this
->createInputInterfaceMock(), $this
->createOutputInterface(), $question));
$this
->assertEquals('SecurityBundle', $dialog
->ask($this
->createInputInterfaceMock(), $this
->createOutputInterface(), $question));
$this
->assertEquals('FooBundleTest', $dialog
->ask($this
->createInputInterfaceMock(), $this
->createOutputInterface(), $question));
$this
->assertEquals('AcmeDemoBundle', $dialog
->ask($this
->createInputInterfaceMock(), $this
->createOutputInterface(), $question));
$this
->assertEquals('AsseticBundle', $dialog
->ask($this
->createInputInterfaceMock(), $this
->createOutputInterface(), $question));
$this
->assertEquals('FooBundle', $dialog
->ask($this
->createInputInterfaceMock(), $this
->createOutputInterface(), $question));
}