From bbc8b31566fcae832081f1d890dfa6fd5c5c842a Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Fri, 9 Feb 2007 13:26:17 +0000 Subject: Renamed tests to match file names of class tested --- tests/html.t | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/it_html.t | 86 --------------------------------------------------------- tests/it_xml.t | 66 ------------------------------------------- tests/xml.t | 66 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 152 insertions(+), 152 deletions(-) create mode 100755 tests/html.t delete mode 100755 tests/it_html.t delete mode 100755 tests/it_xml.t create mode 100755 tests/xml.t (limited to 'tests') 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 + "html"); + +is( + a('href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => "", "bar"), + 'bar', + "tag with attributes" +); + +is( + div(), + "
\n", + "empty script tag" +); + +is( + img('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('htmltype' => "xhtml", 'tags' => "xmltest"); + +is( + xmltest(), + "\n", + "empty xmltest tag" +); + +is( + xmltest("foo"), + "foo\n", + "empty xmltest tag" +); + +is( + xmltest('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, 'alt' => "ALT", 'bar' => "BAR"); + + return parent::img($args); +} +} + +unset($GLOBALS['it_html']); +new myhtml('htmltype' => "html"); + +is( + myimg('src' => "foo.gif", 'alt' => "foo"), + 'foo', + "it_html inheritance" +); + + +?> diff --git a/tests/it_html.t b/tests/it_html.t deleted file mode 100755 index 95d615c..0000000 --- a/tests/it_html.t +++ /dev/null @@ -1,86 +0,0 @@ -#!/www/server/bin/php -qC - "html"); - -is( - a('href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => "", "bar"), - 'bar', - "tag with attributes" -); - -is( - div(), - "
\n", - "empty script tag" -); - -is( - img('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('htmltype' => "xhtml", 'tags' => "xmltest"); - -is( - xmltest(), - "\n", - "empty xmltest tag" -); - -is( - xmltest("foo"), - "foo\n", - "empty xmltest tag" -); - -is( - xmltest('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, 'alt' => "ALT", 'bar' => "BAR"); - - return parent::img($args); -} -} - -unset($GLOBALS['it_html']); -new myhtml('htmltype' => "html"); - -is( - myimg('src' => "foo.gif", 'alt' => "foo"), - 'foo', - "it_html inheritance" -); - - -?> diff --git a/tests/it_xml.t b/tests/it_xml.t deleted file mode 100755 index 85f16c8..0000000 --- a/tests/it_xml.t +++ /dev/null @@ -1,66 +0,0 @@ -#!/www/server/bin/php -qC -$xmldata"); - - is( - preg_replace('/[#\s]+/', " ", search_test::dump($xml->$varname)), - $expected, - $name, - ); -} - -match( - '', - 'class foo { }', - 'empty tag' -); - -#match( -# '', -# 'array ( 0 => class foo { }, 1 => class foo { }, )', -# 'multiple empty tags converted to array' -#); - -match( - 'Stüssihofstadt', - 'class foo { var $attr = array( \'title\' => \'Zürich\' ); var $val = \'Stüssihofstadt\'; }', - 'simple tag with latin1 content and attribute' -); - -# Test inheritance -class my_xml extends it_xml -{ - -function my_xml($xmldata) -{ - parent::it_xml($xmldata); - - # Code which should be executed in root and only there - $this->qux = new it_xml; - $this->qux->val = "qux"; - - if (is_object($this->myfoo)) - $this->myfoo->inheritbaseclass = is_a($this->myfoo, "my_xml"); -} - -} - -match( - '', - 'class myfoo { var $inheritbaseclass = false; }', - 'Inheritance and constructor (critical for e.g. tel_xmlentry)', - 'my' -); - -?> diff --git a/tests/xml.t b/tests/xml.t new file mode 100755 index 0000000..85f16c8 --- /dev/null +++ b/tests/xml.t @@ -0,0 +1,66 @@ +#!/www/server/bin/php -qC +$xmldata"); + + is( + preg_replace('/[#\s]+/', " ", search_test::dump($xml->$varname)), + $expected, + $name, + ); +} + +match( + '', + 'class foo { }', + 'empty tag' +); + +#match( +# '', +# 'array ( 0 => class foo { }, 1 => class foo { }, )', +# 'multiple empty tags converted to array' +#); + +match( + 'Stüssihofstadt', + 'class foo { var $attr = array( \'title\' => \'Zürich\' ); var $val = \'Stüssihofstadt\'; }', + 'simple tag with latin1 content and attribute' +); + +# Test inheritance +class my_xml extends it_xml +{ + +function my_xml($xmldata) +{ + parent::it_xml($xmldata); + + # Code which should be executed in root and only there + $this->qux = new it_xml; + $this->qux->val = "qux"; + + if (is_object($this->myfoo)) + $this->myfoo->inheritbaseclass = is_a($this->myfoo, "my_xml"); +} + +} + +match( + '', + 'class myfoo { var $inheritbaseclass = false; }', + 'Inheritance and constructor (critical for e.g. tel_xmlentry)', + 'my' +); + +?> -- cgit v1.2.3