com php-src: Add test for invalid SoapFault parameters: ext/soap/tests/fault_warning.phpt
| From: | Nikita Popov | Date: | Tue, 05 Sep 2017 15:36:01 +0000 |
| Subject: | com php-src: Add test for invalid SoapFault parameters: ext/soap/tests/fault_warning.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-99273@lists.php.net to get a copy of this message | ||
Commit: 056df0dcb22a7654beb969765db3264eed37dc90
Author: Ken Guest <kguest@php.net> Tue, 5 Sep 2017 17:36:01 +0200
Committer: Nikita Popov <nikita.ppv@gmail.com> Tue, 5 Sep 2017 17:36:01 +0200
Parents: a8862d215c57c20ee9c4b061e7c352da03ef8d75
Branches: PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=056df0dcb22a7654beb969765db3264eed37dc90
Log:
Add test for invalid SoapFault parameters
Changed paths:
A ext/soap/tests/fault_warning.phpt
Diff:
diff --git a/ext/soap/tests/fault_warning.phpt b/ext/soap/tests/fault_warning.phpt
new file mode 100644
index 0000000..98d2d26
--- /dev/null
+++ b/ext/soap/tests/fault_warning.phpt
@@ -0,0 +1,28 @@
+--TEST--
+SoapFault class: Invalid Fault code warning given? Can't be an empty string, an array of not 2
elements etc.
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$fault = new SoapFault("", "message"); // Can't be an empty string
+$fault = new SoapFault(0, "message"); // Can't be a non-string (except for null)
+$fault = new SoapFault("Sender", "message");
+echo get_class($fault) . "\n";
+$fault = new SoapFault(null, "message");
+echo get_class($fault) . "\n";
+$fault = new SoapFault(["more"], "message"); // two elements in array required
+$fault = new SoapFault(["m", "more", "superflous"],
"message"); // two required
+$fault = new SoapFault(["more-ns", "Sender"], "message"); // two
given
+echo get_class($fault);
+?>
+--EXPECTF--
+Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+
+Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+SoapFault
+SoapFault
+
+Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+
+Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+SoapFault