From c3643fba10c350e83f69843eed3f1263c45a1cbf Mon Sep 17 00:00:00 2001 From: "J. King" Date: Thu, 17 Oct 2019 16:23:41 -0400 Subject: [PATCH] Tests for URL::absolute() --- tests/cases/Misc/TestURL.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/cases/Misc/TestURL.php b/tests/cases/Misc/TestURL.php index 8260c0b..e045d30 100644 --- a/tests/cases/Misc/TestURL.php +++ b/tests/cases/Misc/TestURL.php @@ -91,4 +91,21 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest { ["/#ack", "", "/#ack"], ]; } + + /** @dataProvider provideAbsolutes */ + public function testDetermineAbsoluteness(bool $exp, string $url) { + $this->assertSame($exp, URL::absolute($url)); + } + + public function provideAbsolutes() { + return [ + [true, "http://example.com/"], + [true, "HTTP://example.com/"], + [false, "//example.com/"], + [false, "/example"], + [false, "example.com/"], + [false, "example.com"], + [false, "http:///example"], + ]; + } }