Esempio n. 1
0
 public function testSetupObject()
 {
     $inheritance = new Inheritance();
     $inheritance->loadMapping(['key' => 'baz', 'extends' => 'BaseObject', 'class' => 'Foo\\Bar', 'package' => 'Foo']);
     $this->assertSame('Foo', $inheritance->getPackage());
     $this->assertSame('BaseObject', $inheritance->getAncestor());
     $this->assertSame('baz', $inheritance->getKey());
     $this->assertSame('Foo\\Bar', $inheritance->getClassName());
 }
Esempio n. 2
0
 /**
  * Appends the generated <inheritance> XML node to its parent node.
  *
  * @param Inheritance $inheritance The Inheritance model instance
  * @param \DOMNode    $parentNode  The parent DOMNode object
  */
 private function appendInheritanceNode(Inheritance $inheritance, \DOMNode $parentNode)
 {
     $inheritanceNode = $parentNode->appendChild($this->document->createElement('inheritance'));
     $inheritanceNode->setAttribute('key', $inheritance->getKey());
     $inheritanceNode->setAttribute('class', $inheritance->getClassName());
     if ($ancestor = $inheritance->getAncestor()) {
         $inheritanceNode->setAttribute('extends', $ancestor);
     }
 }