mercredi 10 août 2016

How do I assert the result is an email in PHPUnit?

I would like to be able to test that a result is an email (myMail@provider.com ..)

I have tried to test if it's string using this :

$this->assertInternalType('string', $myExpectedEmail);

But I think it's not very accurate ... I tried this :

$this->assertInternalType('email', $myExpectedEmail);

But I get this error:

Type specified for PHPUnit_Framework_Constraint_IsType <email> is not a valid type.

Any idea/best practice of how to test email fromat in PHPunit ?

Aucun commentaire:

Enregistrer un commentaire