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

Jmrtech's avatar

phpunit not working

I might be missing something but I can't understand why this test won't work.

public function testWelcomeTextIsSeen()
    {
        $plan = factory(App\Plan::class)->create();

        $hospital = factory(App\Hospital::class)->create([
            'hospitalPhone' => '3104445555',
            'mobilePhone' => '+15005550006',
            'plan_id' => $plan->id,
            'stripe_active' => 1
        ]);

        $user = factory(App\User::class)->create([
            'hospital_id' => $hospital->id,
        ]);

        $this->actingAs($user)
            ->visit('/home')
            ->see('Animal Hospital');
    }

If I comment out stripe_active phpunit will run the test and the test will fail (which it should because stripe isn't active). When I leave stripe_active uncommented the out for phpunit is:

..false

I have searched through all the middleware that the request would go through, and have been unable to find a dd that may still be in there. Tried clearing the cache , composer dump, and manually adding csrf token but nothing makes this work.

0 likes
1 reply
shincoder's avatar

Try clearing your compiled views (storage/framework/views), I had similar issue.

Please or to participate in this conversation.