| @@ 8-21 (lines=14) @@ | ||
| 5 | use Psr\Http\Message\MessageInterface; |
|
| 6 | use Psr7Unitesting\Utils\ValueConstraintTrait; |
|
| 7 | ||
| 8 | class HasHeader extends AbstractConstraint |
|
| 9 | { |
|
| 10 | use ValueConstraintTrait; |
|
| 11 | ||
| 12 | public function toString() |
|
| 13 | { |
|
| 14 | return sprintf('has the header "%s"', $this->expected); |
|
| 15 | } |
|
| 16 | ||
| 17 | protected function runMatches(MessageInterface $message) |
|
| 18 | { |
|
| 19 | return $message->hasHeader($this->expected); |
|
| 20 | } |
|
| 21 | } |
|
| 22 | ||
| @@ 8-21 (lines=14) @@ | ||
| 5 | use Psr\Http\Message\MessageInterface; |
|
| 6 | use Psr7Unitesting\Utils\ValueConstraintTrait; |
|
| 7 | ||
| 8 | class HasNotHeader extends AbstractConstraint |
|
| 9 | { |
|
| 10 | use ValueConstraintTrait; |
|
| 11 | ||
| 12 | public function toString() |
|
| 13 | { |
|
| 14 | return sprintf('has not the header "%s"', $this->expected); |
|
| 15 | } |
|
| 16 | ||
| 17 | protected function runMatches(MessageInterface $message) |
|
| 18 | { |
|
| 19 | return $message->hasHeader($this->expected) === false; |
|
| 20 | } |
|
| 21 | } |
|
| 22 | ||