예제 #1
0
 /**
  * @depends testAttributeAwareInterface
  * @param AttributeAware $entity
  */
 public function testAttributeSetRemoveGet(AttributeAware $entity)
 {
     $entity->setAttribute('test', 'value');
     $this->assertEquals('value', $entity->getAttribute('test'));
     $entity->removeAttribute('test');
     $this->assertEquals(null, $entity->getAttribute('test'));
 }
 /**
  * @depends testAttributeAwareInterface
  * @param AttributeAware $entity
  */
 public function testAttributeSetGetDefault(AttributeAware $entity)
 {
     $entity->setAttribute('test', 'value');
     $this->assertEquals('value', $entity->getAttribute('test'));
     $this->assertEquals(null, $entity->getAttribute('unknown'));
     $this->assertEquals('default', $entity->getAttribute('unknown', 'default'));
 }
예제 #3
0
 /**
  * @param AttributeAware $attributeAware
  * @param Location       $location
  */
 private function addLocationTo(AttributeAware $attributeAware, Location $location)
 {
     $locations = $attributeAware->getAttribute('locations', array());
     $locations[] = $location;
     $attributeAware->setAttribute('locations', $locations);
 }