#MailManager issue chen trying to run Mail::fake() in test

3 messages · Page 1 of 1 (latest)

chilly pine
#

HI guys! I am a junior using Laravel, and I am facing an issue when trying to run a test with Mail::fake() it is returning this error "Argument #1 ($manager) must be of type Illuminate\Mail\MailManager, null given"

it('writes a log for every outgoing email sent', function () {
    Mail::fake();
    dd(Mail::raw('Test email content', function ($message) {
        $message->to('[email protected]')
            ->subject('Test Subject');
    }));


    // expect(true)->toBeTrue();
});

I am pretty sure that my config or .env file has something wrong, but I don't understand where.

I really hope someone could help me please 🙂

timber tundra
#

Check your stack trace for the error. I doubt it's coming from your test file

chilly pine
#

I found the proplem I had not the Pest.php file :