New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPUnit test freezes when testing ChoiceCommand with multiSelect enabled #30138
Comments
I confirm it hangs when no input is given to the question (that is a bug).
And if your command asks multiple questions, an input string must be set for all of them (using an empty string for simulating |
Good! Thank you! Well, I provided wrong input - input that wasn't part of the Yes, I'm aware that you need to provide an answer for each question. Above you can see 6 answers ( |
Providing a wrong input to a choice question leads to the question being asked again, except if the question has no validator or if |
@chalasr The test passes now. Thanks a lot! |
…alasr) This PR was merged into the 3.4 branch. Discussion ---------- [Console] Fix command testing with missing user inputs | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #30138 | License | MIT | Doc PR | n/a Fixes the remaining cases where test execution hangs using `CommandTester`. Commits ------- ac4e9b0 [Console] Fix command testing with missing inputs
Symfony version(s) affected: Console 4.2.3
Description
This is a standalone Symfony Console project. I have one simple test, to test a command that requires input. I use the
setInputs
method in the test on$commandTester
and input 6 answers there for the 6 questions that will be asked. However, the test hangs at theChoiceQuestion
with multiSelect enabled ($question->setMultiselect(true);
), causing PHP to use a lot of processing power (CPU usage) and the Terminal ends up using a lot of RAM.How to reproduce
Make a simple test like this one:
And make sure that there is one multiSelect question (
$question->setMultiselect(true);
). The question should hang at the$questionHelper->ask($input, $output, $question)
call.Please note: This command works perfectly fine when running the command manually, only fails when running it via a test like above.
The text was updated successfully, but these errors were encountered: