Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Commit cce4836

Browse files
committed
use ::class notation
1 parent e46f069 commit cce4836

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

tests/ExceptionTest.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
use Http\Adapter\Guzzle5\Client;
1111
use Http\Message\MessageFactory\GuzzleMessageFactory;
1212
use PHPUnit\Framework\TestCase;
13+
use Http\Client\Exception\NetworkException;
14+
use Http\Client\Exception\RequestException;
15+
use Http\Client\Exception\HttpException;
16+
use Http\Client\Exception\TransferException;
1317

1418
/**
1519
* @author Tobias Nyholm <[email protected]>
@@ -39,84 +43,84 @@ protected function makeRequest(GuzzleExceptions\TransferException $exception)
3943
public function testConnectException()
4044
{
4145
// Guzzle's ConnectException should be converted to a NetworkException
42-
$this->expectException('Http\Client\Exception\NetworkException');
46+
$this->expectException(NetworkException::class);
4347
$this->makeRequest(new GuzzleExceptions\ConnectException('foo', $this->guzzleRequest));
4448
}
4549

4650
public function testTooManyRedirectsException()
4751
{
4852
// Guzzle's TooManyRedirectsException should be converted to a RequestException
49-
$this->expectException('Http\Client\Exception\RequestException');
53+
$this->expectException(RequestException::class);
5054
$this->makeRequest(new GuzzleExceptions\TooManyRedirectsException('foo', $this->guzzleRequest));
5155
}
5256

5357
public function testRequestException()
5458
{
5559
// Guzzle's RequestException should be converted to a HttpException
56-
$this->expectException('Http\Client\Exception\HttpException');
60+
$this->expectException(HttpException::class);
5761
$this->makeRequest(new GuzzleExceptions\RequestException('foo', $this->guzzleRequest, $this->guzzleResponse));
5862
}
5963

6064
public function testRequestExceptionWithoutResponse()
6165
{
6266
// Guzzle's RequestException with no response should be converted to a RequestException
63-
$this->expectException('Http\Client\Exception\RequestException');
67+
$this->expectException(RequestException::class);
6468
$this->makeRequest(new GuzzleExceptions\RequestException('foo', $this->guzzleRequest));
6569
}
6670

6771
public function testBadResponseException()
6872
{
6973
// Guzzle's BadResponseException should be converted to a HttpException
70-
$this->expectException('Http\Client\Exception\HttpException');
74+
$this->expectException(HttpException::class);
7175
$this->makeRequest(new GuzzleExceptions\BadResponseException('foo', $this->guzzleRequest, $this->guzzleResponse));
7276
}
7377

7478
public function testBadResponseExceptionWithoutResponse()
7579
{
7680
// Guzzle's BadResponseException with no response should be converted to a RequestException
77-
$this->expectException('Http\Client\Exception\RequestException');
81+
$this->expectException(RequestException::class);
7882
$this->makeRequest(new GuzzleExceptions\BadResponseException('foo', $this->guzzleRequest));
7983
}
8084

8185
public function testClientException()
8286
{
8387
// Guzzle's ClientException should be converted to a HttpException
84-
$this->expectException('Http\Client\Exception\HttpException');
88+
$this->expectException(HttpException::class);
8589
$this->makeRequest(new GuzzleExceptions\ClientException('foo', $this->guzzleRequest, $this->guzzleResponse));
8690
}
8791

8892
public function testClientExceptionWithoutResponse()
8993
{
9094
// Guzzle's ClientException with no response should be converted to a RequestException
91-
$this->expectException('Http\Client\Exception\RequestException');
95+
$this->expectException(RequestException::class);
9296
$this->makeRequest(new GuzzleExceptions\ClientException('foo', $this->guzzleRequest));
9397
}
9498

9599
public function testServerException()
96100
{
97101
// Guzzle's ServerException should be converted to a HttpException
98-
$this->expectException('Http\Client\Exception\HttpException');
102+
$this->expectException(HttpException::class);
99103
$this->makeRequest(new GuzzleExceptions\ServerException('foo', $this->guzzleRequest, $this->guzzleResponse));
100104
}
101105

102106
public function testServerExceptionWithoutResponse()
103107
{
104108
// Guzzle's ServerException with no response should be converted to a RequestException
105-
$this->expectException('Http\Client\Exception\RequestException');
109+
$this->expectException(RequestException::class);
106110
$this->makeRequest(new GuzzleExceptions\BadResponseException('foo', $this->guzzleRequest));
107111
}
108112

109113
public function testTransferException()
110114
{
111115
// Guzzle's TransferException should be converted to a TransferException
112-
$this->expectException('Http\Client\Exception\TransferException');
116+
$this->expectException(TransferException::class);
113117
$this->makeRequest(new GuzzleExceptions\TransferException('foo'));
114118
}
115119

116120
public function testParseException()
117121
{
118122
// Guzzle's ParseException should be converted to a TransferException
119-
$this->expectException('Http\Client\Exception\TransferException');
123+
$this->expectException(TransferException::class);
120124
$this->makeRequest(new GuzzleExceptions\ParseException('foo', $this->guzzleResponse));
121125
}
122126
}

0 commit comments

Comments
 (0)