fixed a test
This commit is contained in:
parent
aac59b167f
commit
49ceb1e662
@ -205,7 +205,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Po<TAB>Cr<TAB>P<DOWN ARROW><DOWN ARROW><NEWLINE>
|
// Po<TAB>Cr<TAB>P<DOWN ARROW><DOWN ARROW><NEWLINE>
|
||||||
$inputStream = $this->getInputStream("Pa\177\177o\tCr\t\033[A\033[A\033[A\n");
|
$inputStream = $this->getInputStream("Pa\177\177o\tCr\tP\033[A\033[A\n");
|
||||||
|
|
||||||
$dialog = new QuestionHelper();
|
$dialog = new QuestionHelper();
|
||||||
$helperSet = new HelperSet([new FormatterHelper()]);
|
$helperSet = new HelperSet([new FormatterHelper()]);
|
||||||
@ -223,21 +223,10 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
|||||||
// No effort is made to avoid irrelevant suggestions, as this is handled
|
// No effort is made to avoid irrelevant suggestions, as this is handled
|
||||||
// by the autocomplete function.
|
// by the autocomplete function.
|
||||||
$callback = function ($input) {
|
$callback = function ($input) {
|
||||||
$knownWords = [
|
$knownWords = ['Carrot', 'Creme', 'Curry', 'Parsnip', 'Pie', 'Potato', 'Tart'];
|
||||||
'Carrot',
|
|
||||||
'Creme',
|
|
||||||
'Curry',
|
|
||||||
'Parsnip',
|
|
||||||
'Pie',
|
|
||||||
'Potato',
|
|
||||||
'Tart',
|
|
||||||
];
|
|
||||||
|
|
||||||
$inputWords = explode(' ', $input);
|
$inputWords = explode(' ', $input);
|
||||||
$lastInputWord = array_pop($inputWords);
|
array_pop($inputWords);
|
||||||
$suggestionBase = $inputWords
|
$suggestionBase = $inputWords ? implode(' ', $inputWords).' ' : '';
|
||||||
? implode(' ', $inputWords).' '
|
|
||||||
: '';
|
|
||||||
|
|
||||||
return array_map(
|
return array_map(
|
||||||
function ($word) use ($suggestionBase) {
|
function ($word) use ($suggestionBase) {
|
||||||
@ -249,14 +238,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
|||||||
|
|
||||||
$question->setAutocompleterCallback($callback);
|
$question->setAutocompleterCallback($callback);
|
||||||
|
|
||||||
$this->assertSame(
|
$this->assertSame('Potato Creme Pie', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
|
||||||
'Potato Creme Pie',
|
|
||||||
$dialog->ask(
|
|
||||||
$this->createStreamableInputInterfaceMock($inputStream),
|
|
||||||
$this->createOutputInterface(),
|
|
||||||
$question
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAskWithAutocompleteWithNonSequentialKeys()
|
public function testAskWithAutocompleteWithNonSequentialKeys()
|
||||||
|
Reference in New Issue
Block a user