| 1 | <?php |
||
| 16 | $this->xmlChildren = null; |
||
| 17 | $xml = $this->toXml(); |
||
| 18 | $this->assertEquals(0, $xml->childNodes->length); |
||
| 19 | } |
||
| 20 | |||
| 21 | public function testInvalid() |
||
| 22 | { |
||
| 23 | $this->xmlChildren = [ |
||
| 24 | new \UnexpectedValueException() |
||
| 25 | ]; |
||
| 26 | $this->expectException(\TypeError::class); |
||
| 27 | $this->toXml(); |
||
| 28 | } |
||
| 29 | |||
| 30 | public function testOne() |
||
| 31 | { |
||
| 32 | $doc = new \DOMDocument(); |
||
| 33 | $this->xmlChildren = [$this->toXml($doc)]; |
||
| 34 | $xml = $this->toXml($doc); |
||
| 35 | $this->assertEquals(1, $xml->childNodes->length); |
||
| 36 | } |
||
| 37 | |||
| 38 | public function testFew() |
||
| 39 | { |
||
| 40 | $doc = new \DOMDocument(); |
||
| 41 | $this->xmlChildren = [ |
||
| 42 | new SampleXml(), |
||
| 43 | $this->toXml($doc), |
||
| 44 | ]; |
||
| 45 | $xml = $this->toXml($doc); |
||
| 46 | $this->assertEquals(2, $xml->childNodes->length); |
||
| 47 | } |
||
| 48 | } |
||
| 49 |