for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace StraTDeS\VO\Tests;
use StraTDeS\VO\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);