Skip to content

Commit 2ac6600

Browse files
authored
Merge pull request #743 from inertiajs/remove-legacy-test-response-check
[2.x] Remove check for `TestResponse` from Laravel <= 6.0
2 parents cf9c8b3 + 48e366c commit 2ac6600

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

tests/TestCase.php

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
namespace Inertia\Tests;
44

5-
use Illuminate\Foundation\Testing\TestResponse as LegacyTestResponse;
65
use Illuminate\Support\Facades\View;
76
use Illuminate\Testing\TestResponse;
87
use Inertia\Inertia;
98
use Inertia\ServiceProvider;
10-
use LogicException;
119
use Orchestra\Testbench\TestCase as Orchestra;
1210

1311
abstract class TestCase extends Orchestra
@@ -30,26 +28,7 @@ protected function setUp(): void
3028
config()->set('inertia.testing.page_paths', [realpath(__DIR__)]);
3129
}
3230

33-
/**
34-
* @throws LogicException
35-
*/
36-
protected function getTestResponseClass(): string
37-
{
38-
// Laravel >= 7.0
39-
if (class_exists(TestResponse::class)) {
40-
return TestResponse::class;
41-
}
42-
43-
// Laravel <= 6.0
44-
if (class_exists(LegacyTestResponse::class)) {
45-
return LegacyTestResponse::class;
46-
}
47-
48-
throw new LogicException('Could not detect TestResponse class.');
49-
}
50-
51-
/** @returns TestResponse|LegacyTestResponse */
52-
protected function makeMockRequest($view)
31+
protected function makeMockRequest($view): TestResponse
5332
{
5433
app('router')->get('/example-url', function () use ($view) {
5534
return $view;

tests/Testing/TestResponseMacrosTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Inertia\Tests\Testing;
44

55
use Illuminate\Testing\Fluent\AssertableJson;
6+
use Illuminate\Testing\TestResponse;
67
use Inertia\Inertia;
78
use Inertia\Tests\TestCase;
89

@@ -30,7 +31,7 @@ public function test_it_preserves_the_ability_to_continue_chaining_laravel_test_
3031
);
3132

3233
$this->assertInstanceOf(
33-
$this->getTestResponseClass(),
34+
TestResponse::class,
3435
$response->assertInertia()
3536
);
3637
}

0 commit comments

Comments
 (0)