Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion tests/Testing/TestResponseMacrosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Inertia\Tests\Testing;

use Illuminate\Testing\Fluent\AssertableJson;
use Illuminate\Testing\TestResponse;
use Inertia\Inertia;
use Inertia\Tests\TestCase;

Expand Down Expand Up @@ -30,7 +31,7 @@ public function test_it_preserves_the_ability_to_continue_chaining_laravel_test_
);

$this->assertInstanceOf(
$this->getTestResponseClass(),
TestResponse::class,
$response->assertInertia()
);
}
Expand Down