for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace StraTDeS\VO\Tests\Single;
use StraTDeS\VO\Single\Email;
use PHPUnit\Framework\TestCase;
class EmailTest extends TestCase
{
public function testGivenAValidEmailAValidVOIsReturned(): void
// Arrange
$email = "[email protected]";
// Act
$emailVO = Email::fromValue($email);
// Assert
$this->assertInstanceOf(Email::class, $emailVO);
$this->assertEquals($email, $emailVO->value());
}
public function testGivenAnInvalidEmailAnExceptionIsThrown(): void
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage("foo@bar is not a valid email");
$email = "foo@bar";
Email::fromValue($email);
public function testGivenTwoEqualEmailsEqualReturnsTrue(): void
$email1 = Email::fromValue("[email protected]");
$email2 = Email::fromValue("[email protected]");
$equal = $email1->equal($email2);
$this->assertTrue($equal);
public function testGivenTwoNotEqualEmailsEqualReturnsFalse(): void
$this->assertFalse($equal);