| 1 |
<?php |
| 2 |
namespace GuzzleHttp\Tests\Exception; |
| 3 |
|
| 4 |
use GuzzleHttp\Exception\ConnectException; |
| 5 |
use GuzzleHttp\Psr7\Request; |
| 6 |
use PHPUnit\Framework\TestCase; |
| 7 |
|
| 8 |
/** |
| 9 |
* @covers \GuzzleHttp\Exception\ConnectException |
| 10 |
*/ |
| 11 |
class ConnectExceptionTest extends TestCase |
| 12 |
{ |
| 13 |
public function testHasNoResponse() |
| 14 |
{ |
| 15 |
$req = new Request('GET', '/'); |
| 16 |
$prev = new \Exception(); |
| 17 |
$e = new ConnectException('foo', $req, $prev, ['foo' => 'bar']); |
| 18 |
self::assertSame($req, $e->getRequest()); |
| 19 |
self::assertNull($e->getResponse()); |
| 20 |
self::assertFalse($e->hasResponse()); |
| 21 |
self::assertSame('foo', $e->getMessage()); |
| 22 |
self::assertSame('bar', $e->getHandlerContext()['foo']); |
| 23 |
self::assertSame($prev, $e->getPrevious()); |
| 24 |
} |
| 25 |
} |
| 26 |
|