From 601aef346863bbecee7ca468a8418d05d99d6d13 Mon Sep 17 00:00:00 2001
From: Fabien Villepinte <fabien.villepinte@gmail.com>
Date: Sat, 26 Oct 2019 16:05:02 +0200
Subject: [PATCH] Replace EXPECTF by EXPECT

In ext/dom all the tests with a EXPECTF section
starting by "Fatal error: Uncaught" have been updated
to use the faster EXPECT
---
 .../DOMCharacterData_deleteData_error_002.phpt    | 14 +++++++-------
 .../DOMDocumentFragment_appendXML_error_002.phpt  | 15 +++++++--------
 .../tests/DOMDocument_saveHTMLFile_error2.phpt    | 13 +++++++------
 ext/dom/tests/DOMDocument_saveHTML_error2.phpt    | 13 +++++++------
 ext/dom/tests/DOMDocument_validate_error2.phpt    | 13 +++++++------
 ext/dom/tests/regsiter_node_class.phpt            | 14 +++++++-------
 6 files changed, 42 insertions(+), 40 deletions(-)

diff --git a/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt b/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
index 2faa02eb58..a4c6fbc73e 100644
--- a/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
+++ b/ext/dom/tests/DOMCharacterData_deleteData_error_002.phpt
@@ -13,11 +13,11 @@ $document->appendChild($root);
 
 $cdata = $document->createCDATASection('test');
 $root->appendChild($cdata);
-$cdata->deleteData(5, 1);
+try {
+    $cdata->deleteData(5, 1);
+} catch (DOMException $e) {
+    echo $e->getMessage();
+}
 ?>
---EXPECTF--
-Fatal error: Uncaught DOMException: Index Size Error in %s:%d
-Stack trace:
-#0 %s(%d): DOMCharacterData->deleteData(5, 1)
-#1 {main}
-  thrown in %s on line %d
+--EXPECT--
+Index Size Error
diff --git a/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt b/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt
index b6ce9dcb65..4e7e28f298 100644
--- a/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt
+++ b/ext/dom/tests/DOMDocumentFragment_appendXML_error_002.phpt
@@ -8,12 +8,11 @@ Eric Lee Stewart <ericleestewart@gmail.com>
 --FILE--
 <?php
 $fragment = new DOMDocumentFragment();
-$fragment->appendXML('<bait>crankbait</bait>');
-$document->appendChild($fragment);
+try {
+    $fragment->appendXML('<bait>crankbait</bait>');
+} catch (DOMException $e) {
+    echo $e->getMessage();
+}
 ?>
---EXPECTF--
-Fatal error: Uncaught DOMException: No Modification Allowed Error in %s:%d
-Stack trace:
-#0 %s(%d): DOMDocumentFragment->appendXML('<bait>crankbait...')
-#1 {main}
-  thrown in %s on line %d
+--EXPECT--
+No Modification Allowed Error
diff --git a/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt b/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
index aa25bb16e7..6cacaded4c 100644
--- a/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTMLFile_error2.phpt
@@ -9,10 +9,11 @@ require_once __DIR__ .'/skipif.inc';
 ?>
 --FILE--
 <?php
-DOMDocument::saveHTMLFile();
+try {
+    DOMDocument::saveHTMLFile();
+} catch (Error $e) {
+    echo $e->getMessage();
+}
 ?>
---EXPECTF--
-Fatal error: Uncaught Error: Non-static method DOMDocument::saveHTMLFile() cannot be called statically in %s:%d
-Stack trace:
-#0 {main}
-  thrown in %s on line %d
+--EXPECT--
+Non-static method DOMDocument::saveHTMLFile() cannot be called statically
diff --git a/ext/dom/tests/DOMDocument_saveHTML_error2.phpt b/ext/dom/tests/DOMDocument_saveHTML_error2.phpt
index 83aefd5ba8..8f686e9605 100644
--- a/ext/dom/tests/DOMDocument_saveHTML_error2.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTML_error2.phpt
@@ -9,10 +9,11 @@ require_once __DIR__ .'/skipif.inc';
 ?>
 --FILE--
 <?php
-DOMDocument::saveHTML(true);
+try {
+    DOMDocument::saveHTML(true);
+} catch (Error $e) {
+    echo $e->getMessage();
+}
 ?>
---EXPECTF--
-Fatal error: Uncaught Error: Non-static method DOMDocument::saveHTML() cannot be called statically in %s:%d
-Stack trace:
-#0 {main}
-  thrown in %s on line %d
+--EXPECT--
+Non-static method DOMDocument::saveHTML() cannot be called statically
diff --git a/ext/dom/tests/DOMDocument_validate_error2.phpt b/ext/dom/tests/DOMDocument_validate_error2.phpt
index c6d03bf02d..36d28bcbac 100644
--- a/ext/dom/tests/DOMDocument_validate_error2.phpt
+++ b/ext/dom/tests/DOMDocument_validate_error2.phpt
@@ -9,10 +9,11 @@ require_once __DIR__ .'/skipif.inc';
 ?>
 --FILE--
 <?php
-DOMDocument::validate();
+try {
+    DOMDocument::validate();
+} catch (Error $e) {
+    echo $e->getMessage();
+}
 ?>
---EXPECTF--
-Fatal error: Uncaught Error: Non-static method DOMDocument::validate() cannot be called statically in %s:%d
-Stack trace:
-#0 {main}
-  thrown in %s on line %d
+--EXPECT--
+Non-static method DOMDocument::validate() cannot be called statically
diff --git a/ext/dom/tests/regsiter_node_class.phpt b/ext/dom/tests/regsiter_node_class.phpt
index 1511a1e507..09b01aeea4 100644
--- a/ext/dom/tests/regsiter_node_class.phpt
+++ b/ext/dom/tests/regsiter_node_class.phpt
@@ -27,16 +27,16 @@ unset($attr);
 $doc->registerNodeClass('DOMAttr', NULL);
 $attr = $root->getAttributeNode('a');
 echo get_class($attr), "\n";
-print $attr->testit()."\n";
+try {
+    print $attr->testit()."\n";
+} catch (Error $e) {
+    echo $e->getMessage();
+}
 ?>
---EXPECTF--
+--EXPECT--
 myElement
 HELLO Element
 myAttribute
 HELLO Attribute
 DOMAttr
-
-Fatal error: Uncaught Error: Call to undefined method DOMAttr::testit() in %s:25
-Stack trace:
-#0 {main}
-  thrown in %s on line 25
+Call to undefined method DOMAttr::testit()
-- 
2.40.0