|
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;
|
|
23 | 28 | use ApiPlatform\Core\DataProvider\ItemDataProviderInterface;
|
24 | 29 | use ApiPlatform\Core\DataProvider\SubresourceDataProviderInterface;
|
25 | 30 | use ApiPlatform\Core\Exception\InvalidArgumentException;
|
| 31 | +use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface; |
| 32 | +use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface; |
| 33 | +use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface; |
| 34 | +use ApiPlatform\Core\Metadata\Resource\Factory\ResourceNameCollectionFactoryInterface; |
26 | 35 | use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface;
|
27 | 36 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\TestBundle;
|
28 | 37 | use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
|
@@ -267,7 +276,7 @@ public function testResourcesToWatchWithUnsupportedMappingType()
|
267 | 276 | {
|
268 | 277 | $this->extension->load(
|
269 | 278 | array_merge_recursive(self::DEFAULT_CONFIG, ['api_platform' => ['mapping' => ['paths' => [__FILE__]]]]),
|
270 |
| - $this->getPartialContainerBuilderProphecy()->reveal() |
| 279 | + $this->getPartialContainerBuilderProphecy(false)->reveal() |
271 | 280 | );
|
272 | 281 | }
|
273 | 282 |
|
@@ -304,7 +313,7 @@ public function testNotRegisterHttpCacheWhenEnabledWithNoVarnishServer()
|
304 | 313 | $this->extension->load($config, $containerBuilder);
|
305 | 314 | }
|
306 | 315 |
|
307 |
| - private function getPartialContainerBuilderProphecy() |
| 316 | + private function getPartialContainerBuilderProphecy($test = false) |
308 | 317 | {
|
309 | 318 | $containerBuilderProphecy = $this->prophesize(ContainerBuilder::class);
|
310 | 319 | $childDefinitionProphecy = $this->prophesize(ChildDefinition::class);
|
@@ -494,6 +503,10 @@ private function getPartialContainerBuilderProphecy()
|
494 | 503 | ItemDataProviderInterface::class => 'api_platform.item_data_provider',
|
495 | 504 | SubresourceDataProviderInterface::class => 'api_platform.subresource_data_provider',
|
496 | 505 | DataPersisterInterface::class => 'api_platform.data_persister',
|
| 506 | + ResourceNameCollectionFactoryInterface::class => 'api_platform.metadata.resource.name_collection_factory', |
| 507 | + ResourceMetadataFactoryInterface::class => 'api_platform.metadata.resource.metadata_factory', |
| 508 | + PropertyNameCollectionFactoryInterface::class => 'api_platform.metadata.property.name_collection_factory', |
| 509 | + PropertyMetadataFactoryInterface::class => 'api_platform.metadata.property.metadata_factory', |
497 | 510 | ];
|
498 | 511 |
|
499 | 512 | foreach ($aliases as $alias => $service) {
|
@@ -624,7 +637,18 @@ private function getBaseContainerBuilderProphecy()
|
624 | 637 | $containerBuilderProphecy->setDefinition($definition, Argument::type(Definition::class))->shouldBeCalled();
|
625 | 638 | }
|
626 | 639 |
|
627 |
| - $containerBuilderProphecy->setAlias('api_platform.http_cache.purger', 'api_platform.http_cache.purger.varnish')->shouldBeCalled(); |
| 640 | + $aliases = [ |
| 641 | + 'api_platform.http_cache.purger' => 'api_platform.http_cache.purger.varnish', |
| 642 | + EagerLoadingExtension::class => 'api_platform.doctrine.orm.query_extension.eager_loading', |
| 643 | + FilterExtension::class => 'api_platform.doctrine.orm.query_extension.filter', |
| 644 | + FilterEagerLoadingExtension::class => 'api_platform.doctrine.orm.query_extension.filter_eager_loading', |
| 645 | + PaginationExtension::class => 'api_platform.doctrine.orm.query_extension.pagination', |
| 646 | + OrderExtension::class => 'api_platform.doctrine.orm.query_extension.order', |
| 647 | + ]; |
| 648 | + |
| 649 | + foreach ($aliases as $alias => $service) { |
| 650 | + $containerBuilderProphecy->setAlias($alias, $service)->shouldBeCalled(); |
| 651 | + } |
628 | 652 |
|
629 | 653 | return $containerBuilderProphecy;
|
630 | 654 | }
|
|
0 commit comments