Exemplo n.º 1
0
 /**
  * Tests getting as an object
  * @covers \Copycat\Structure\SimpleXmlElement::getAsObject()
  */
 public function testGetAsObject()
 {
     $element = new SimpleXmlElement('<Test><foo></foo></Test>');
     $this->assertInstanceOf('\\Copycat\\Standard\\StdClass', $element->getAsObject());
     $this->assertTrue(isset($element->getAsObject()->foo));
     $this->assertFalse(isset($element->getAsObject()->bar));
     $callback = function () use($element) {
         $element->addChild('bar');
         return $element;
     };
     $this->assertTrue(isset($element->getAsObject($callback)->bar));
 }