Author: Elliot Levin (elliot@aanet.com.au)
Esempio n. 1
0
 /**
  * @depends testAddedValuesAreSet
  */
 public function testCorrectPropertiesAreReturned()
 {
     $this->PropertyData[$this->Property1] = true;
     $this->PropertyData[$this->Property2] = true;
     $this->assertEquals($this->PropertyData->GetProperty($this->Property1->GetIdentifier()), $this->Property1);
     $this->assertEquals($this->PropertyData->GetProperty($this->Property2->GetIdentifier()), $this->Property2);
 }
Esempio n. 2
0
 /**
  * Adds a property to the given entity map.
  * 
  * @param \Storm\Core\Object\IProperty $Property The property to add
  * @return void
  * @throws InvalidPropertyException
  */
 private function AddProperty(IProperty $Property)
 {
     if ($Property->HasEntityMap()) {
         if (!$Property->GetEntityMap()->Is($this)) {
             throw new InvalidPropertyException('The supplied property is registered with another entity map %s.', get_class($Property->GetEntityMap()));
         }
     }
     $Property->SetEntityMap($this);
     $Identifier = $Property->GetIdentifier();
     if ($Property instanceof IDataProperty) {
         $this->DataProperties[$Identifier] = $Property;
         if ($Property->IsIdentity()) {
             $this->IdentityProperties[$Identifier] = $Property;
         }
     } else {
         if ($Property instanceof IEntityProperty) {
             $this->EntityProperties[$Identifier] = $Property;
         } else {
             if ($Property instanceof ICollectionProperty) {
                 $this->CollectionProperties[$Identifier] = $Property;
             } else {
                 throw new InvalidPropertyException('The supplied property must be of type %s, %s, %s: %s given', IDataProperty::IDataPropertyType, IEntityProperty::IEntityPropertyType, ICollectionProperty::ICollectionPropertyType, get_class($Property));
             }
         }
     }
     if ($Property instanceof IRelationshipProperty) {
         $this->RelationshipProperties[$Identifier] = $Property;
     }
     $this->Properties[$Identifier] = $Property;
 }
Esempio n. 3
0
 public function testEntityMapIsSameAsSet()
 {
     $EntityMap = $this->getMockForAbstractClass('\\Storm\\Core\\Object\\EntityMap');
     $this->Property->SetEntityMap($EntityMap);
     $this->assertEquals($this->Property->GetEntityMap(), $EntityMap);
 }
Esempio n. 4
0
 /**
  * Verifies that the data property column mapping exists for the supplied property.
  * 
  * @param \Storm\Core\Object\IProperty $Property The mapped property
  * @return IDataPropertyColumnMapping The property mapping
  * @throws \Storm\Core\Exceptions\UnmappedPropertyException If property is not mapped
  */
 private function VerifyDataPropertyColumnMapping($Method, IProperty $Property)
 {
     $PropertyIdentifier = $Property->GetIdentifier();
     if (isset($this->DataPropertyColumnMappings[$PropertyIdentifier])) {
         return $this->DataPropertyColumnMappings[$PropertyIdentifier];
     } else {
         throw new UnmappedPropertyException('The supplied property to %s has not been mapped', $Method);
     }
 }
Esempio n. 5
0
 private function AddProperty(Object\IProperty $Property)
 {
     $this->Properties[$Property->GetIdentifier()] = $Property;
 }