99use GuzzleHttp \Stream \Stream ;
1010use Http \Adapter \Guzzle5 \Client ;
1111use Http \Message \MessageFactory \GuzzleMessageFactory ;
12+ use PHPUnit \Framework \TestCase ;
1213
1314/**
1415 * @author Tobias Nyholm <tobias.nyholm@gmail.com>
1516 */
16- class ExceptionTest extends \PHPUnit_Framework_TestCase
17+ class ExceptionTest extends TestCase
1718{
1819 private $ guzzleRequest ;
20+
1921 private $ guzzleResponse ;
2022
2123 public function setUp ()
@@ -37,84 +39,84 @@ protected function makeRequest(GuzzleExceptions\TransferException $exception)
3739 public function testConnectException ()
3840 {
3941 // Guzzle's ConnectException should be converted to a NetworkException
40- $ this ->setExpectedException ('Http\Client\Exception\NetworkException ' );
42+ $ this ->expectException ('Http\Client\Exception\NetworkException ' );
4143 $ this ->makeRequest (new GuzzleExceptions \ConnectException ('foo ' , $ this ->guzzleRequest ));
4244 }
4345
4446 public function testTooManyRedirectsException ()
4547 {
4648 // Guzzle's TooManyRedirectsException should be converted to a RequestException
47- $ this ->setExpectedException ('Http\Client\Exception\RequestException ' );
49+ $ this ->expectException ('Http\Client\Exception\RequestException ' );
4850 $ this ->makeRequest (new GuzzleExceptions \TooManyRedirectsException ('foo ' , $ this ->guzzleRequest ));
4951 }
5052
5153 public function testRequestException ()
5254 {
5355 // Guzzle's RequestException should be converted to a HttpException
54- $ this ->setExpectedException ('Http\Client\Exception\HttpException ' );
56+ $ this ->expectException ('Http\Client\Exception\HttpException ' );
5557 $ this ->makeRequest (new GuzzleExceptions \RequestException ('foo ' , $ this ->guzzleRequest , $ this ->guzzleResponse ));
5658 }
5759
5860 public function testRequestExceptionWithoutResponse ()
5961 {
6062 // Guzzle's RequestException with no response should be converted to a RequestException
61- $ this ->setExpectedException ('Http\Client\Exception\RequestException ' );
63+ $ this ->expectException ('Http\Client\Exception\RequestException ' );
6264 $ this ->makeRequest (new GuzzleExceptions \RequestException ('foo ' , $ this ->guzzleRequest ));
6365 }
6466
6567 public function testBadResponseException ()
6668 {
6769 // Guzzle's BadResponseException should be converted to a HttpException
68- $ this ->setExpectedException ('Http\Client\Exception\HttpException ' );
70+ $ this ->expectException ('Http\Client\Exception\HttpException ' );
6971 $ this ->makeRequest (new GuzzleExceptions \BadResponseException ('foo ' , $ this ->guzzleRequest , $ this ->guzzleResponse ));
7072 }
7173
7274 public function testBadResponseExceptionWithoutResponse ()
7375 {
7476 // Guzzle's BadResponseException with no response should be converted to a RequestException
75- $ this ->setExpectedException ('Http\Client\Exception\RequestException ' );
77+ $ this ->expectException ('Http\Client\Exception\RequestException ' );
7678 $ this ->makeRequest (new GuzzleExceptions \BadResponseException ('foo ' , $ this ->guzzleRequest ));
7779 }
7880
7981 public function testClientException ()
8082 {
8183 // Guzzle's ClientException should be converted to a HttpException
82- $ this ->setExpectedException ('Http\Client\Exception\HttpException ' );
84+ $ this ->expectException ('Http\Client\Exception\HttpException ' );
8385 $ this ->makeRequest (new GuzzleExceptions \ClientException ('foo ' , $ this ->guzzleRequest , $ this ->guzzleResponse ));
8486 }
8587
8688 public function testClientExceptionWithoutResponse ()
8789 {
8890 // Guzzle's ClientException with no response should be converted to a RequestException
89- $ this ->setExpectedException ('Http\Client\Exception\RequestException ' );
91+ $ this ->expectException ('Http\Client\Exception\RequestException ' );
9092 $ this ->makeRequest (new GuzzleExceptions \ClientException ('foo ' , $ this ->guzzleRequest ));
9193 }
9294
9395 public function testServerException ()
9496 {
9597 // Guzzle's ServerException should be converted to a HttpException
96- $ this ->setExpectedException ('Http\Client\Exception\HttpException ' );
98+ $ this ->expectException ('Http\Client\Exception\HttpException ' );
9799 $ this ->makeRequest (new GuzzleExceptions \ServerException ('foo ' , $ this ->guzzleRequest , $ this ->guzzleResponse ));
98100 }
99101
100102 public function testServerExceptionWithoutResponse ()
101103 {
102104 // Guzzle's ServerException with no response should be converted to a RequestException
103- $ this ->setExpectedException ('Http\Client\Exception\RequestException ' );
105+ $ this ->expectException ('Http\Client\Exception\RequestException ' );
104106 $ this ->makeRequest (new GuzzleExceptions \BadResponseException ('foo ' , $ this ->guzzleRequest ));
105107 }
106108
107109 public function testTransferException ()
108110 {
109111 // Guzzle's TransferException should be converted to a TransferException
110- $ this ->setExpectedException ('Http\Client\Exception\TransferException ' );
112+ $ this ->expectException ('Http\Client\Exception\TransferException ' );
111113 $ this ->makeRequest (new GuzzleExceptions \TransferException ('foo ' ));
112114 }
113115
114116 public function testParseException ()
115117 {
116118 // Guzzle's ParseException should be converted to a TransferException
117- $ this ->setExpectedException ('Http\Client\Exception\TransferException ' );
119+ $ this ->expectException ('Http\Client\Exception\TransferException ' );
118120 $ this ->makeRequest (new GuzzleExceptions \ParseException ('foo ' , $ this ->guzzleResponse ));
119121 }
120122}
0 commit comments