public function testNestedServicesXml()
 {
     $serviceFile = new XmlElement(new \SimpleXMLElement('<container><services></services></container>'));
     $serviceFile->child('services')->addChild($this->getNestedServices());
     $this->assertEquals('<?xml version="1.0"?>' . "\n" . '<container><services>' . '<service id="service.one" class="stdClass">' . '<argument type="service">' . '<argument type="service" id="arg.one"/>' . '<argument type="service" id="arg.two" on-invalid="ignore"/>' . '<argument type="service" id="arg.three" on-invalid="null"/>' . '<argument type="string">arg.four</argument>' . '</argument>' . '</service>' . '</services></container>' . "\n", $serviceFile->__toString());
 }
Esempio n. 2
0
 public function testAddXmlElementName()
 {
     $el1 = new XmlElement(new SimpleXMLElement('<data p="d" va="re"><piece n="0">a</piece><piece n="1">b</piece></data>'));
     $el1Str = $el1->__toString();
     $collection = $this->getXmlCollection();
     $el = $collection->add('xx', $el1);
     $this->assertSame(str_replace('data', 'xx', $el1Str), $el->__toString());
     $added = $collection->find(array('p' => 'd', 'va' => 're'));
     $this->assertEqual(1, count($added));
 }
Esempio n. 3
0
 public function testAddXmlElementName()
 {
     $el1 = new XmlElement(new SimpleXMLElement('<data p="d" va="re"><piece n="0">a</piece><piece n="1">b</piece></data>'));
     $el1Str = $el1->__toString();
     $element = $this->getXmlElement();
     $el = $element->addChild('xx', $el1);
     $this->assertSame(str_replace('data', 'xx', $el1Str), $el->__toString());
     $added = $element->child('xx');
     $this->assertEqual($added->__toString(), $el->__toString());
 }