diff options
author | Christian Schneider | 2007-02-09 13:26:17 +0000 |
---|---|---|
committer | Christian Schneider | 2007-02-09 13:26:17 +0000 |
commit | bbc8b31566fcae832081f1d890dfa6fd5c5c842a (patch) | |
tree | c9df6eaf5a193b4a9d622356c189567b4652f37c /tests/html.t | |
parent | 0b9f19b72396d8bd399f4d7353f2fdb445bc55f3 (diff) | |
download | itools-bbc8b31566fcae832081f1d890dfa6fd5c5c842a.tar.gz itools-bbc8b31566fcae832081f1d890dfa6fd5c5c842a.tar.bz2 itools-bbc8b31566fcae832081f1d890dfa6fd5c5c842a.zip |
Renamed tests to match file names of class tested
Diffstat (limited to 'tests/html.t')
-rwxr-xr-x | tests/html.t | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/tests/html.t b/tests/html.t new file mode 100755 index 0000000..95d615c --- /dev/null +++ b/tests/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="&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="&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" +); + + +?> |