Skip to content

Commit

Permalink
fixup! [Console] Add missing assertCommandIsFaulty assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelstolt committed Nov 7, 2023
1 parent ed57c3c commit f87b71a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
3 changes: 0 additions & 3 deletions CHANGELOG-6.4.md
Expand Up @@ -7,9 +7,6 @@ in 6.4 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v6.4.0...v6.4.1

* 6.4.0-BETA3
* feature #52478 [Console] Add missing assertCommandIsFaulty assertion (raphaelstolt)

* 6.4.0-BETA2 (2023-10-29)

* bug #52329 [HttpClient] Psr18Client: parse HTTP Reason Phrase for Response (Hanmac)
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/CHANGELOG.md
Expand Up @@ -3,7 +3,7 @@ CHANGELOG

6.4
---

* Add missing `assertCommandIsFaulty` assertion
* Add `SignalMap` to map signal value to its name
* Multi-line text in vertical tables is aligned properly
* The application can also catch errors with `Application::setCatchErrors(true)`
Expand Down
Expand Up @@ -33,10 +33,8 @@ protected function failureDescription($other): string

protected function additionalFailureDescription($other): string
{
$mapping = [
Command::SUCCESS => 'Command was successful.'
];

return $mapping[$other] ?? sprintf('Command returned exit status %d.', $other);
return Command::SUCCESS === $other
? 'Command was successful.'
: sprintf('Command returned exit status %d.', $other);
}
}
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Tester/TesterTrait.php
Expand Up @@ -136,7 +136,7 @@ public function setInputs(array $inputs): static
*/
private function initOutput(array $options): void
{
$this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
$this->captureStreamsIndependently = $options['capture_stderr_separately'] ?? false;
if (!$this->captureStreamsIndependently) {
$this->output = new StreamOutput(fopen('php://memory', 'w', false));
if (isset($options['decorated'])) {
Expand Down
Expand Up @@ -23,9 +23,9 @@ public function testConstraint()
{
$constraint = new CommandIsFaulty();

$this->assertFalse($constraint->evaluate(Command::SUCCESS, '', true));
$this->assertTrue($constraint->evaluate(Command::FAILURE, '', true));
$this->assertTrue($constraint->evaluate(Command::INVALID, '', true));
$this->assertFalse($constraint->evaluate(Command::SUCCESS, returnResult: true));
$this->assertTrue($constraint->evaluate(Command::FAILURE, returnResult: true));
$this->assertTrue($constraint->evaluate(Command::INVALID, returnResult: true));
}

public function testSuccessfulCommand()
Expand Down

0 comments on commit f87b71a

Please sign in to comment.