Skip to main content

Testing Events with Event::fake()

Premium
2:14

The Full Lesson is Only for Premium Members

Want to access all of our courses? (36 h 00 min)

You also get:

61 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Ch1Ch4 avatar

Hi Povilas,

I would suggest to add check for listener is attached to expected event in this lessons something like:

    /**
     * Be sure that listener attached to expected event
     * @test
     */
    public function it_has_listener_attached_to_an_event(): void
    {
        Event::fake();
        Event::assertListening(
            EventClass::class,
            ListenerClass::class
        );
    }

Best Regards

👍 6
F_r avatar

this was remove from laravel 10 documentation. Someone know why please ?