CompleteCommand example

use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTester;

class CompleteCommandTest extends TestCase
{
    private CompleteCommand $command;
    private Application $application;
    private CommandTester $tester;

    protected function setUp(): void
    {
        $this->command = new CompleteCommand();

        $this->application = new Application();
        $this->application->add(new CompleteCommandTest_HelloCommand());

        $this->command->setApplication($this->application);
        $this->tester = new CommandTester($this->command);
    }

    public function testRequiredShellOption()
    {
        $this->expectExceptionMessage('The "--shell" option must be set.');
        
new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
        ]);
    }

    /** * Gets the default commands that should always be available. * * @return Command[] */
    protected function getDefaultCommands(): array
    {
        return [new HelpCommand()new ListCommand()new CompleteCommand()new DumpCompletionCommand()];
    }

    /** * Gets the default helper set with the helpers that should always be available. */
    protected function getDefaultHelperSet(): HelperSet
    {
        return new HelperSet([
            new FormatterHelper(),
            new DebugFormatterHelper(),
            new ProcessHelper(),
            
new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
        ]);
    }

    /** * Gets the default commands that should always be available. * * @return Command[] */
    protected function getDefaultCommands(): array
    {
        return [new HelpCommand()new ListCommand()new CompleteCommand()new DumpCompletionCommand()];
    }

    /** * Gets the default helper set with the helpers that should always be available. */
    protected function getDefaultHelperSet(): HelperSet
    {
        return new HelperSet([
            new FormatterHelper(),
            new DebugFormatterHelper(),
            new ProcessHelper(),
            
Home | Imprint | This part of the site doesn't use cookies.