New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in phpunit. #112

Open
Tjoosten opened this Issue Aug 6, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@Tjoosten

Tjoosten commented Aug 6, 2017

Hi i'm testing my application out but now i got a strange error.

My steps:

https://gist.github.com/Tjoosten/da3e709f915493899ca4c23135d7b6a3

Can someone help me?

@paulhenri-l

This comment has been minimized.

paulhenri-l commented Aug 13, 2017

Try with this one

    protected function assertFlash($level, $message, $important = false, $title = null, $overlay = false)
    {
        $expectedNotification = [
            'title' => $title,
            'message' => $message,
            'level' => $level,
            'important' => $important,
            'overlay' => $overlay
        ];

        $flashNotifications = json_decode(json_encode(session('flash_notification')), true);

        $this->assertContains(
            $expectedNotification,
            $flashNotifications,
            "Failed asserting that the flash message '$message' is present."
        );
    }
@sandervanhooft

This comment has been minimized.

sandervanhooft commented Jan 29, 2018

@paulhenri-l Amazing solution, thanks!

Minor improvement:

if (! $flashNotifications) {
	$this->fail('Failed asserting that a flash message was sent.');
}

I created a gist for this here.

@sandervanhooft

This comment has been minimized.

sandervanhooft commented Apr 9, 2018

I have been using this assertFlash method so much lately I decided to write a short blog post on it here.

Thanks again @paulhenri-l !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment