diff options
Diffstat (limited to 'test/it_html.t')
-rwxr-xr-x | test/it_html.t | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/test/it_html.t b/test/it_html.t index f5daebd..a43f674 100755 --- a/test/it_html.t +++ b/test/it_html.t @@ -7,10 +7,10 @@ it::getopt(""); #handle possible --debug parameter # Traditional html5 generation ini_set('default_charset', "utf-8"); -new it_html(array('htmltype' => "html5", 'prettyprint' => false, 'error_on_redefine' => false)); +new it_html(['htmltype' => "html5", 'prettyprint' => false, 'error_on_redefine' => false]); is( - a(array('href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => ""), "bar"), + a(['href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => ""], "bar"), '<a href="&foo" true empty="">bar</a>', "tag with attributes" ); @@ -34,7 +34,7 @@ is( ); is( - img(array('src' => "foo.png", 'alt' => "ALT")), + img(['src' => "foo.png", 'alt' => "ALT"]), '<img src="foo.png" alt="ALT">', "img tag with attributes" ); @@ -52,50 +52,50 @@ is( ); is( - it::replace(array('\n+\s*' => ""), select(array('name' => "gna", 'multiple' => true), '1:foo,2:bar', '1,2')), + it::replace(['\n+\s*' => ""], select(['name' => "gna", 'multiple' => true], '1:foo,2:bar', '1,2')), '<select name="gna" multiple><option value="1" selected>foo</option><option value="2" selected>bar</option></select>', "select tag with multiselect" ); is( - it::replace(array('\n+\s*' => ""), select(array('name' => "gna"), array("1" => "foo", "2" => 'bar', '1,2' => "qux"), '1,2')), + it::replace(['\n+\s*' => ""], select(['name' => "gna"], ["1" => "foo", "2" => 'bar', '1,2' => "qux"], '1,2')), '<select name="gna"><option value="1">foo</option><option value="2">bar</option><option value="1,2" selected>qux</option></select>', "select tag without multiselect" ); is( - div(array('arg' => "val: \x03, \x0e, \x0f, \x0c, \xc2\x80, \xc2\x9f, \t, \n, \r", "\x02, \x0e, \x0f, \x0c, \xc2\x80, \xc2\x9f, \t, \n, \r")), + div(['arg' => "val: \x03, \x0e, \x0f, \x0c, \xc2\x80, \xc2\x9f, \t, \n, \r", "\x02, \x0e, \x0f, \x0c, \xc2\x80, \xc2\x9f, \t, \n, \r"]), "<div arg=\"val: , , , , , , 	, , \">\x02, \x0e, \x0f, \x0c, \xc2\x80, \xc2\x9f, \t, \n, \r</div>\n", "blank unprintable characters and illegal utf8 in attributes but not in normal text" ); is( - div(array("arg\x03\x0e\x0f\xc2\x80\xc2\x9fendarg" => "value", "content")), + div(["arg\x03\x0e\x0f\xc2\x80\xc2\x9fendarg" => "value", "content"]), "<div arg\x03\x0e\x0f\xc2\x80\xc2\x9fendarg=\"value\">content</div>\n", "don't blank unprintable characters and illegal utf8 in attribute names" ); is( - div(array('arg' => "abc äüö éá© œàè îôÇ xyz", "abc äüö éá© œàè îôÇ xyz")), + div(['arg' => "abc äüö éá© œàè îôÇ xyz", "abc äüö éá© œàè îôÇ xyz"]), "<div arg=\"abc äüö éá© œàè îôÇ xyz\">abc äüö éá© œàè îôÇ xyz</div>\n", "leave legal utf8 intact" ); unset($GLOBALS['debug_utf8check']); is( - div(array('arg' => "value \xc2", "content")), + div(['arg' => "value \xc2", "content"]), "<div arg=\"value \xc2\">content</div>\n", "handle single \\xc2 at end of attribute value" ); is( - div(array("arg\x00end" => "value \x00 end", "content \x00 content end")), + div(["arg\x00end" => "value \x00 end", "content \x00 content end"]), "<div arg\x00end=\"value end\">content \x00 content end</div>\n", "handle 0-bytes" ); is( - div(array('arg' => "& \" < > \n '", "& \" < > \n '")), + div(['arg' => "& \" < > \n '", "& \" < > \n '"]), "<div arg=\"& " < > '\">& \" < > \n '</div>\n", "use html entities in attributes but not in normal text" ); @@ -107,16 +107,16 @@ is( ); # Test different html types -foreach (array('html5' => "<br flag>", 'html' => "<br flag>", 'xhtml' => "<br flag=\"flag\" />", 'xhtml-mobile' => "<br flag=\"flag\" />") as $type => $value) +foreach (['html5' => "<br flag>", 'html' => "<br flag>", 'xhtml' => "<br flag=\"flag\" />", 'xhtml-mobile' => "<br flag=\"flag\" />"] as $type => $value) { unset($GLOBALS['it_html']); - new it_html(array('htmltype' => $type, 'error_on_redefine' => false)); - is (trim(br(array('flag' => true))), $value, "Check empty tag and attribute for $type"); + new it_html(['htmltype' => $type, 'error_on_redefine' => false]); + is (trim(br(['flag' => true])), $value, "Check empty tag and attribute for $type"); } # XHTML generation unset($GLOBALS['it_html']); -new it_html(array('htmltype' => "xhtml", 'tags' => "script", 'error_on_redefine' => false)); +new it_html(['htmltype' => "xhtml", 'tags' => "script", 'error_on_redefine' => false]); is( script(), @@ -139,7 +139,7 @@ is( # XML generation unset($GLOBALS['it_html']); -new it_html(array('htmltype' => "xml", 'name' => 'it_html', 'tags' => "xmltest", 'error_on_redefine' => false)); +new it_html(['htmltype' => "xml", 'name' => 'it_html', 'tags' => "xmltest", 'error_on_redefine' => false]); is( xmltest(), @@ -154,7 +154,7 @@ is( ); is( - xmltest(array('href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => "")), + xmltest(['href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => ""]), '<xmltest href="&foo" true="true" empty="" />' . "\n", "xmltest tag with attributes" ); @@ -175,14 +175,14 @@ is( class myhtml extends it_html { -function __construct($p = array()) +function __construct($p = []) { parent::__construct($p + ['moretags' => 'overriddentag,defaulttag', 'nonewlinetags' => 'a,b,defaulttag,em,img,input,overriddentag,span,div']); } function myimg($args) { - array_unshift($args, array('alt' => "ALT", 'bar' => "BAR")); + array_unshift($args, ['alt' => "ALT", 'bar' => "BAR"]); return parent::img(array_filter(it_parse_args($args))); } @@ -194,7 +194,7 @@ function overriddentag($args) } unset($GLOBALS['it_html']); -new myhtml(array('htmltype' => "html", 'error_on_redefine' => false)); +new myhtml(['htmltype' => "html", 'error_on_redefine' => false]); is( myimg(['src' => "foo.gif", 'alt' => "foo"]), @@ -203,7 +203,7 @@ is( ); is( - div(array('attr' => 'value'), 'content'), + div(['attr' => 'value'], 'content'), '<div attr="value">content</div>', "different nonewlinetags respected" ); @@ -264,14 +264,14 @@ is(it_html::entity_decode("A"), "A"); # tests for itools extension is(table(null), "<table></table>\n", "table() null argument"); -list($data, $attr) = it_parse_args(array(null)); +list($data, $attr) = it_parse_args([null]); ok($data === "", "it_parse_args compatiblity: treat null like empty string"); # # check transliterations in iso-8859-1 # -it_html::configure(array('charset' => "iso-8859-1")); +it_html::configure(['charset' => "iso-8859-1"]); ini_set('default_charset', "iso-8859-1"); is( |