UrlTest.php 932B

123456789101112131415161718192021222324252627282930313233343536
  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\Url
  14. */
  15. class UrlTest extends TestCase {
  16. public function testCanBeCreatedForValidUrl() {
  17. $this->assertInstanceOf(Url::class, new Url('https://phar.io/'));
  18. }
  19. public function testCanBeUsedAsString() {
  20. $this->assertEquals('https://phar.io/', new Url('https://phar.io/'));
  21. }
  22. /**
  23. * @covers PharIo\Manifest\InvalidUrlException
  24. */
  25. public function testCannotBeCreatedForInvalidUrl() {
  26. $this->expectException(InvalidUrlException::class);
  27. new Url('invalid');
  28. }
  29. }