1 | <?php |
||
7 | class XsdValidatorTest extends \PHPUnit_Framework_TestCase |
||
8 | { |
||
9 | protected $xsd = <<<EOL |
||
10 | <?xml version="1.0"?> |
||
11 | <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" |
||
12 | targetNamespace="http://christoph-hautzinger.de/schema/system-mail-bundle" |
||
13 | xmlns="http://christoph-hautzinger.de/schema/system-mail-bundle" |
||
14 | elementFormDefault="qualified"> |
||
15 | |||
16 | <xs:element name="email"> |
||
17 | <xs:complexType> |
||
18 | <xs:sequence> |
||
19 | <xs:element name="to" type="xs:string"/> |
||
20 | <xs:element name="from" type="xs:string"/> |
||
21 | </xs:sequence> |
||
22 | </xs:complexType> |
||
23 | </xs:element> |
||
24 | |||
25 | </xs:schema> |
||
26 | EOL; |
||
27 | |||
28 | protected $validXml = <<<EOL |
||
29 | <?xml version="1.0"?> |
||
30 | <email xmlns="http://christoph-hautzinger.de/schema/system-mail-bundle" |
||
31 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||
32 | xsi:schemaLocation="http://christoph-hautzinger.de/schema/system-mail-bundle http://christoph-hautzinger.de/schema/system-mail-bundle/email-1.0.xsd"> |
||
33 | <to>hautzi</to> |
||
34 | <from>not-hautzi</from> |
||
35 | </email> |
||
36 | EOL; |
||
37 | |||
38 | protected $invalidXml = <<<EOL |
||
39 | <?xml version="1.0"?> |
||
40 | <email xmlns="http://christoph-hautzinger.de/schema/system-mail-bundle" |
||
41 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||
42 | xsi:schemaLocation="http://christoph-hautzinger.de/schema/system-mail-bundle http://christoph-hautzinger.de/schema/system-mail-bundle/email-1.0.xsd"> |
||
43 | <message>hautzi</message> |
||
44 | <from>not-hautzi</from> |
||
45 | </email> |
||
46 | EOL; |
||
47 | |||
48 | protected $tmpXsdFile; |
||
49 | |||
50 | protected function setUp() |
||
55 | |||
56 | protected function tearDown() |
||
60 | |||
61 | |||
62 | public function testValidationSuccess() |
||
68 | |||
69 | /** |
||
70 | * @expectedException \Hautzi\SystemMailBundle\SystemMailer\XML\XsdValidationException |
||
71 | */ |
||
72 | public function testValidationFailsThrowsException() |
||
78 | } |
||
79 |