public function testName() { $b = new Behavior(); $this->assertNull($b->getName(), 'Behavior name is null by default'); $b->setName('foo'); $this->assertEquals($b->getName(), 'foo', 'setName() sets the name, and getName() gets it'); }
/** * Appends the generated <behavior> XML node to its parent node. * * @param Behavior $behavior The Behavior model instance * @param \DOMNode $parentNode The parent DOMNode object */ private function appendBehaviorNode(Behavior $behavior, \DOMNode $parentNode) { $behaviorNode = $parentNode->appendChild($this->document->createElement('behavior')); $behaviorNode->setAttribute('name', $behavior->getName()); if ($behavior->allowMultiple()) { $behaviorNode->setAttribute('id', $behavior->getId()); } foreach ($behavior->getParameters() as $name => $value) { $parameterNode = $behaviorNode->appendChild($this->document->createElement('parameter')); $parameterNode->setAttribute('name', $name); $parameterNode->setAttribute('value', $value); } }