diff --git a/tests/TestCase.php b/tests/TestCase.php index 8de5be0f..9e2a8833 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,12 +2,10 @@ namespace Inertia\Tests; -use Illuminate\Foundation\Testing\TestResponse as LegacyTestResponse; use Illuminate\Support\Facades\View; use Illuminate\Testing\TestResponse; use Inertia\Inertia; use Inertia\ServiceProvider; -use LogicException; use Orchestra\Testbench\TestCase as Orchestra; abstract class TestCase extends Orchestra @@ -30,26 +28,7 @@ protected function setUp(): void config()->set('inertia.testing.page_paths', [realpath(__DIR__)]); } - /** - * @throws LogicException - */ - protected function getTestResponseClass(): string - { - // Laravel >= 7.0 - if (class_exists(TestResponse::class)) { - return TestResponse::class; - } - - // Laravel <= 6.0 - if (class_exists(LegacyTestResponse::class)) { - return LegacyTestResponse::class; - } - - throw new LogicException('Could not detect TestResponse class.'); - } - - /** @returns TestResponse|LegacyTestResponse */ - protected function makeMockRequest($view) + protected function makeMockRequest($view): TestResponse { app('router')->get('/example-url', function () use ($view) { return $view; diff --git a/tests/Testing/TestResponseMacrosTest.php b/tests/Testing/TestResponseMacrosTest.php index 837177af..ed2e7764 100644 --- a/tests/Testing/TestResponseMacrosTest.php +++ b/tests/Testing/TestResponseMacrosTest.php @@ -3,6 +3,7 @@ namespace Inertia\Tests\Testing; use Illuminate\Testing\Fluent\AssertableJson; +use Illuminate\Testing\TestResponse; use Inertia\Inertia; use Inertia\Tests\TestCase; @@ -30,7 +31,7 @@ public function test_it_preserves_the_ability_to_continue_chaining_laravel_test_ ); $this->assertInstanceOf( - $this->getTestResponseClass(), + TestResponse::class, $response->assertInertia() ); }