diff options
Diffstat (limited to 'tests')
-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( |