forked from goetas-webservices/xsd2php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add minimal test case for goetas-webservices#168
- Loading branch information
1 parent
67c49df
commit 577c2a8
Showing
2 changed files
with
40 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace GoetasWebservices\Xsd\XsdToPhp\Tests\Issues\I168; | ||
|
||
use GoetasWebservices\XML\XSDReader\SchemaReader; | ||
use GoetasWebservices\Xsd\XsdToPhp\Naming\ShortNamingStrategy; | ||
use GoetasWebservices\Xsd\XsdToPhp\Php\PhpConverter; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class I168Test extends TestCase | ||
{ | ||
public function testChoice() | ||
{ | ||
$reader = new SchemaReader(); | ||
$schema = $reader->readFile(__DIR__ . '/data.xsd'); | ||
|
||
$phpConv = new PhpConverter(new ShortNamingStrategy()); | ||
$phpConv->addNamespace('http://www.example.com/', 'Epa'); | ||
|
||
$items = $phpConv->convert([$schema]); | ||
|
||
$this->assertTrue($items['Epa\ComplexType']->getProperty('key')->getNullable()); | ||
$this->assertTrue($items['Epa\ComplexType']->getProperty('stream')->getNullable()); | ||
$this->assertTrue($items['Epa\ComplexType']->getProperty('packet')->getNullable()); | ||
} | ||
} |
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,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com/" elementFormDefault="qualified"> | ||
<xs:complexType name="ComplexType"> | ||
<xs:choice> | ||
<xs:sequence> | ||
<xs:element name="key" type="xs:string"/> | ||
<xs:element name="stream" type="xs:string" minOccurs="0" nillable="true"/> | ||
</xs:sequence> | ||
<xs:sequence> | ||
<xs:element name="packet" type="xs:string" maxOccurs="unbounded"/> | ||
</xs:sequence> | ||
</xs:choice> | ||
</xs:complexType> | ||
</xs:schema> |