/** * Merges an attribute in the node store (add if it is new) * * @param NodeAttribute $attribute Attribute to be added * * @return void */ public function mergeAttribute(NodeAttribute $attribute) { if (!$this->has($attribute->getName())) { $this->attributes[$attribute->getName()] = $attribute; $this->tracker->logAddition($attribute->getName()); return; } $backup = $attribute; $attribute = $this->get($attribute->getName()); $attribute->add($backup->getValues()); $this->attributes[$attribute->getName()] = $attribute; }
/** * Tests retrieving attribute name * * @return void */ public function testGetName() { $test = new NodeAttribute('test'); $other = new NodeAttribute('other'); $this->assertEquals('test', $test->getName()); $this->assertEquals('other', $other->getName()); }
/** * Shows that case sensitivity switch correctly returns attributes */ public function testCaseSensitivity() { $test = new NodeAttribute('Test', null, true); $this->assertEquals('Test', $test->getName()); // default is no sensitivity $test = new NodeAttribute('Test', null); $this->assertEquals('test', $test->getName()); }