function it_handles_a_find_all_query(FindAll $query, EntityRepository $repository, EntityManagerInterface $em) { $query->getEntityClass()->willReturn('Indigo\\Crud\\Stub\\Entity'); $repository->findAll()->shouldBeCalled(); $em->getRepository('Indigo\\Crud\\Stub\\Entity')->willReturn($repository); $this->handle($query); }
/** * Returns an entity * * @param FindAll $query * * @return object|null */ public function handle(FindAll $query) { $entityClass = $query->getEntityClass(); return $this->em->getRepository($entityClass)->findAll(); }