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 ;
1920
@@ -38,84 +39,84 @@ protected function makeRequest(GuzzleExceptions\TransferException $exception)
3839 public function testConnectException ()
3940 {
4041 // Guzzle's ConnectException should be converted to a NetworkException
41- $ this ->setExpectedException ('Http\Client\Exception\NetworkException ' );
42+ $ this ->expectException ('Http\Client\Exception\NetworkException ' );
4243 $ this ->makeRequest (new GuzzleExceptions \ConnectException ('foo ' , $ this ->guzzleRequest ));
4344 }
4445
4546 public function testTooManyRedirectsException ()
4647 {
4748 // Guzzle's TooManyRedirectsException should be converted to a RequestException
48- $ this ->setExpectedException ('Http\Client\Exception\RequestException ' );
49+ $ this ->expectException ('Http\Client\Exception\RequestException ' );
4950 $ this ->makeRequest (new GuzzleExceptions \TooManyRedirectsException ('foo ' , $ this ->guzzleRequest ));
5051 }
5152
5253 public function testRequestException ()
5354 {
5455 // Guzzle's RequestException should be converted to a HttpException
55- $ this ->setExpectedException ('Http\Client\Exception\HttpException ' );
56+ $ this ->expectException ('Http\Client\Exception\HttpException ' );
5657 $ this ->makeRequest (new GuzzleExceptions \RequestException ('foo ' , $ this ->guzzleRequest , $ this ->guzzleResponse ));
5758 }
5859
5960 public function testRequestExceptionWithoutResponse ()
6061 {
6162 // Guzzle's RequestException with no response should be converted to a RequestException
62- $ this ->setExpectedException ('Http\Client\Exception\RequestException ' );
63+ $ this ->expectException ('Http\Client\Exception\RequestException ' );
6364 $ this ->makeRequest (new GuzzleExceptions \RequestException ('foo ' , $ this ->guzzleRequest ));
6465 }
6566
6667 public function testBadResponseException ()
6768 {
6869 // Guzzle's BadResponseException should be converted to a HttpException
69- $ this ->setExpectedException ('Http\Client\Exception\HttpException ' );
70+ $ this ->expectException ('Http\Client\Exception\HttpException ' );
7071 $ this ->makeRequest (new GuzzleExceptions \BadResponseException ('foo ' , $ this ->guzzleRequest , $ this ->guzzleResponse ));
7172 }
7273
7374 public function testBadResponseExceptionWithoutResponse ()
7475 {
7576 // Guzzle's BadResponseException with no response should be converted to a RequestException
76- $ this ->setExpectedException ('Http\Client\Exception\RequestException ' );
77+ $ this ->expectException ('Http\Client\Exception\RequestException ' );
7778 $ this ->makeRequest (new GuzzleExceptions \BadResponseException ('foo ' , $ this ->guzzleRequest ));
7879 }
7980
8081 public function testClientException ()
8182 {
8283 // Guzzle's ClientException should be converted to a HttpException
83- $ this ->setExpectedException ('Http\Client\Exception\HttpException ' );
84+ $ this ->expectException ('Http\Client\Exception\HttpException ' );
8485 $ this ->makeRequest (new GuzzleExceptions \ClientException ('foo ' , $ this ->guzzleRequest , $ this ->guzzleResponse ));
8586 }
8687
8788 public function testClientExceptionWithoutResponse ()
8889 {
8990 // Guzzle's ClientException with no response should be converted to a RequestException
90- $ this ->setExpectedException ('Http\Client\Exception\RequestException ' );
91+ $ this ->expectException ('Http\Client\Exception\RequestException ' );
9192 $ this ->makeRequest (new GuzzleExceptions \ClientException ('foo ' , $ this ->guzzleRequest ));
9293 }
9394
9495 public function testServerException ()
9596 {
9697 // Guzzle's ServerException should be converted to a HttpException
97- $ this ->setExpectedException ('Http\Client\Exception\HttpException ' );
98+ $ this ->expectException ('Http\Client\Exception\HttpException ' );
9899 $ this ->makeRequest (new GuzzleExceptions \ServerException ('foo ' , $ this ->guzzleRequest , $ this ->guzzleResponse ));
99100 }
100101
101102 public function testServerExceptionWithoutResponse ()
102103 {
103104 // Guzzle's ServerException with no response should be converted to a RequestException
104- $ this ->setExpectedException ('Http\Client\Exception\RequestException ' );
105+ $ this ->expectException ('Http\Client\Exception\RequestException ' );
105106 $ this ->makeRequest (new GuzzleExceptions \BadResponseException ('foo ' , $ this ->guzzleRequest ));
106107 }
107108
108109 public function testTransferException ()
109110 {
110111 // Guzzle's TransferException should be converted to a TransferException
111- $ this ->setExpectedException ('Http\Client\Exception\TransferException ' );
112+ $ this ->expectException ('Http\Client\Exception\TransferException ' );
112113 $ this ->makeRequest (new GuzzleExceptions \TransferException ('foo ' ));
113114 }
114115
115116 public function testParseException ()
116117 {
117118 // Guzzle's ParseException should be converted to a TransferException
118- $ this ->setExpectedException ('Http\Client\Exception\TransferException ' );
119+ $ this ->expectException ('Http\Client\Exception\TransferException ' );
119120 $ this ->makeRequest (new GuzzleExceptions \ParseException ('foo ' , $ this ->guzzleResponse ));
120121 }
121122}
0 commit comments