give
/
vendor
/
vendor-prefixed
/
symfony
/
http-foundation
/
Test
/
Constraint
/
ResponseIsUnprocessable.php
ResponseIsUnprocessable.php in GiveWP – Donation Plugin and Fundraising Platform 4.18.0, at vendor/vendor-prefixed/symfony/http-foundation/Test/Constraint/ResponseIsUnprocessable.php
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <[email protected]> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | |
| 12 | namespace Give\Vendors\Symfony\Component\HttpFoundation\Test\Constraint; |
| 13 | |
| 14 | use PHPUnit\Framework\Constraint\Constraint; |
| 15 | use Give\Vendors\Symfony\Component\HttpFoundation\Response; |
| 16 | |
| 17 | final class ResponseIsUnprocessable extends Constraint |
| 18 | { |
| 19 | /** |
| 20 | * {@inheritdoc} |
| 21 | */ |
| 22 | public function toString(): string |
| 23 | { |
| 24 | return 'is unprocessable'; |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * @param Response $other |
| 29 | * |
| 30 | * {@inheritdoc} |
| 31 | */ |
| 32 | protected function matches($other): bool |
| 33 | { |
| 34 | return Response::HTTP_UNPROCESSABLE_ENTITY === $other->getStatusCode(); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @param Response $other |
| 39 | * |
| 40 | * {@inheritdoc} |
| 41 | */ |
| 42 | protected function failureDescription($other): string |
| 43 | { |
| 44 | return 'the Response '.$this->toString(); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * @param Response $other |
| 49 | * |
| 50 | * {@inheritdoc} |
| 51 | */ |
| 52 | protected function additionalFailureDescription($other): string |
| 53 | { |
| 54 | return (string) $other; |
| 55 | } |
| 56 | } |
| 57 |