-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Open
Description
Symfony version(s) affected
6.0.2
Description
I created a command with interactive questions but test fails for empty inputs
How to reproduce
In a command add the following:
$name = $io->ask('Oauth2 Client name', null, function ($value) {
if (empty($value)) {
throw new InvalidArgumentException('Client name should not be empty');
}
return $value;
});
In your test do
$this->commandTester->setInputs(['']); //null value have the same behaviour
$this->commandTester->execute(['command' => $this->command]);
It will throw Symfony\Component\Console\Exception\MissingInputException : Aborted.
If we replace the default value for the question to ''
(empty string), it works, but then it shows []
after the question (not desired)
Possible Solution
No response
Additional Context
No response