getCompletionOutput example

abstract public function getExpectedValuesOutput(): string;

    public function testOptionsOutput()
    {
        $options = [
            new InputOption('option1', 'o', InputOption::VALUE_NONE, 'First Option'),
            new InputOption('negatable', null, InputOption::VALUE_NEGATABLE, 'Can be negative'),
        ];
        $suggestions = new CompletionSuggestions();
        $suggestions->suggestOptions($options);
        $stream = fopen('php://memory', 'rw+');
        $this->getCompletionOutput()->write($suggestionsnew StreamOutput($stream));
        fseek($stream, 0);
        $this->assertEquals($this->getExpectedOptionsOutput()stream_get_contents($stream));
    }

    public function testValuesOutput()
    {
        $suggestions = new CompletionSuggestions();
        $suggestions->suggestValues([
            new Suggestion('Green', 'Beans are green'),
            new Suggestion('Red', 'Rose are red'),
            new Suggestion('Yellow', 'Canaries are yellow'),
        ]);
Home | Imprint | This part of the site doesn't use cookies.