AuthorTest.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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\Author
  14. *
  15. * @uses PharIo\Manifest\Email
  16. */
  17. class AuthorTest extends TestCase {
  18. /**
  19. * @var Author
  20. */
  21. private $author;
  22. protected function setUp() {
  23. $this->author = new Author('Joe Developer', new Email('user@example.com'));
  24. }
  25. public function testCanBeCreated() {
  26. $this->assertInstanceOf(Author::class, $this->author);
  27. }
  28. public function testNameCanBeRetrieved() {
  29. $this->assertEquals('Joe Developer', $this->author->getName());
  30. }
  31. public function testEmailCanBeRetrieved() {
  32. $this->assertEquals('user@example.com', $this->author->getEmail());
  33. }
  34. public function testCanBeUsedAsString() {
  35. $this->assertEquals('Joe Developer <user@example.com>', $this->author);
  36. }
  37. }