diff options
author | Christian Schneider | 2009-10-15 14:06:12 +0000 |
---|---|---|
committer | Christian Schneider | 2009-10-15 14:06:12 +0000 |
commit | 368c2840b8734299250114edee85c8ce74a38091 (patch) | |
tree | 6742698b17edc162521eb6682eb0057bb7139858 /tests/it_xml.t | |
parent | e5cdf7d2c93bb956e57f27e9f7e146f7f3c4e9d7 (diff) | |
download | itools-368c2840b8734299250114edee85c8ce74a38091.tar.gz itools-368c2840b8734299250114edee85c8ce74a38091.tar.bz2 itools-368c2840b8734299250114edee85c8ce74a38091.zip |
Make string and file read mode of it_xml equivalent again, added tests for file mode
Diffstat (limited to 'tests/it_xml.t')
-rwxr-xr-x | tests/it_xml.t | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/it_xml.t b/tests/it_xml.t index 8c2c084..7e3a3cf 100755 --- a/tests/it_xml.t +++ b/tests/it_xml.t @@ -7,13 +7,28 @@ function match($xmldata, $expected, $name, $prefix = "", $p = array()) { $classname = $prefix ? ($prefix . "_xml") : "it_xml"; $varname = $prefix . "foo"; - $xml = new $classname("<root>$xmldata</root>", $p); + $xmldata = "<root>$xmldata</root>"; + $xml = new $classname($xmldata, $p); is( preg_replace('/[#\s]+/', " ", print_r($xml->$varname, true)), $expected, - $name + "$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( |