|
| 1 | +<?php |
| 2 | +declare(strict_types=1); |
| 3 | + |
| 4 | +namespace Soap\Encoding\Test\PhpCompatibility\Implied; |
| 5 | + |
| 6 | +use PHPUnit\Framework\Attributes\CoversClass; |
| 7 | +use Soap\Encoding\Decoder; |
| 8 | +use Soap\Encoding\Driver; |
| 9 | +use Soap\Encoding\Encoder; |
| 10 | +use Soap\Encoding\Test\PhpCompatibility\AbstractCompatibilityTests; |
| 11 | + |
| 12 | +#[CoversClass(Driver::class)] |
| 13 | +#[CoversClass(Encoder::class)] |
| 14 | +#[CoversClass(Decoder::class)] |
| 15 | +final class ImpliedSchema004Test extends AbstractCompatibilityTests |
| 16 | +{ |
| 17 | + protected string $schema = <<<EOXML |
| 18 | + <element name="testType"> |
| 19 | + <complexType> |
| 20 | + <sequence> |
| 21 | + <element name="OptionalList" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> |
| 22 | + <element name="OptionalSimpleElement" type="xsd:string" minOccurs="0" maxOccurs="1"/> |
| 23 | + <element name="OptionalObject" minOccurs="0"> |
| 24 | + <complexType> |
| 25 | + <sequence> |
| 26 | + <element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> |
| 27 | + </sequence> |
| 28 | + </complexType> |
| 29 | + </element> |
| 30 | + </sequence> |
| 31 | + </complexType> |
| 32 | + </element> |
| 33 | + EOXML; |
| 34 | + protected string $type = 'type="tns:testType"'; |
| 35 | + |
| 36 | + protected function calculateParam(): mixed |
| 37 | + { |
| 38 | + return (object)[]; |
| 39 | + } |
| 40 | + |
| 41 | + protected function expectDecoded(): mixed |
| 42 | + { |
| 43 | + return (object)[ |
| 44 | + 'OptionalList' => [], |
| 45 | + 'OptionalSimpleElement' => null, |
| 46 | + 'OptionalObject' => null, |
| 47 | + ]; |
| 48 | + } |
| 49 | + |
| 50 | + protected function expectXml(): string |
| 51 | + { |
| 52 | + return <<<XML |
| 53 | + <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://test-uri/" |
| 54 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 55 | + xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> |
| 56 | + <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> |
| 57 | + <tns:test> |
| 58 | + <testParam xsi:type="tns:testType" /> |
| 59 | + </tns:test> |
| 60 | + </SOAP-ENV:Body> |
| 61 | + </SOAP-ENV:Envelope> |
| 62 | + XML; |
| 63 | + } |
| 64 | +} |
0 commit comments