|
2 | 2 |
|
3 | 3 | namespace Dingo\Api\Tests\Exception; |
4 | 4 |
|
5 | | -use Mockery as m; |
6 | | -use RuntimeException; |
7 | | -use Illuminate\Http\Response; |
8 | | -use PHPUnit\Framework\TestCase; |
9 | 5 | use Dingo\Api\Exception\Handler; |
| 6 | +use Dingo\Api\Exception\ResourceException; |
| 7 | +use Dingo\Api\Http\Request as ApiRequest; |
10 | 8 | use Illuminate\Http\JsonResponse; |
11 | 9 | use Illuminate\Http\RedirectResponse; |
12 | | -use Dingo\Api\Http\Request as ApiRequest; |
13 | | -use Dingo\Api\Exception\ResourceException; |
| 10 | +use Illuminate\Http\Response; |
| 11 | +use Mockery as m; |
| 12 | +use PHPUnit\Framework\TestCase; |
| 13 | +use RuntimeException; |
14 | 14 | use Symfony\Component\HttpKernel\Exception\HttpException; |
15 | 15 |
|
16 | 16 | class HandlerTest extends TestCase |
@@ -55,6 +55,7 @@ public function testExceptionHandlerHandlesException() |
55 | 55 |
|
56 | 56 | $this->assertSame('foo', $response->getContent()); |
57 | 57 | $this->assertSame(404, $response->getStatusCode()); |
| 58 | + $this->assertSame($exception, $response->exception); |
58 | 59 | } |
59 | 60 |
|
60 | 61 | public function testExceptionHandlerHandlesExceptionAndCreatesNewResponse() |
@@ -142,6 +143,7 @@ public function testRegularExceptionsAreHandledByGenericHandler() |
142 | 143 |
|
143 | 144 | $this->assertSame('{"message":"Uh oh","status_code":500}', $response->getContent()); |
144 | 145 | $this->assertSame(500, $response->getStatusCode()); |
| 146 | + $this->assertSame($exception, $response->exception); |
145 | 147 | } |
146 | 148 |
|
147 | 149 | public function testResourceExceptionErrorsAreIncludedInResponse() |
|
0 commit comments