1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
--TEST--
SoapFault class: Invalid Fault code warning given? Can't be an empty string, an array of not 2 elements etc.
--EXTENSIONS--
soap
--FILE--
<?php
try {
new SoapFault("", "message"); // Can't be an empty string
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
new SoapFault(new stdClass(), "message"); // Can't be a non-string (except for null)
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
$fault = new SoapFault("Sender", "message");
echo get_class($fault) . "\n";
$fault = new SoapFault(null, "message");
echo get_class($fault) . "\n";
try {
new SoapFault(["more"], "message"); // two elements in array required
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
new SoapFault(["m", "more", "superfluous"], "message"); // two required
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
$fault = new SoapFault(["more-ns", "Sender"], "message"); // two given
echo get_class($fault);
?>
--EXPECT--
SoapFault::__construct(): Argument #1 ($code) is not a valid fault code
SoapFault::__construct(): Argument #1 ($code) must be of type array|string|null, stdClass given
SoapFault
SoapFault
SoapFault::__construct(): Argument #1 ($code) is not a valid fault code
SoapFault::__construct(): Argument #1 ($code) is not a valid fault code
SoapFault
|