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

Mahmoud04's avatar

Laravel Modules With pestphp

i start a new project with

composer require nwidart/laravel-modules

have 1 modeule (User)

statrt to write test with Pest but i have this error

Call to a member function connection() on null

the pest code:

test('login success', function () {
    $user = User::factory()->create([
        'password' => 'password',
    ]);

    $response = $this->postJson('/api/user/auth/login', [
        'phone' => $user->phone,
        'password' => 'password',
    ]);

    $response->assertOk();
});
0 likes
1 reply
Tray2's avatar

Check your env file and make sure you have configured the database.

Please or to participate in this conversation.