@@ -205,7 +205,7 @@ public function testAskWithAutocompleteCallback()
205
205
}
206
206
207
207
// 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 \t P \033[A \033[A \n" );
209
209
210
210
$ dialog = new QuestionHelper ();
211
211
$ helperSet = new HelperSet ([new FormatterHelper ()]);
@@ -223,21 +223,10 @@ public function testAskWithAutocompleteCallback()
223
223
// No effort is made to avoid irrelevant suggestions, as this is handled
224
224
// by the autocomplete function.
225
225
$ 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 ' ];
236
227
$ inputWords = explode (' ' , $ input );
237
- $ lastInputWord = array_pop ($ inputWords );
238
- $ suggestionBase = $ inputWords
239
- ? implode (' ' , $ inputWords ).' '
240
- : '' ;
228
+ array_pop ($ inputWords );
229
+ $ suggestionBase = $ inputWords ? implode (' ' , $ inputWords ).' ' : '' ;
241
230
242
231
return array_map (
243
232
function ($ word ) use ($ suggestionBase ) {
@@ -249,14 +238,7 @@ function ($word) use ($suggestionBase) {
249
238
250
239
$ question ->setAutocompleterCallback ($ callback );
251
240
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 ));
260
242
}
261
243
262
244
public function testAskWithAutocompleteWithNonSequentialKeys ()
0 commit comments