claudiodekker / inertia-laravel-testing

Testing helpers for https://github.com/inertiajs/inertia-laravel
MIT License
134 stars 6 forks source link

BadMethodCallException : Method Illuminate\Http\Response::assertInertia does not exist. #16

Closed lucabecchetti closed 3 years ago

lucabecchetti commented 3 years ago

I have a test package like this, but it seems that testing not working:

public function test_authorized_user_can_access_resource(): void
    {
        $user = factory(User::class)->create();
        $user->assignRole('admin');
        $response = $this->actingAs($user)->get(Manager::createUri('pages'));
        $response->assertStatus(200);
        $response->assertInertia('resources/ResourceIndex');
    }

The error:

BadMethodCallException : Method Illuminate\Http\Response::assertInertia does not exist.

lucabecchetti commented 3 years ago

Just need to add this:

protected function getPackageProviders($app) { return [ .... InertiaTestingServiceProvider::class .... ]; }