autocomplete example

stream_set_blocking($inputStream, false);
                }

                if (false === $ret) {
                    throw new MissingInputException('Aborted.');
                }
                if ($question->isTrimmable()) {
                    $ret = trim($ret);
                }
            }
        } else {
            $autocomplete = $this->autocomplete($output$question$inputStream$autocomplete);
            $ret = $question->isTrimmable() ? trim($autocomplete) : $autocomplete;
        }

        if ($output instanceof ConsoleSectionOutput) {
            $output->addContent(''); // add EOL to the question             $output->addContent($ret);
        }

        $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();

        if ($normalizer = $question->getNormalizer()) {
            
stream_set_blocking($inputStream, false);
                }

                if (false === $ret) {
                    throw new MissingInputException('Aborted.');
                }
                if ($question->isTrimmable()) {
                    $ret = trim($ret);
                }
            }
        } else {
            $autocomplete = $this->autocomplete($output$question$inputStream$autocomplete);
            $ret = $question->isTrimmable() ? trim($autocomplete) : $autocomplete;
        }

        if ($output instanceof ConsoleSectionOutput) {
            $output->addContent(''); // add EOL to the question             $output->addContent($ret);
        }

        $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();

        if ($normalizer = $question->getNormalizer()) {
            

  public function testAutocompleteSuggestions($string$suggestions) {
    $suggestions = array_map(function D$suggestion) {
      return ['value' => $suggestion, 'label' => Html::escape($suggestion)];
    }$suggestions);
    $result = $this->autocompleteController->autocomplete(new Request(['q' => $string]));
    $this->assertSame($suggestionsjson_decode($result->getContent(), TRUE));
  }

  /** * Data provider for testAutocompleteSuggestions(). * * @return array */
  public function providerTestAutocompleteSuggestions() {
    $test_parameters = [];
    $test_parameters[] = [
      
Home | Imprint | This part of the site doesn't use cookies.