public function LegacyDialogHelperTest::testAskWithAutocomplete in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Tests/Helper/LegacyDialogHelperTest.php \Symfony\Component\Console\Tests\Helper\LegacyDialogHelperTest::testAskWithAutocomplete()
File
- vendor/
symfony/ console/ Tests/ Helper/ LegacyDialogHelperTest.php, line 70
Class
- LegacyDialogHelperTest
- @group legacy
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 DialogHelper();
$dialog
->setInputStream($inputStream);
$bundles = array(
'AcmeDemoBundle',
'AsseticBundle',
'SecurityBundle',
'FooBundle',
);
$this
->assertEquals('AcmeDemoBundle', $dialog
->ask($this
->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles));
$this
->assertEquals('AsseticBundleTest', $dialog
->ask($this
->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles));
$this
->assertEquals('FrameworkBundle', $dialog
->ask($this
->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles));
$this
->assertEquals('SecurityBundle', $dialog
->ask($this
->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles));
$this
->assertEquals('FooBundleTest', $dialog
->ask($this
->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles));
$this
->assertEquals('AcmeDemoBundle', $dialog
->ask($this
->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles));
$this
->assertEquals('AsseticBundle', $dialog
->ask($this
->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles));
$this
->assertEquals('FooBundle', $dialog
->ask($this
->getOutputStream(), 'Please select a bundle', 'FrameworkBundle', $bundles));
}