Skip to content

[Console] testing with askConfirmation/ask #2351

Closed
@sstok

Description

@sstok

The documentation is missing an example how to test a command that uses askConfirmation() or ask().

/** @var \Symfony\Component\Console\Helper\DialogHelper $dialog */
$dialog = $this->getHelperSet()->get('dialog');

if (!$dialog->askConfirmation(..)) {
  // Do something.
}

As this is a really useful feature and not to hard document (I guess), I suggest adding this for Symfony Docs Hack Day.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConsoleTestingactionableClear and specific issues ready for anyone to take them.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions