A trait for testing laracasts/flash

Flash message

The Laracasts/flash package is an amazing solution to send Bootstrap 3 styled flash messages to the user’s screen.

After you have set it up, you can do something like this in your controller:

public function store()

{

    flash('Welcome Aboard!');

    return home();

}

And you get a flash message looking like this:

Example flash message
Notice the green bar here

But how do you test the flash message was actually sent using phpunit? Continue reading “A trait for testing laracasts/flash”