55use Mockery as m ;
66use RuntimeException ;
77use Illuminate \Http \Response ;
8- use PHPUnit_Framework_TestCase ;
8+ use PHPUnit \ Framework \ TestCase ;
99use Dingo \Api \Exception \Handler ;
1010use Illuminate \Http \JsonResponse ;
1111use Illuminate \Http \RedirectResponse ;
1212use Dingo \Api \Http \Request as ApiRequest ;
1313use Dingo \Api \Exception \ResourceException ;
1414use Symfony \Component \HttpKernel \Exception \HttpException ;
1515
16- class HandlerTest extends PHPUnit_Framework_TestCase
16+ class HandlerTest extends TestCase
1717{
1818 protected $ parentHandler ;
1919 protected $ exceptionHandler ;
@@ -67,7 +67,7 @@ public function testExceptionHandlerHandlesExceptionAndCreatesNewResponse()
6767
6868 $ response = $ this ->exceptionHandler ->handle ($ exception );
6969
70- $ this ->assertInstanceOf (' Illuminate\Http\ Response' , $ response );
70+ $ this ->assertInstanceOf (Response::class , $ response );
7171 $ this ->assertSame ('foo ' , $ response ->getContent ());
7272 $ this ->assertSame (404 , $ response ->getStatusCode ());
7373 }
@@ -82,7 +82,7 @@ public function testExceptionHandlerHandlesExceptionWithRedirectResponse()
8282
8383 $ response = $ this ->exceptionHandler ->handle ($ exception );
8484
85- $ this ->assertInstanceOf (' Illuminate\Http\ RedirectResponse' , $ response );
85+ $ this ->assertInstanceOf (RedirectResponse::class , $ response );
8686 $ this ->assertSame ('foo ' , $ response ->getTargetUrl ());
8787 $ this ->assertSame (302 , $ response ->getStatusCode ());
8888 }
@@ -97,7 +97,7 @@ public function testExceptionHandlerHandlesExceptionWithJsonResponse()
9797
9898 $ response = $ this ->exceptionHandler ->handle ($ exception );
9999
100- $ this ->assertInstanceOf (' Illuminate\Http\ JsonResponse' , $ response );
100+ $ this ->assertInstanceOf (JsonResponse::class , $ response );
101101 $ this ->assertSame ('{"foo":"bar"} ' , $ response ->getContent ());
102102 $ this ->assertSame (404 , $ response ->getStatusCode ());
103103 }
@@ -108,7 +108,7 @@ public function testExceptionHandlerReturnsGenericWhenNoMatchingHandler()
108108
109109 $ response = $ this ->exceptionHandler ->handle ($ exception );
110110
111- $ this ->assertInstanceOf (' Illuminate\Http\ Response' , $ response );
111+ $ this ->assertInstanceOf (Response::class , $ response );
112112 $ this ->assertSame ('{"message":"bar","status_code":404} ' , $ response ->getContent ());
113113 $ this ->assertSame (404 , $ response ->getStatusCode ());
114114 }
@@ -129,7 +129,7 @@ public function testUsingMultidimensionalArrayForGenericResponse()
129129
130130 $ response = $ this ->exceptionHandler ->handle ($ exception );
131131
132- $ this ->assertInstanceOf (' Illuminate\Http\ Response' , $ response );
132+ $ this ->assertInstanceOf (Response::class , $ response );
133133 $ this ->assertSame ('{"error":{"message":"bar","status_code":404}} ' , $ response ->getContent ());
134134 $ this ->assertSame (404 , $ response ->getStatusCode ());
135135 }
@@ -150,7 +150,7 @@ public function testResourceExceptionErrorsAreIncludedInResponse()
150150
151151 $ response = $ this ->exceptionHandler ->handle ($ exception );
152152
153- $ this ->assertInstanceOf (' Illuminate\Http\ Response' , $ response );
153+ $ this ->assertInstanceOf (Response::class , $ response );
154154 $ this ->assertSame ('{"message":"bar","errors":{"foo":["bar"]},"code":10,"status_code":422} ' , $ response ->getContent ());
155155 $ this ->assertSame (422 , $ response ->getStatusCode ());
156156 }
@@ -174,7 +174,7 @@ public function testHttpExceptionsWithNoMessageUseStatusCodeMessage()
174174
175175 $ response = $ this ->exceptionHandler ->handle ($ exception );
176176
177- $ this ->assertInstanceOf (' Illuminate\Http\ Response' , $ response );
177+ $ this ->assertInstanceOf (Response::class , $ response );
178178 $ this ->assertSame ('{"message":"404 Not Found","status_code":404} ' , $ response ->getContent ());
179179 $ this ->assertSame (404 , $ response ->getStatusCode ());
180180 }
0 commit comments