-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from veewee/optional-encoding-fix
Allow not setting optional objects and arrays whilst encoding.
- Loading branch information
Showing
8 changed files
with
108 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Soap\Encoding\Encoder\Feature; | ||
|
||
/** | ||
* Tells the encoder knows about optional (nullable) values. | ||
*/ | ||
interface OptionalAware extends DisregardXsiInformation | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Soap\Encoding\Test\PhpCompatibility\Implied; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use Soap\Encoding\Decoder; | ||
use Soap\Encoding\Driver; | ||
use Soap\Encoding\Encoder; | ||
use Soap\Encoding\Test\PhpCompatibility\AbstractCompatibilityTests; | ||
|
||
#[CoversClass(Driver::class)] | ||
#[CoversClass(Encoder::class)] | ||
#[CoversClass(Decoder::class)] | ||
final class ImpliedSchema004Test extends AbstractCompatibilityTests | ||
{ | ||
protected string $schema = <<<EOXML | ||
<element name="testType"> | ||
<complexType> | ||
<sequence> | ||
<element name="OptionalList" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> | ||
<element name="OptionalSimpleElement" type="xsd:string" minOccurs="0" maxOccurs="1"/> | ||
<element name="OptionalObject" minOccurs="0"> | ||
<complexType> | ||
<sequence> | ||
<element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> | ||
</sequence> | ||
</complexType> | ||
</element> | ||
</sequence> | ||
</complexType> | ||
</element> | ||
EOXML; | ||
protected string $type = 'type="tns:testType"'; | ||
|
||
protected function calculateParam(): mixed | ||
{ | ||
return (object)[]; | ||
} | ||
|
||
protected function expectDecoded(): mixed | ||
{ | ||
return (object)[ | ||
'OptionalList' => [], | ||
'OptionalSimpleElement' => null, | ||
'OptionalObject' => null, | ||
]; | ||
} | ||
|
||
protected function expectXml(): string | ||
{ | ||
return <<<XML | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://test-uri/" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> | ||
<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> | ||
<tns:test> | ||
<testParam xsi:type="tns:testType" /> | ||
</tns:test> | ||
</SOAP-ENV:Body> | ||
</SOAP-ENV:Envelope> | ||
XML; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters