Ejemplo n.º 1
0
 public function testMergeRelations()
 {
     $blueprint = new Blueprint('foo');
     $relations1 = array('foo');
     $relations2 = array('bar');
     $blueprint->mergeRelations($relations1);
     $blueprint->mergeRelations($relations2);
     $this->assertEquals($blueprint->getRelations(), array('foo', 'bar'));
 }
Ejemplo n.º 2
0
 /**
  * Create a fake model instance from Blueprint
  * 
  * @param Skovachev\Fakefactory\Model\Blueprint\Blueprint $blueprint 
  * @return object
  */
 protected function makeFromBlueprint($blueprint)
 {
     $modelClass = $blueprint->getClass();
     $model = $this->reflector->instantiate($modelClass);
     foreach ($blueprint->getAttributes() as $attribute) {
         $this->model->setAttribute($model, $attribute);
     }
     foreach ($blueprint->getRelations() as $relation) {
         $relation->applyToModelAndContainedValue($model);
         $this->model->setRelation($model, $relation);
     }
     $this->clearBuildOptions();
     return $model;
 }