Example #1
0
 /**
  * @return Definition
  */
 private function createEntityDefinition()
 {
     $definition = new Definition(new ClassName(EntityFake::getClassName()), new Definition\Identity("id"));
     $definition->addToObserved(new Definition\Property("firstName"));
     $definition->addToObserved(new Definition\Property("lastName"));
     return $definition;
 }
Example #2
0
 function it_throws_exception_when_associated_entity_is_not_defied()
 {
     $definition = new Definition(new ClassName(EntityFake::getClassName()), new Definition\Identity("not_exists"));
     $association = new Definition\Association(new ClassName(EntityFakeChild::getClassName()), Definition\Association::TO_MANY_ENTITIES);
     $definition->addToObserved(new Definition\Property("children", $association));
     $this->shouldThrow(new InvalidArgumentException("Entity class \"Isolate\\UnitOfWork\\Tests\\Double\\EntityFakeChild\" used in association of \"Isolate\\UnitOfWork\\Tests\\Double\\EntityFake\" entity does not have definition."))->during("__construct", [[$definition]]);
 }