diff options
Diffstat (limited to 'test')
| -rwxr-xr-x | test/it_cache.t | 18 | ||||
| -rwxr-xr-x | test/it_dbi.t | 4 | ||||
| -rwxr-xr-x | test/it_dbi_postgres.t | 7 | ||||
| -rwxr-xr-x | test/it_html.t | 17 | ||||
| -rw-r--r-- | test/it_url.testserver.php | 4 | ||||
| -rwxr-xr-x | test/it_url_slow.t | 7 |
6 files changed, 45 insertions, 12 deletions
diff --git a/test/it_cache.t b/test/it_cache.t index e2e94bf..3e2fb0d 100755 --- a/test/it_cache.t +++ b/test/it_cache.t @@ -14,15 +14,15 @@ is(it_cache::get('it_cache_t'), [2], "cache put/get array"); # test non-distributed apc cache it_cache::put('it_cache_t', 42); -unset($GLOBALS['it_cache_local']); +it_cache::$_local = []; is(it_cache::get('it_cache_t'), 42, "local put/get number"); it_cache::put('it_cache_t', false); -unset($GLOBALS['it_cache_local']); +it_cache::$_local = []; is(it_cache::get('it_cache_t'), false, "local put/get false"); it_cache::put('it_cache_t', [2]); -unset($GLOBALS['it_cache_local']); +it_cache::$_local = []; is(it_cache::get('it_cache_t'), [2], "local put/get array"); is(it_cache::get('it_cache_t'.rand(1, 1000)), null, "local get unknown key"); @@ -32,18 +32,18 @@ is(it_cache::get('it_cache_t'.rand(1, 1000)), null, "local get unknown key"); $GLOBALS['debug_aslive'] = 1; it_cache::put('it_cache_d', 42, ['distributed' => 1]); -it_cache::put('it_cache_d', 0); -unset($GLOBALS['it_cache_local']); +it_cache::put('it_cache_d', 1); +it_cache::$_local = []; is(intval(it_cache::get('it_cache_d', ['distributed' => 1])), 42, "distributed put/get number"); it_cache::put('it_cache_d', false, ['distributed' => 1]); -it_cache::put('it_cache_d', 1); -unset($GLOBALS['it_cache_local']); +it_cache::put('it_cache_d', 2); +it_cache::$_local = []; is(boolval(it_cache::get('it_cache_d', ['distributed' => 1])), false, "distributed put/get false"); it_cache::put('it_cache_d', [2], ['distributed' => 1]); -it_cache::put('it_cache_d', 0); -unset($GLOBALS['it_cache_local']); +it_cache::put('it_cache_d', 3); +it_cache::$_local = []; is(it_cache::get('it_cache_d', ['distributed' => 1]), [2], "distributed put/get array"); is(it_cache::get('it_cache_d'.rand(1, 1000), ['distributed' => 1]), null, "distributed get unknown key"); diff --git a/test/it_dbi.t b/test/it_dbi.t index b453da2..1140c55 100755 --- a/test/it_dbi.t +++ b/test/it_dbi.t @@ -38,7 +38,7 @@ $opts['subclass']::createclass(['table' => "it_dbi_test", 'forcecreate' => true] $record = new it_dbi_test; $GLOBALS['it_defaultconfig']['fatal_throws_exception'] = true; -is($record->query("SYNTAX ERROR", ['safety' => 0]), false, "Suppress failures with safety 0"); +is(@$record->query("SYNTAX ERROR", ['safety' => 0]), false, "Suppress failures with safety 0"); try { is(@$record->select("SYNTAX ERROR"), "Exception", "Syntax triggers exception for fatal_throws_exception mode"); } catch (Exception $e) { @@ -439,6 +439,8 @@ $r->iterate(); is($r->_dyndata, [], '_dyndata for record with empty dyncols should be empty'); $r->update(['key3' => 'c']); is($r->key3, 'c', 'dynamic column for record with empty dyncols whould be correctly created'); +$r->update(['key3' => null], ['ID' => 3]); +is($r->key3, null, 'remove dynamic column completely if where-clause is given'); $r->clear(false); is($r->select(['-key1 IS NOT' => 'NULL']), 1, 'only one entry has a value for key1'); diff --git a/test/it_dbi_postgres.t b/test/it_dbi_postgres.t index a272215..5057d45 100755 --- a/test/it_dbi_postgres.t +++ b/test/it_dbi_postgres.t @@ -1,2 +1,7 @@ #!/bin/sh -systemctl check -q postgresql.service && `dirname $0`/it_dbi.t --subclass it_dbi_postgres --db map_search_ch
\ No newline at end of file + +if systemctl check -q postgresql.service || ! servertype live; then + `dirname $0`/it_dbi.t --subclass it_dbi_postgres --db map_search_ch +else + echo ok 1 - Skipping tests on live because postgresql is not running +fi diff --git a/test/it_html.t b/test/it_html.t index 15f444d..90af4b6 100755 --- a/test/it_html.t +++ b/test/it_html.t @@ -81,6 +81,8 @@ is( "leave legal utf8 intact" ); +is(js(['async' => true], 'foo'), "<script async>foo</script>\n", 'boolean attribute for js script tag'); + unset($GLOBALS['debug_utf8check']); is( div(['arg' => "value \xc2", "content"]), @@ -136,10 +138,11 @@ is( "xhtml doctype" ); +is(js('foo'), "<script type=\"text/javascript\"><!--//--><![CDATA[//><!--\nfoo\n//--><!]]></script>\n", "escape js script content with CDATA in xml mode"); # XML generation unset($GLOBALS['it_html']); -new it_html(['htmltype' => "xml", 'name' => 'it_html', 'tags' => "xmltest", 'error_on_redefine' => false]); +new it_html(['htmltype' => "xml", 'name' => 'it_html', 'moretags' => "xmltest", 'error_on_redefine' => false]); is( xmltest(), @@ -260,6 +263,18 @@ is( ); is( + it_html::sanitize('<a href="http://search.ch/"><strong>foo</strong></a>'), + '<a href="http://search.ch/"><strong>foo</strong></a>', + 'it_html::sanitize handle nesting of tags inside <a>' +); + +is( + it_html::sanitize('<a href="mailto:neuman@example.com">foo</a>'), + '<a href="mailto:neuman@example.com">foo</a>', + 'it_html::sanitize handle mailto links' +); + +is( it_html::sanitize("<a href='http://search.ch/'>foo</a>"), '<a href="http://search.ch/">foo</a>', 'TODO it_html::sanitize handle anchors with single quotes at attribute value' diff --git a/test/it_url.testserver.php b/test/it_url.testserver.php index ca5300c..e59a81a 100644 --- a/test/it_url.testserver.php +++ b/test/it_url.testserver.php @@ -66,8 +66,12 @@ switch ($_SERVER['PHP_SELF']) break; case "/repeat": + if ($_REQUEST['compressed']) + ob_start('ob_gzhandler'); for ($i = 0; $i < $_REQUEST['num']; $i++) echo $_REQUEST['string']; + if ($_REQUEST['compressed']) + ob_end_flush(); break; case "/empty": diff --git a/test/it_url_slow.t b/test/it_url_slow.t index 00bbc2f..a5fd348 100755 --- a/test/it_url_slow.t +++ b/test/it_url_slow.t @@ -69,6 +69,13 @@ if (!$res || !$res2) handle_server( ok( + !it_url::get(['url' => "http://$host/repeat?string=abcdefghijklmnop&num=10&compressed", 'maxlength' => 100, 'retries' => 0, 'it_error' => false]), + 'it_url::get() fails for response larger than maxlength even if compressed response is smaller' + ) +); + +handle_server( + ok( it_url::get(U("http://$host/repeat", ['string' => "abc", 'num' => 1024 * 1024])) == str_repeat("abc", 1024 * 1024), 'it_url::get() handles large response' ) |