From e70b53d3ef0991f3a09bc7fcaf070f27f2e4b83a Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Tue, 22 Aug 2023 16:12:24 +0200 Subject: Add prefix to it_url::absolute() for OneDomain support, add tests for relative paths --- test/it_url.t | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/it_url.t b/test/it_url.t index d2bb653..c147acc 100755 --- a/test/it_url.t +++ b/test/it_url.t @@ -74,6 +74,8 @@ is( ); # it_url::absolute() tests +$php_self = $_SERVER['PHP_SELF']; +$_SERVER['PHP_SELF'] = '/foo/bar/self.php'; list ($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT'], $_SERVER['HTTPS']) = ["gna.ch", null, null]; is( it_url::absolute("/"), @@ -81,6 +83,18 @@ is( 'it_url::absolute basic' ); +is( + it_url::absolute("qux"), + 'http://gna.ch/foo/bar/qux', + 'it_url::absolute relative path' +); + +is( + it_url::absolute("qux", 'https', '/prefix'), + 'https://gna.ch/prefix/foo/bar/qux', + 'it_url::absolute relative path' +); + list ($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT'], $_SERVER['HTTPS']) = ["gna.ch:42", 42, null]; is( it_url::absolute("/port"), @@ -115,6 +129,7 @@ is( 'https://gna.ch/foo', 'it_url::absolute force https overwriting existing url' ); +$_SERVER['PHP_SELF'] = $php_self; $url = new it_url('http://www.gna.ch/'); -- cgit v1.2.3