NamespaceUriTest.php 728 B

1234567891011121314151617181920212223242526272829
  1. <?php declare(strict_types = 1);
  2. namespace TheSeer\Tokenizer;
  3. use PHPUnit\Framework\TestCase;
  4. /**
  5. * @covers \TheSeer\Tokenizer\NamespaceUri
  6. */
  7. class NamespaceUriTest extends TestCase {
  8. public function testCanBeConstructedWithValidNamespace() {
  9. $this->assertInstanceOf(
  10. NamespaceUri::class,
  11. new NamespaceUri('a:b')
  12. );
  13. }
  14. public function testInvalidNamespaceThrowsException() {
  15. $this->expectException(NamespaceUriException::class);
  16. new NamespaceUri('invalid-no-colon');
  17. }
  18. public function testStringRepresentationCanBeRetrieved() {
  19. $this->assertEquals(
  20. 'a:b',
  21. (new NamespaceUri('a:b'))->asString()
  22. );
  23. }
  24. }