Skip to content

Commit 922a469

Browse files
committed
minor #14573 [Console] Caution about disabling auto exit flag (ybenhssaien)
This PR was submitted for the 5.1 branch but it was squashed and merged into the 4.4 branch instead. Discussion ---------- [Console] Caution about disabling auto exit flag Like mentionned in the class comment : https://github.com/symfony/symfony/blob/5.1/src/Symfony/Component/Console/Tester/ApplicationTester.php#L23 : the auto exist flag should be disabled, otherwise the tests won't run <!-- 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 `5.x` for features of unreleased versions). --> Commits ------- b28603e [Console] Caution about disabling auto exit flag
2 parents 1ff60fd + b28603e commit 922a469

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

console.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,16 @@ console::
393393
not dispatched. If you need to test those events, use the
394394
:class:`Symfony\\Component\\Console\\Tester\\ApplicationTester` instead.
395395

396+
.. caution::
397+
398+
When testing commands using the :class:`Symfony\\Component\\Console\\Tester\\ApplicationTester`
399+
class, don't forget to disable the auto exit flag::
400+
401+
$application = new Application();
402+
$application->setAutoExit(false);
403+
404+
$tester = new ApplicationTester($application);
405+
396406
.. note::
397407

398408
When using the Console component in a standalone project, use

0 commit comments

Comments
 (0)