Exemple #1
0
 /**
  * @param Attribute $attribute
  * @return mixed
  * @throws UnknownAttributeException
  */
 public function addAttribute(Attribute $attribute)
 {
     if (!in_array($attribute->getKey(), $this->getAttributeKeys())) {
         throw new UnknownAttributeException($attribute->getKey());
     }
     return $this->attributes[$attribute->getKey()] = $attribute;
 }
 public function testAttributeArrayValue()
 {
     $attribute = new Attribute('key', array('a', 'b'));
     $this->assertSame('key', $attribute->getKey());
     $this->assertSame('a, b', $attribute->getValue());
 }