Skip to content

Commit ca4d3f9

Browse files
committed
fixed a test
1 parent 64df53f commit ca4d3f9

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

Tests/Helper/QuestionHelperTest.php

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function testAskWithAutocompleteCallback()
205205
}
206206

207207
// Po<TAB>Cr<TAB>P<DOWN ARROW><DOWN ARROW><NEWLINE>
208-
$inputStream = $this->getInputStream("Pa\177\177o\tCr\t\033[A\033[A\033[A\n");
208+
$inputStream = $this->getInputStream("Pa\177\177o\tCr\tP\033[A\033[A\n");
209209

210210
$dialog = new QuestionHelper();
211211
$helperSet = new HelperSet([new FormatterHelper()]);
@@ -223,21 +223,10 @@ public function testAskWithAutocompleteCallback()
223223
// No effort is made to avoid irrelevant suggestions, as this is handled
224224
// by the autocomplete function.
225225
$callback = function ($input) {
226-
$knownWords = [
227-
'Carrot',
228-
'Creme',
229-
'Curry',
230-
'Parsnip',
231-
'Pie',
232-
'Potato',
233-
'Tart',
234-
];
235-
226+
$knownWords = ['Carrot', 'Creme', 'Curry', 'Parsnip', 'Pie', 'Potato', 'Tart'];
236227
$inputWords = explode(' ', $input);
237-
$lastInputWord = array_pop($inputWords);
238-
$suggestionBase = $inputWords
239-
? implode(' ', $inputWords).' '
240-
: '';
228+
array_pop($inputWords);
229+
$suggestionBase = $inputWords ? implode(' ', $inputWords).' ' : '';
241230

242231
return array_map(
243232
function ($word) use ($suggestionBase) {
@@ -249,14 +238,7 @@ function ($word) use ($suggestionBase) {
249238

250239
$question->setAutocompleterCallback($callback);
251240

252-
$this->assertSame(
253-
'Potato Creme Pie',
254-
$dialog->ask(
255-
$this->createStreamableInputInterfaceMock($inputStream),
256-
$this->createOutputInterface(),
257-
$question
258-
)
259-
);
241+
$this->assertSame('Potato Creme Pie', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
260242
}
261243

262244
public function testAskWithAutocompleteWithNonSequentialKeys()

0 commit comments

Comments
 (0)