Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

victoragung@gmail.com's avatar

Writing tests for Spark app

I'm trying to write some simple tests for an app I'm building on top of Spark.

Here's what my simple test looks like:

public function testUserLogin()
    {
        $user = factory(App\User::class)->make();

        $this->actingAs($user)
             ->visit('/');
    }

I'm getting an error coming from the UserRepository of Spark.

Fatal error: Call to a member function shouldHaveSelfVisibility() on a non-object in UserRepository.php on line 20

Does anyone know why?

Is it because the factory doesn't assign an id?

0 likes
0 replies

Please or to participate in this conversation.