| @@ 15-51 (lines=37) @@ | ||
| 12 | ||
| 13 | use expect\FailedMessage; |
|
| 14 | ||
| 15 | final class ToBeFalsey implements ReportableMatcher |
|
| 16 | { |
|
| 17 | /** |
|
| 18 | * @var mixed |
|
| 19 | */ |
|
| 20 | private $actual; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * {@inheritdoc} |
|
| 24 | */ |
|
| 25 | public function match($actual) |
|
| 26 | { |
|
| 27 | $this->actual = $actual; |
|
| 28 | ||
| 29 | $truthyMatcher = new TruthyMatcher(); |
|
| 30 | ||
| 31 | return $truthyMatcher->match($actual) === false; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * {@inheritdoc} |
|
| 36 | */ |
|
| 37 | public function reportFailed(FailedMessage $message) |
|
| 38 | { |
|
| 39 | $message->appendText('Expected falsey value, got ') |
|
| 40 | ->appendValue($this->actual); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * {@inheritdoc} |
|
| 45 | */ |
|
| 46 | public function reportNegativeFailed(FailedMessage $message) |
|
| 47 | { |
|
| 48 | $message->appendText('Expected truthy value, got ') |
|
| 49 | ->appendValue($this->actual); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| @@ 15-51 (lines=37) @@ | ||
| 12 | ||
| 13 | use expect\FailedMessage; |
|
| 14 | ||
| 15 | final class ToBeTruthy implements ReportableMatcher |
|
| 16 | { |
|
| 17 | /** |
|
| 18 | * @var mixed |
|
| 19 | */ |
|
| 20 | private $actual; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * {@inheritdoc} |
|
| 24 | */ |
|
| 25 | public function match($actual) |
|
| 26 | { |
|
| 27 | $this->actual = $actual; |
|
| 28 | ||
| 29 | $truthyMatcher = new TruthyMatcher(); |
|
| 30 | ||
| 31 | return $truthyMatcher->match($this->actual); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * {@inheritdoc} |
|
| 36 | */ |
|
| 37 | public function reportFailed(FailedMessage $message) |
|
| 38 | { |
|
| 39 | $message->appendText('Expected truthy value, got ') |
|
| 40 | ->appendValue($this->actual); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * {@inheritdoc} |
|
| 45 | */ |
|
| 46 | public function reportNegativeFailed(FailedMessage $message) |
|
| 47 | { |
|
| 48 | $message->appendText('Expected falsey value, got ') |
|
| 49 | ->appendValue($this->actual); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||