for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Kreta package.
*
* (c) Beñat Espiña <[email protected]>
* (c) Gorka Laucirica <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Spec\Kreta\SharedKernel\Domain\Model\Identity;
use Kreta\SharedKernel\Domain\Model\Identity\EmailAddress;
use Kreta\SharedKernel\Domain\Model\Identity\EmailAddressInvalidException;
use PhpSpec\ObjectBehavior;
class EmailAddressSpec extends ObjectBehavior
{
function it_constructs_with_valid_email_address()
$this->beConstructedWith('[email protected]');
$this->shouldHaveType(EmailAddress::class);
$this->email()->shouldBe('[email protected]');
$this->domain()->shouldBe('user.com');
$this->localPart()->shouldBe('bengor');
$this->__toString()->shouldBe('[email protected]');
}
function it_constructs_with_invalid_email_address()
$this->beConstructedWith('invalid string');
$this->shouldThrow(EmailAddressInvalidException::class)->duringInstantiation();
function it_compares_email_addresses()
$this->equals(new EmailAddress('[email protected]'))->shouldBe(true);
function it_compares_different_email_addresses()
$this->equals(new EmailAddress('[email protected]'))->shouldBe(false);