@@ -237,6 +237,43 @@ public function testAskWithAutocompleteWithExactMatch()
237237 $ this ->assertSame ('b ' , $ dialog ->ask ($ this ->createStreamableInputInterfaceMock ($ inputStream ), $ this ->createOutputInterface (), $ question ));
238238 }
239239
240+ public function getInputs ()
241+ {
242+ return [
243+ ['$ ' ], // 1 byte character
244+ ['¢ ' ], // 2 bytes character
245+ ['€ ' ], // 3 bytes character
246+ ['𐍈 ' ], // 4 bytes character
247+ ];
248+ }
249+
250+ /**
251+ * @dataProvider getInputs
252+ */
253+ public function testAskWithAutocompleteWithMultiByteCharacter ($ character )
254+ {
255+ if (!$ this ->hasSttyAvailable ()) {
256+ $ this ->markTestSkipped ('`stty` is required to test autocomplete functionality ' );
257+ }
258+
259+ $ inputStream = $ this ->getInputStream ("$ character \n" );
260+
261+ $ possibleChoices = [
262+ '$ ' => '1 byte character ' ,
263+ '¢ ' => '2 bytes character ' ,
264+ '€ ' => '3 bytes character ' ,
265+ '𐍈 ' => '4 bytes character ' ,
266+ ];
267+
268+ $ dialog = new QuestionHelper ();
269+ $ dialog ->setHelperSet (new HelperSet ([new FormatterHelper ()]));
270+
271+ $ question = new ChoiceQuestion ('Please select a character ' , $ possibleChoices );
272+ $ question ->setMaxAttempts (1 );
273+
274+ $ this ->assertSame ($ character , $ dialog ->ask ($ this ->createStreamableInputInterfaceMock ($ inputStream ), $ this ->createOutputInterface (), $ question ));
275+ }
276+
240277 public function testAutocompleteWithTrailingBackslash ()
241278 {
242279 if (!$ this ->hasSttyAvailable ()) {
0 commit comments