Skip to content

Commit 8b5fb33

Browse files
committed
Fix tests for 7.0
1 parent 1eec592 commit 8b5fb33

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/ApiException.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Illuminate\Support\Str;
88
use Lanin\Laravel\ApiExceptions\Contracts\ShowsPrevious;
99
use Lanin\Laravel\ApiExceptions\Contracts\ShowsTrace;
10-
use Symfony\Component\Debug\Exception\FlattenException;
1110

1211
abstract class ApiException extends IdException implements Jsonable, \JsonSerializable, Arrayable
1312
{
@@ -83,7 +82,7 @@ public function toArray()
8382
}
8483

8584
if (env('APP_DEBUG') && $this instanceof ShowsTrace) {
86-
$return['trace'] = FlattenException::create($e)->getTrace();
85+
$return['trace'] = \Symfony\Component\ErrorHandler\Exception\FlattenException::create($e)->getTrace();
8786
}
8887

8988
return $return;

tests/ExceptionsOutputTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use Illuminate\Database\Eloquent\ModelNotFoundException;
44
use Lanin\Laravel\ApiExceptions\Support\Request;
5-
use Symfony\Component\Debug\Exception\FatalErrorException;
5+
use Symfony\Component\ErrorHandler\Error\FatalError;
66

77
class ExceptionsOutputTest extends TestCase
88
{
@@ -58,7 +58,7 @@ public function test_validation_error()
5858
public function test_internal_error_error()
5959
{
6060
$this->app['router']->get('foo', function () {
61-
throw new FatalErrorException('Fatal error.', 0, 1, __FILE__, __LINE__);
61+
throw new \Exception('Fatal error');
6262
});
6363

6464
$this->json('GET', '/foo')
@@ -76,14 +76,14 @@ public function test_internal_error_in_debug_mode()
7676
putenv('APP_DEBUG=true');
7777

7878
$this->app['router']->get('foo', function () {
79-
throw new FatalErrorException('Fatal error.', 0, 1, __FILE__, __LINE__);
79+
throw new \Exception('Fatal error');
8080
});
8181

8282
$this->json('GET', '/foo')
8383
->assertStatus(500)
8484
->assertJsonFragment([
85-
'id' => 'fatal_error_exception',
86-
'message' => 'Fatal error.'
85+
'id' => 'exception',
86+
'message' => 'Fatal error'
8787
])
8888
->assertJsonStructure([
8989
'trace',
@@ -154,4 +154,4 @@ public function rules()
154154
'name' => 'required'
155155
];
156156
}
157-
}
157+
}

0 commit comments

Comments
 (0)