@@ 8-26 (lines=19) @@ | ||
5 | use Psr\Http\Message\ResponseInterface; |
|
6 | use Psr7Unitesting\Utils\ValueConstraintTrait; |
|
7 | ||
8 | class ReasonPhrase extends AbstractConstraint |
|
9 | { |
|
10 | use ValueConstraintTrait; |
|
11 | ||
12 | public function toString() |
|
13 | { |
|
14 | return sprintf('has the reason phrase "%s"', $this->expected); |
|
15 | } |
|
16 | ||
17 | protected function runMatches(ResponseInterface $response) |
|
18 | { |
|
19 | return $response->getReasonPhrase() == $this->expected; |
|
20 | } |
|
21 | ||
22 | protected function additionalFailureDescription($request) |
|
23 | { |
|
24 | return sprintf('"%s" returned', $request->getReasonPhrase()); |
|
25 | } |
|
26 | } |
|
27 |
@@ 8-26 (lines=19) @@ | ||
5 | use Psr\Http\Message\ResponseInterface; |
|
6 | use Psr7Unitesting\Utils\ValueConstraintTrait; |
|
7 | ||
8 | class StatusCode extends AbstractConstraint |
|
9 | { |
|
10 | use ValueConstraintTrait; |
|
11 | ||
12 | public function toString() |
|
13 | { |
|
14 | return sprintf('has the status code "%s"', $this->expected); |
|
15 | } |
|
16 | ||
17 | protected function runMatches(ResponseInterface $response) |
|
18 | { |
|
19 | return $response->getStatusCode() == $this->expected; |
|
20 | } |
|
21 | ||
22 | protected function additionalFailureDescription($request) |
|
23 | { |
|
24 | return sprintf('"%s" returned', $request->getStatusCode()); |
|
25 | } |
|
26 | } |
|
27 |