/** * @Given there is an entity with this information: */ public function thereIsAnEntityWithThisInformation(TableNode $info) { $info = $info->getRowsHash(); $entity = new Entity(); $entity->setId((int) $info['Id']); $entity->setName($info['Name']); $this->entityRepository->save($entity); }
function it_shows_the_entity_name_for_a_given_id(EntityRepository $entityRepository, Entity $entity) { $entity->getName()->willReturn('Entity'); $entityRepository->find(456)->willReturn($entity); $this->showEntityNameAction(456)->shouldReturn('Entity'); }
function it_returns_null_if_the_id_does_not_exist(Entity $entity) { $entity->getId()->willReturn(123); $this->save($entity); $this->find(456)->shouldReturn(null); }