From 368c2840b8734299250114edee85c8ce74a38091 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 15 Oct 2009 14:06:12 +0000 Subject: Make string and file read mode of it_xml equivalent again, added tests for file mode --- tests/it_xml.t | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'tests') 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("$xmldata", $p); + $xmldata = "$xmldata"; + $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( -- cgit v1.2.3