Skip to content

Commit b54b7ee

Browse files
committed
minor #17326 [Console] docs(console): add caution for testing option (jeremyhalin)
This PR was submitted for the 6.1 branch but it was merged into the 5.4 branch instead. Discussion ---------- [Console] docs(console): add caution for testing option Add a caution about `InputOption::VALUE_NONE` testing. Passing only a value without a key doesn't work and can lead to misunderstanding. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `6.x` for features of unreleased versions). --> Commits ------- 26a7fab docs(console): add caution for testing option
2 parents 6f72b56 + 26a7fab commit b54b7ee

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

console.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,15 @@ call ``setAutoExit(false)`` on it to get the command result in ``CommandTester``
546546
$application->setAutoExit(false);
547547

548548
$tester = new ApplicationTester($application);
549+
550+
551+
.. caution::
552+
553+
When testing ``InputOption::VALUE_NONE`` command option, be sure to pass an empty
554+
value like so::
555+
556+
$commandTester = new CommandTester($command);
557+
$commandTester->execute(['--some-option' => '']);
549558

550559
.. note::
551560

0 commit comments

Comments
 (0)