Автор: Kévin Dunglas (dunglas@gmail.com)
Автор: Samuel ROZE (samuel.roze@gmail.com)
Наследование: implements ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\QueryCollectionExtensionInterface
Пример #1
0
 public function testApplyToCollectionWithWrongOrder()
 {
     $queryBuilderProphecy = $this->prophesize(QueryBuilder::class);
     $queryBuilderProphecy->addOrderBy('o.name', 'asc')->shouldNotBeCalled();
     $classMetadataProphecy = $this->prophesize(ClassMetadata::class);
     $classMetadataProphecy->getIdentifier()->shouldBeCalled()->willReturn(['name']);
     $emProphecy = $this->prophesize(EntityManager::class);
     $emProphecy->getClassMetadata(Dummy::class)->shouldBeCalled()->willReturn($classMetadataProphecy->reveal());
     $queryBuilderProphecy->getEntityManager()->shouldBeCalled()->willReturn($emProphecy->reveal());
     $queryBuilder = $queryBuilderProphecy->reveal();
     $orderExtensionTest = new OrderExtension();
     $orderExtensionTest->applyToCollection($queryBuilder, new QueryNameGenerator(), Dummy::class);
 }