@@ -217,6 +217,44 @@ public function testGetItemFromIriWithIdentifierNormalizer()
217
217
$ converter ->getItemFromIri ('/users/3 ' , ['fetch_data ' => true ]);
218
218
}
219
219
220
+ public function testGetItemFromIriWithIdentifierNormalizerAndOperationName ()
221
+ {
222
+ $ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
223
+
224
+ $ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
225
+
226
+ $ itemDataProviderProphecy = $ this ->prophesize (ItemDataProviderInterface::class);
227
+ $ itemDataProviderProphecy ->getItem ('AppBundle\Entity\User ' , ['id ' => 3 ], 'operation_name ' , ['fetch_data ' => true , ChainIdentifierDenormalizer::HAS_IDENTIFIER_DENORMALIZER => true ])
228
+ ->willReturn ('foo ' )
229
+ ->shouldBeCalledTimes (1 );
230
+
231
+ $ routeNameResolverProphecy = $ this ->prophesize (RouteNameResolverInterface::class);
232
+
233
+ $ routerProphecy = $ this ->prophesize (RouterInterface::class);
234
+ $ routerProphecy ->match ('/users/3 ' )->willReturn ([
235
+ '_api_resource_class ' => 'AppBundle\Entity\User ' ,
236
+ '_api_item_operation_name ' => 'operation_name ' ,
237
+ 'id ' => 3 ,
238
+ ])->shouldBeCalledTimes (1 );
239
+
240
+ $ propertyNameCollectionFactory = $ propertyNameCollectionFactoryProphecy ->reveal ();
241
+ $ propertyMetadataFactory = $ propertyMetadataFactoryProphecy ->reveal ();
242
+ $ identifierDenormalizer = $ this ->prophesize (ChainIdentifierDenormalizer::class);
243
+ $ identifierDenormalizer ->denormalize ('3 ' , 'AppBundle\Entity\User ' )->shouldBeCalled ()->willReturn (['id ' => 3 ]);
244
+
245
+ $ converter = new IriConverter (
246
+ $ propertyNameCollectionFactory ,
247
+ $ propertyMetadataFactory ,
248
+ $ itemDataProviderProphecy ->reveal (),
249
+ $ routeNameResolverProphecy ->reveal (),
250
+ $ routerProphecy ->reveal (),
251
+ null ,
252
+ new IdentifiersExtractor ($ propertyNameCollectionFactory , $ propertyMetadataFactory , null , $ this ->getResourceClassResolver ()),
253
+ $ identifierDenormalizer ->reveal ()
254
+ );
255
+ $ converter ->getItemFromIri ('/users/3 ' , ['fetch_data ' => true ]);
256
+ }
257
+
220
258
public function testGetIriFromResourceClass ()
221
259
{
222
260
$ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
0 commit comments