EmailTest.php 952 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /*
  3. * This file is part of PharIo\Manifest.
  4. *
  5. * (c) Arne Blankerts <arne@blankerts.de>, Sebastian Heuer <sebastian@phpeople.de>, Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace PharIo\Manifest;
  11. use PHPUnit\Framework\TestCase;
  12. /**
  13. * @covers PharIo\Manifest\Email
  14. */
  15. class EmailTest extends TestCase {
  16. public function testCanBeCreatedForValidEmail() {
  17. $this->assertInstanceOf(Email::class, new Email('user@example.com'));
  18. }
  19. public function testCanBeUsedAsString() {
  20. $this->assertEquals('user@example.com', new Email('user@example.com'));
  21. }
  22. /**
  23. * @covers PharIo\Manifest\InvalidEmailException
  24. */
  25. public function testCannotBeCreatedForInvalidEmail() {
  26. $this->expectException(InvalidEmailException::class);
  27. new Email('invalid');
  28. }
  29. }