BadResponseExceptionTest.php 723 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace GuzzleHttp\Tests\Exception;
  3. use GuzzleHttp\Exception\BadResponseException;
  4. use GuzzleHttp\Psr7\Request;
  5. use GuzzleHttp\Psr7\Response;
  6. use PHPUnit\Framework\TestCase;
  7. class BadResponseExceptionTest extends TestCase
  8. {
  9. public function testHasNoResponse()
  10. {
  11. $req = new Request('GET', '/');
  12. $prev = new \Exception();
  13. $response = new Response();
  14. $e = new BadResponseException('foo', $req, $response, $prev);
  15. self::assertSame($req, $e->getRequest());
  16. self::assertSame($response, $e->getResponse());
  17. self::assertTrue($e->hasResponse());
  18. self::assertSame('foo', $e->getMessage());
  19. self::assertSame($prev, $e->getPrevious());
  20. }
  21. }