From 13c27c25364e545f26b6ee6221812349cce30f41 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 26 Aug 2019 22:13:30 -0400 Subject: [PATCH] Start on URL normalizer --- lib/Misc/URL.php | 66 ++++++++++++++++++++++++++++++++++++ tests/cases/Misc/TestURL.php | 31 +++++++++++++++++ tests/phpunit.dist.xml | 1 + 3 files changed, 98 insertions(+) create mode 100644 lib/Misc/URL.php create mode 100644 tests/cases/Misc/TestURL.php diff --git a/lib/Misc/URL.php b/lib/Misc/URL.php new file mode 100644 index 0000000..e32b648 --- /dev/null +++ b/lib/Misc/URL.php @@ -0,0 +1,66 @@ +assertSame($exp, URL::normalize($in)); + } + + public function provideNormalizations() { + return [ + ["/", "/"], + ["//example.com/", "//example.com/"], + ["http://example.com/", "http://example.com/"], + ["http://[::1]/", "http://[::1]/"], + ["HTTP://example.com/", "http://example.com/"], + ]; + } +} diff --git a/tests/phpunit.dist.xml b/tests/phpunit.dist.xml index 5617ddb..0086602 100644 --- a/tests/phpunit.dist.xml +++ b/tests/phpunit.dist.xml @@ -46,6 +46,7 @@ cases/Misc/TestValueInfo.php cases/Misc/TestDate.php cases/Misc/TestContext.php + cases/Misc/TestURL.php cases/User/TestInternal.php