summaryrefslogtreecommitdiff
path: root/tests/it_html.t
diff options
context:
space:
mode:
authorChristian Schneider2007-02-08 14:51:25 +0000
committerChristian Schneider2007-02-08 14:51:25 +0000
commit6943a9f3bc10a60fcc01f126dfbd22b24b9c99cb (patch)
tree7115430bdc88c9a05788b560cf0d58d62807d8f3 /tests/it_html.t
parente49941bbff3f9d7e87e26265b9971c788b861628 (diff)
downloaditools-6943a9f3bc10a60fcc01f126dfbd22b24b9c99cb.tar.gz
itools-6943a9f3bc10a60fcc01f126dfbd22b24b9c99cb.tar.bz2
itools-6943a9f3bc10a60fcc01f126dfbd22b24b9c99cb.zip
Moved ITools tests from searchlib to itools/live
Diffstat (limited to 'tests/it_html.t')
-rwxr-xr-xtests/it_html.t86
1 files changed, 86 insertions, 0 deletions
diff --git a/tests/it_html.t b/tests/it_html.t
new file mode 100755
index 0000000..95d615c
--- /dev/null
+++ b/tests/it_html.t
@@ -0,0 +1,86 @@
+#!/www/server/bin/php -qC
+<?php
+#
+# $Id$
+#
+# some tests for itools/html.class
+
+require 'searchlib/search_test.class';
+
+# Traditional html generation
+new it_html('htmltype' => "html");
+
+is(
+ a('href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => "", "bar"),
+ '<a href="&amp;foo" true empty="">bar</a>',
+ "tag with attributes"
+);
+
+is(
+ div(),
+ "<div></div>\n",
+ "empty script tag"
+);
+
+is(
+ img('src' => "foo.png"),
+ '<img src="foo.png">',
+ "empty link tag"
+);
+
+is(
+ tag('link'),
+ "<link>\n",
+ "empty link tag"
+);
+
+is(
+ tag('link', "foo"),
+ "<link>foo</link>\n",
+ "link tag with data"
+);
+
+# XML generation
+unset($GLOBALS['it_html']);
+new it_html('htmltype' => "xhtml", 'tags' => "xmltest");
+
+is(
+ xmltest(),
+ "<xmltest />\n",
+ "empty xmltest tag"
+);
+
+is(
+ xmltest("foo"),
+ "<xmltest>foo</xmltest>\n",
+ "empty xmltest tag"
+);
+
+is(
+ xmltest('href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => ""),
+ '<xmltest href="&amp;foo" true="true" empty="" />' . "\n",
+ "xmltest tag with attributes"
+);
+
+# Inheriting and extending it_html
+class myhtml extends it_html
+{
+function myimg($args)
+{
+ array_unshift($args, 'alt' => "ALT", 'bar' => "BAR");
+
+ return parent::img($args);
+}
+}
+
+unset($GLOBALS['it_html']);
+new myhtml('htmltype' => "html");
+
+is(
+ myimg('src' => "foo.gif", 'alt' => "foo"),
+ '<img alt="foo" bar="BAR" src="foo.gif">',
+ "it_html inheritance"
+);
+
+
+?>