From c1401ad7b6948248ce8c9a33f1acbc706baae923 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Sun, 31 May 2015 21:35:21 +0200 Subject: split simplexml tests for 7 --- ext/simplexml/tests/SimpleXMLElement_xpath.phpt | 22 ++++++++++------------ ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt | 21 +++++++++++++++++++++ ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt | 22 ++++++++++++++++++++++ 3 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt create mode 100644 ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt (limited to 'ext/simplexml') diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath.phpt index 7926ceb6e1..fb7e6e90f0 100644 --- a/ext/simplexml/tests/SimpleXMLElement_xpath.phpt +++ b/ext/simplexml/tests/SimpleXMLElement_xpath.phpt @@ -1,17 +1,15 @@ --TEST-- Testing xpath() with invalid XML ---SKIPIF-- -xpath("BBBB")); ---EXPECTF-- -Notice: Undefined variable: x in %s on line %d - -Warning: simplexml_load_string() expects parameter 3 to be integer, float given in %s on line %d +// gracefully recover from parsing of invalid XML; not available in PHP +const XML_PARSE_RECOVER = 1; -Fatal error: Uncaught EngineException: Call to a member function xpath() on null in %s:%d -Stack trace: -#0 {main} - thrown in %s on line %d +// we're not interested in checking concrete warnings regarding invalid XML +$xml = @simplexml_load_string("XXXXXXX^", 'SimpleXMLElement', XML_PARSE_RECOVER); + +// $xml is supposed to hold a SimpleXMLElement, but not FALSE/NULL +var_dump($xml->xpath("BBBB")); +?> +--EXPECT-- +bool(false) diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt new file mode 100644 index 0000000000..e2997f19d1 --- /dev/null +++ b/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt @@ -0,0 +1,21 @@ +--TEST-- +Testing xpath() with invalid XML +--SKIPIF-- + +--FILE-- +xpath("BBBB")); +?> +--EXPECTF-- +Notice: Undefined variable: x in %s on line %d + +Warning: simplexml_load_string() expects parameter 3 to be integer, float given in %s on line %d + +Fatal error: Uncaught EngineException: Call to a member function xpath() on null in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt new file mode 100644 index 0000000000..d4d709753f --- /dev/null +++ b/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt @@ -0,0 +1,22 @@ +--TEST-- +Testing xpath() with invalid XML +--SKIPIF-- + +--FILE-- +xpath("BBBB")); +?> +--EXPECTF-- +Notice: Undefined variable: x in %s on line %d + +Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in %s on line %d + +Warning: simplexml_load_string(): XXXXXXX^ in %s on line %d + +Warning: simplexml_load_string(): ^ in %s on line %d +bool(false) + -- cgit v1.2.1