|
15 | 15 |
|
16 | 16 | use ApiPlatform\Core\Api\FilterInterface;
|
17 | 17 | use ApiPlatform\Core\Api\IriConverterInterface;
|
| 18 | +use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\EagerLoadingExtension; |
| 19 | +use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\FilterEagerLoadingExtension; |
| 20 | +use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\FilterExtension; |
| 21 | +use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\OrderExtension; |
| 22 | +use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\PaginationExtension; |
18 | 23 | use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\QueryCollectionExtensionInterface;
|
19 | 24 | use ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\QueryItemExtensionInterface;
|
20 | 25 | use ApiPlatform\Core\Bridge\Symfony\Bundle\DependencyInjection\ApiPlatformExtension;
|
21 | 26 | use ApiPlatform\Core\DataProvider\CollectionDataProviderInterface;
|
22 | 27 | use ApiPlatform\Core\DataProvider\ItemDataProviderInterface;
|
23 | 28 | use ApiPlatform\Core\DataProvider\SubresourceDataProviderInterface;
|
24 | 29 | use ApiPlatform\Core\Exception\InvalidArgumentException;
|
| 30 | +use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface; |
| 31 | +use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface; |
| 32 | +use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface; |
| 33 | +use ApiPlatform\Core\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface; |
25 | 34 | use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface;
|
26 | 35 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\TestBundle;
|
27 | 36 | use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
|
@@ -246,7 +255,7 @@ public function testResourcesToWatchWithUnsupportedMappingType()
|
246 | 255 | {
|
247 | 256 | $this->extension->load(
|
248 | 257 | array_merge_recursive(self::DEFAULT_CONFIG, ['api_platform' => ['mapping' => ['paths' => [__FILE__]]]]),
|
249 |
| - $this->getPartialContainerBuilderProphecy()->reveal() |
| 258 | + $this->getPartialContainerBuilderProphecy(false)->reveal() |
250 | 259 | );
|
251 | 260 | }
|
252 | 261 |
|
@@ -283,7 +292,7 @@ public function testNotRegisterHttpCacheWhenEnabledWithNoVarnishServer()
|
283 | 292 | $this->extension->load($config, $containerBuilder);
|
284 | 293 | }
|
285 | 294 |
|
286 |
| - private function getPartialContainerBuilderProphecy() |
| 295 | + private function getPartialContainerBuilderProphecy($test = false) |
287 | 296 | {
|
288 | 297 | $containerBuilderProphecy = $this->prophesize(ContainerBuilder::class);
|
289 | 298 | $childDefinitionProphecy = $this->prophesize(ChildDefinition::class);
|
@@ -460,6 +469,10 @@ private function getPartialContainerBuilderProphecy()
|
460 | 469 | CollectionDataProviderInterface::class => 'api_platform.collection_data_provider',
|
461 | 470 | ItemDataProviderInterface::class => 'api_platform.item_data_provider',
|
462 | 471 | SubresourceDataProviderInterface::class => 'api_platform.subresource_data_provider',
|
| 472 | + ResourceNameCollectionFactoryInterface::class => 'api_platform.metadata.resource.name_collection_factory', |
| 473 | + ResourceMetadataFactoryInterface::class => 'api_platform.metadata.resource.metadata_factory', |
| 474 | + PropertyNameCollectionFactoryInterface::class => 'api_platform.metadata.property.name_collection_factory', |
| 475 | + PropertyMetadataFactoryInterface::class => 'api_platform.metadata.property.metadata_factory', |
463 | 476 | ];
|
464 | 477 |
|
465 | 478 | foreach ($aliases as $alias => $service) {
|
@@ -581,7 +594,18 @@ private function getBaseContainerBuilderProphecy()
|
581 | 594 | $containerBuilderProphecy->setDefinition($definition, Argument::type(Definition::class))->shouldBeCalled();
|
582 | 595 | }
|
583 | 596 |
|
584 |
| - $containerBuilderProphecy->setAlias('api_platform.http_cache.purger', 'api_platform.http_cache.purger.varnish')->shouldBeCalled(); |
| 597 | + $aliases = [ |
| 598 | + 'api_platform.http_cache.purger' => 'api_platform.http_cache.purger.varnish', |
| 599 | + EagerLoadingExtension::class => 'api_platform.doctrine.orm.query_extension.eager_loading', |
| 600 | + FilterExtension::class => 'api_platform.doctrine.orm.query_extension.filter', |
| 601 | + FilterEagerLoadingExtension::class => 'api_platform.doctrine.orm.query_extension.filter_eager_loading', |
| 602 | + PaginationExtension::class => 'api_platform.doctrine.orm.query_extension.pagination', |
| 603 | + OrderExtension::class => 'api_platform.doctrine.orm.query_extension.order', |
| 604 | + ]; |
| 605 | + |
| 606 | + foreach ($aliases as $alias => $service) { |
| 607 | + $containerBuilderProphecy->setAlias($alias, $service)->shouldBeCalled(); |
| 608 | + } |
585 | 609 |
|
586 | 610 | return $containerBuilderProphecy;
|
587 | 611 | }
|
|
0 commit comments