Ejemplo n.º 1
0
 function it_gets_identity_from_entity(Definition\Repository $definitions, Definition\IdentificationStrategy $identificationStrategy)
 {
     $entity = new EntityFake(1);
     $identificationStrategy->getIdentity($entity)->willReturn(1);
     $definitions->hasDefinition($entity)->willReturn(true);
     $definitions->getDefinition($entity)->willReturn(new Definition(new ClassName(EntityFake::getClassName()), new Definition\Identity("id"), $identificationStrategy->getWrappedObject()));
     $this->getIdentity($entity)->shouldReturn(1);
 }
Ejemplo n.º 2
0
 /**
  * @param $entity
  * @throws RuntimeException
  */
 private function validateEntity($entity)
 {
     if (!$this->definitions->hasDefinition($entity)) {
         throw new RuntimeException(sprintf("Class \"%s\" does not have definition.", get_class($entity)));
     }
 }