Author: Kévin Dunglas (dunglas@gmail.com)
Inheritance: implements ApiPlatform\Core\Api\IriConverterInterface, use trait ApiPlatform\Core\Util\ClassInfoTrait
コード例 #1
0
 public function testGetItemFromIri()
 {
     $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
     $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
     $itemDataProviderProphecy = $this->prophesize(ItemDataProviderInterface::class);
     $itemDataProviderProphecy->getItem('AppBundle\\Entity\\User', 3, null, ['fetch_data' => true])->willReturn('foo')->shouldBeCalledTimes(1);
     $routeNameResolverProphecy = $this->prophesize(RouteNameResolverInterface::class);
     $routerProphecy = $this->prophesize(RouterInterface::class);
     $routerProphecy->match('/users/3')->willReturn(['_api_resource_class' => 'AppBundle\\Entity\\User', 'id' => 3])->shouldBeCalledTimes(1);
     $converter = new IriConverter($propertyNameCollectionFactoryProphecy->reveal(), $propertyMetadataFactoryProphecy->reveal(), $itemDataProviderProphecy->reveal(), $routeNameResolverProphecy->reveal(), $routerProphecy->reveal());
     $converter->getItemFromIri('/users/3', ['fetch_data' => true]);
 }