Skip to content

Commit 811cf9c

Browse files
committed
[Tests] Remove defunct test exception handler code
The removed code is no longer required because more recent versions of Laravel allow use of the `withoutExceptionHandling` helper.
1 parent 93cfc88 commit 811cf9c

File tree

4 files changed

+9
-43
lines changed

4 files changed

+9
-43
lines changed

src/Testing/TestExceptionHandler.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ class TestExceptionHandler extends ExceptionHandler
4949

5050
use HandlesErrors;
5151

52-
/**
53-
* Whether Exceptions should be thrown to PHPUnit to handle.
54-
*
55-
* @var bool
56-
*/
57-
public $rethrow = true;
58-
5952
/**
6053
* @var array
6154
*/
@@ -69,9 +62,7 @@ class TestExceptionHandler extends ExceptionHandler
6962
*/
7063
public function report(Exception $e)
7164
{
72-
if ($this->shouldReport($e) && $this->rethrow) {
73-
throw $e;
74-
}
65+
// no-op
7566
}
7667

7768
/**

tests/lib/Integration/ErrorsTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,6 @@ class ErrorsTest extends TestCase
4040
*/
4141
protected $resourceType = 'posts';
4242

43-
/**
44-
* @return void
45-
*/
46-
protected function setUp(): void
47-
{
48-
parent::setUp();
49-
$this->doNotRethrowExceptions();
50-
}
51-
5243
/**
5344
* Returns a JSON API error for 404.
5445
*/

tests/lib/Integration/Pagination/CursorPagingTest.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -221,16 +221,14 @@ public function testBeforeWithEqualDates()
221221

222222
/**
223223
* If the before key does not exist, we expect the cursor builder
224-
* to throw an exception. Applications should validate the id
225-
* before passing it to the cursor.
224+
* to throw an exception which would constitute an internal server error.
225+
* Applications should validate the id before passing it to the cursor.
226226
*/
227227
public function testBeforeDoesNotExist()
228228
{
229-
$this->expectException(\OutOfRangeException::class);
230-
$this->expectExceptionMessage('999');
231-
232229
$this->actingAsUser()
233-
->doSearch(['page' => ['before' => '999']]);
230+
->doSearch(['page' => ['before' => '999']])
231+
->assertStatus(500);
234232
}
235233

236234
public function testAfter()
@@ -456,16 +454,14 @@ public function testAfterWithCustomKey()
456454

457455
/**
458456
* If the after key does not exist, we expect the cursor builder
459-
* to throw an exception. Applications should validate the id
460-
* before passing it to the cursor.
457+
* to throw an exception which would constitute an internal server error.
458+
* Applications should validate the id before passing it to the cursor.
461459
*/
462460
public function testAfterDoesNotExist()
463461
{
464-
$this->expectException(\OutOfRangeException::class);
465-
$this->expectExceptionMessage('999');
466-
467462
$this->actingAsUser()
468-
->doSearch(['page' => ['after' => '999']]);
463+
->doSearch(['page' => ['after' => '999']])
464+
->assertStatus(500);
469465
}
470466

471467
/**

tests/lib/Integration/TestCase.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,6 @@ protected function resolveApplicationExceptionHandler($app)
9494
$app->singleton(ExceptionHandler::class, TestExceptionHandler::class);
9595
}
9696

97-
/**
98-
* Set the test exception handler to not re-throw exceptions.
99-
*
100-
* @return void
101-
*/
102-
protected function doNotRethrowExceptions()
103-
{
104-
/** @var TestExceptionHandler $handler */
105-
$handler = $this->app->make(ExceptionHandler::class);
106-
$handler->rethrow = false;
107-
}
108-
10997
/**
11098
* Use the default dummy app routes.
11199
*

0 commit comments

Comments
 (0)