Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * 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());
 }
Ejemplo n.º 3
0
 /**
  * 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());
 }