summaryrefslogtreecommitdiff
path: root/devel-utf8/tests/it_xml.t
diff options
context:
space:
mode:
authorNathan Gass2012-03-22 18:23:53 +0000
committerNathan Gass2012-03-22 18:23:53 +0000
commit338cda9000356404cf2865d61787607acf67fe98 (patch)
tree3924b3e2e12a5d5ea3b40890477d5e070498543c /devel-utf8/tests/it_xml.t
parente0a89b408041d25b18090bfc3d596627ea930507 (diff)
downloaditools-338cda9000356404cf2865d61787607acf67fe98.tar.gz
itools-338cda9000356404cf2865d61787607acf67fe98.tar.bz2
itools-338cda9000356404cf2865d61787607acf67fe98.zip
last remains of wrong branch itools/live/devel-utf8 removed
Diffstat (limited to 'devel-utf8/tests/it_xml.t')
-rwxr-xr-xdevel-utf8/tests/it_xml.t120
1 files changed, 0 insertions, 120 deletions
diff --git a/devel-utf8/tests/it_xml.t b/devel-utf8/tests/it_xml.t
deleted file mode 100755
index f74c54b..0000000
--- a/devel-utf8/tests/it_xml.t
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/www/server/bin/php -qC
-<?php
-
-# Tests for xml.class
-
-function match($xmldata, $expected, $name, $prefix = "", $p = array())
-{
- $classname = $prefix ? ($prefix . "_xml") : "it_xml";
- $varname = $prefix . "foo";
- $xmldata = "<root>$xmldata</root>";
- $xml = new $classname($xmldata, $p);
-
- is(
- preg_replace('/[#\s]+/', " ", print_r($xml->$varname, true)),
- $expected,
- "$name (string)"
- );
-
- $tmpfile = tmpfile();
- fwrite($tmpfile, $xmldata);
- rewind($tmpfile);
-
- $xml = new $classname($tmpfile, $p);
- fclose($tmpfile);
-
- is(
- preg_replace('/[#\s]+/', " ", print_r($xml->$varname, true)),
- $expected,
- "$name (file)"
- );
-
-}
-
-match(
- '<foo />',
- 'foo Object ( ) ',
- 'empty tag'
-);
-
-match(
- '<foo /><foo />',
- 'Array ( [0] => foo Object ( ) [1] => foo Object ( ) ) ',
- 'multiple empty tags converted to array'
-);
-
-match(
- '<foo title="Zürich">Stüssihofstadt</foo>',
- 'foo Object ( [attr] => Array ( [title] => Zürich ) [val] => Stüssihofstadt ) ',
- 'simple tag with latin1 content and attribute'
-);
-
-match(
- '<foo><ns:a.b.-c ns2:d.e-f="value" /></foo>',
- 'foo Object ( [a_b__c] => a_b__c Object ( [attr] => Array ( [d_e_f] => value ) ) ) ',
- 'Tags and attributes with name space and special characters'
-);
-
-match(
- '<foo>x &amp; y</foo>',
- 'foo Object ( [val] => x & y ) ',
- 'Character data with entities'
-);
-
-match(
- '<foo>&amp;amp; &lt;a&gt; &#38;amp; &#60;b&#62; &#x26;amp; &#x3C;c&#x3E; &uuml;</foo>',
- 'foo Object ( [val] => &amp; <a> &amp; <b> &amp; <c> ü ) ',
- 'Predecode illegal entities while keeping properly encoded ones'
-);
-
-match(
- '<foo>&amp;amp; &lt;a&gt; &#38;amp; &#60;b&#62; &#x26;amp; &#x3C;c&#x3E; &uuml;</foo>',
- utf8_encode('foo Object ( [val] => &amp; <a> &amp; <b> &amp; <c> ü ) '),
- 'Predecode illegal entities while keeping properly encoded ones (UTF-8)',
- "",
- array('encoding' => "UTF-8")
-);
-
-
-match(
- "<foo>a\x05b</foo>",
- 'foo Object ( [val] => a b ) ',
- 'Illegal latin 1 character',
- "",
- array('encoding' => "ISO-8859-1")
-);
-
-# 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(
- '<myfoo />',
- 'myfoo Object ( [inheritbaseclass] => ) ',
- 'Inheritance and constructor (critical for e.g. tel_xmlentry)',
- 'my'
-);
-
-$x = new foo("<foo></foo>", array('prefix' => "test"));
-$x->set(array('gna' => 42, 'bar' => array('baz' => array("qux", "quux"))));
-match(
- $x->to_xml(),
- 'foo Object ( [gna] => gna Object ( [val] => 42 ) [bar] => bar Object ( [baz] => Array ( [0] => baz Object ( [val] => qux ) [1] => baz Object ( [val] => quux ) ) ) ) ',
- "Method set()"
-);
-
-?>