dimanche 3 mai 2020

Laravel test without exception, throws exception

I want to test a missing record in the database using Laravel and PHPUnit.

I have setup my tests and set that the method throws an exception. The test gives an error, because the exception has been thrown.

This is my test:

/** @test */
    public function myTest()
    {
        $this->withoutExceptionHandling();
        $this->_createMemberRequest(['email_address' => $this->email_address]);
    }

The testresults:

There was 1 error:

1) myTest

Exceptions\InvalidEmailException: Email already exists

What am I doing wrong?

Thanks for help!

Aucun commentaire:

Enregistrer un commentaire