1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/soap/tests/fault_warning.phpt
Max Semenik 7f2f0c007c Migrate skip checks to --EXTENSIONS--, p4
For rationale, see #6787

Extensions migrated in part 4:
* simplexml
* skeleton
* soap
* spl
* sqlite3
* sysvmsg
* sysvsem
* tidy - also removed a check for an ancient dependency version
2021-04-08 10:36:44 +02:00

49 lines
1.4 KiB
PHP

--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