-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
CommandIsFaulty.php
40 lines (33 loc) · 1003 Bytes
/
CommandIsFaulty.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/*
* This file is part of the Symfony package.
*
* (c) Raphael Stolt <raphael.stolt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Tester\Constraint;
use PHPUnit\Framework\Constraint\Constraint;
use Symfony\Component\Console\Command\Command;
final class CommandIsFaulty extends Constraint
{
public function toString(): string
{
return 'is faulty';
}
protected function matches($other): bool
{
return Command::FAILURE === $other || Command::INVALID === $other;
}
protected function failureDescription($other): string
{
return 'the command '.$this->toString();
}
protected function additionalFailureDescription($other): string
{
return Command::SUCCESS === $other
? 'Command was successful.'
: sprintf('Command returned exit status %d.', $other);
}
}