From 35fe33f7364329dacf415c950bff01b6de9ef88e Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 11 Oct 2007 00:39:30 +0000 Subject: Populated release branch --- tests/it_html.t | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 tests/it_html.t (limited to 'tests/it_html.t') diff --git a/tests/it_html.t b/tests/it_html.t new file mode 100755 index 0000000..cd934be --- /dev/null +++ b/tests/it_html.t @@ -0,0 +1,99 @@ +#!/www/server/bin/php -qC + "html")); + +is( + a(array('href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => ""), "bar"), + 'bar', + "tag with attributes" +); + +is( + div(), + "
\n", + "empty script tag" +); + +is( + img(array('src' => "foo.png")), + '', + "empty link tag" +); + +is( + tag('link'), + "\n", + "empty link tag" +); + +is( + tag('link', "foo"), + "foo\n", + "link tag with data" +); + +# XML generation +unset($GLOBALS['it_html']); +new it_html(array('htmltype' => "xhtml", 'tags' => "xmltest")); + +is( + xmltest(), + "\n", + "empty xmltest tag" +); + +is( + xmltest("foo"), + "foo\n", + "empty xmltest tag" +); + +is( + xmltest(array('href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => "")), + '' . "\n", + "xmltest tag with attributes" +); + +# Inheriting and extending it_html +class myhtml extends it_html +{ +function myimg($args) +{ + array_unshift($args, array('alt' => "ALT", 'bar' => "BAR")); + + return parent::img($args); +} +} + +unset($GLOBALS['it_html']); +new myhtml(array('htmltype' => "html")); + +is( + myimg(array('src' => "foo.gif", 'alt' => "foo")), + 'foo', + "it_html inheritance" +); + +is( + it_html::sanitize('

swisspics posted < < ä & yesterday a photo tag missmatch:



+ +

Wolken

+'), + ' swisspics posted < < ä & yesterday a photo tag missmatch:

', + 'it_html::sanitize tag soup' +); + +is( + U("/foo.html", array('bar' => array('gna' => 42, 'qux' => array('quux' => "", 'gnöp' => "fasel")))), + '/foo.html?bar[gna]=42&bar[qux][quux]=%3CZ%FCrich%3E&bar[qux][gn%F6p]=fasel', + 'U() with nested arrays' +); + + +?> -- cgit v1.2.3