summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/it.t4
-rwxr-xr-xtest/it_url.t59
2 files changed, 13 insertions, 50 deletions
diff --git a/test/it.t b/test/it.t
index dc60727..bbda730 100755
--- a/test/it.t
+++ b/test/it.t
@@ -437,8 +437,6 @@ is(it::substr_replace('abc', 'xyz', 0, 2), substr_replace('abc', 'xyz', 0, 2), '
is(it::substr_replace('abc', 'xyz', 0, 10), substr_replace('abc', 'xyz', 0, 10), 'it::substr_replace replacing past end of haystack');
is(it::substr_replace('abcdefgh', 'xyz', 10, 4), substr_replace('abcdefgh', 'xyz', 10, 4), 'it::substr_replace outside of string');
-is(grapheme_strlen("\xc1"), null, "need grapheme_strlen side effect for any2utf8");
-
is(it::any2utf8('Meier'), 'Meier', "it::any2utf8 ascii input");
is(it::any2utf8('Müller'), 'Müller', "it::any2utf8 utf8 input");
is(it::any2utf8('Aslı'), 'Aslı', "it::any2utf8 utf8 non-latin1 input");
@@ -470,7 +468,6 @@ is(it::any2utf8([1, true, false, null]), [1, true, false, null], "any2utf8 shoul
is(it::any2utf8([it::utf8_decode('Müller') => it::utf8_decode('Müller')]), ['Müller' => 'Müller'], "it::any2utf8 latin1 keys");
is(it::any2utf8("\xc2\xad"), "", "it::any2utf8 remove soft hyphens");
-is(it::any2utf8("\u{0338}\u{0338}a\u{0338}b"), "a\u{0338}b", "it::any2utf8 remove combining characters at beginning");
foreach ([ 'a' => 'ä', 'e' => 'ë', 'i' => 'ï', 'o' => 'ö', 'u' => 'ü' ] as $src => $dst)
{
@@ -481,6 +478,7 @@ foreach ([ 'a' => 'ä', 'e' => 'ë', 'i' => 'ï', 'o' => 'ö', 'u' => 'ü' ] as
}
is(it::any2utf8("\x65\xcc\x81"), "é", "it::any2utf8 convert to normal form C");
+is(it::any2utf8("\u{0338}\u{0338}a\u{0338}b \u{0338}\u{0338}c"), "a\u{0338}b c", "it::any2utf8 remove combining chars at start and after blank");
foreach ([$dummy, false, true, null, 1, "a", "Ä", "/", []] as $var)
is(it::json_decode(it::json_encode($var)), $var);
diff --git a/test/it_url.t b/test/it_url.t
index b86f711..215cb63 100755
--- a/test/it_url.t
+++ b/test/it_url.t
@@ -77,60 +77,25 @@ is(
$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("/"),
- 'http://gna.ch/',
- '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'
-);
+is(it_url::absolute("/"), 'http://gna.ch/', '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');
+is(it_url::absolute("/https", "https"), 'https://gna.ch/https', 'it_url::absolute force https in http context');
+is(it_url::absolute("http://gna.ch/foo", "https"),'https://gna.ch/foo', 'it_url::absolute force https overwriting existing url');
list ($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT'], $_SERVER['HTTPS']) = ["gna.ch:42", 42, null];
-is(
- it_url::absolute("/port"),
- 'http://gna.ch:42/port',
- 'it_url::absolute with non-standard port'
-);
-
-list ($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT'], $_SERVER['HTTPS']) = ["gna.ch", 443, true];
-is(
- it_url::absolute("/https"),
- 'https://gna.ch/https',
- 'it_url::absolute for https'
-);
-
-list ($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT'], $_SERVER['HTTPS']) = ["gna.ch", null, null];
-is(
- it_url::absolute("/https", "https"),
- 'https://gna.ch/https',
- 'it_url::absolute force https in http context'
-);
+is(it_url::absolute("/port"), 'http://gna.ch:42/port', 'it_url::absolute with non-standard port');
list ($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT'], $_SERVER['HTTPS']) = ["gna.ch", 443, true];
-is(
- it_url::absolute("/foo", "http"),
- 'http://gna.ch/foo',
- 'it_url::absolute force http in https context'
-);
+is(it_url::absolute("/https"), 'https://gna.ch/https', 'it_url::absolute for https');
+is(it_url::absolute("http://gna.ch/"), 'http://gna.ch/', 'it_url::absolute leaves http: in url alone');
+is(it_url::absolute("/foo", "http"), 'http://gna.ch/foo', 'it_url::absolute force http in https context');
+is(it_url::absolute("http://gna.ch/", 'https'), 'https://gna.ch/', 'it_url::absolute overrides http: in url');
-list ($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT'], $_SERVER['HTTPS']) = ["gna.ch", null, null];
-is(
- it_url::absolute("http://gna.ch/foo", "https"),
- 'https://gna.ch/foo',
- 'it_url::absolute force https overwriting existing url'
-);
+list ($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT'], $_SERVER['HTTPS']) = [null, null, null];
$_SERVER['PHP_SELF'] = $php_self;
+
is(it_url::is_reachable('http://search.ch/'), true, "is_reachable('http://www.search.ch/')");
is(it_url::is_reachable('http://search.ch/not_found'), false, "is_reachable('http://www.search.ch/not_found')");
is(it_url::is_reachable('http://bogus.url'), false, "is_reachable('http://bogus.url')");