@@ -168,6 +168,41 @@ public function testGetItemFromIri()
168
168
$ converter ->getItemFromIri ('/users/3 ' , ['fetch_data ' => true ]);
169
169
}
170
170
171
+ public function testGetItemFromIriWithOperationName ()
172
+ {
173
+ $ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
174
+
175
+ $ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
176
+
177
+ $ itemDataProviderProphecy = $ this ->prophesize (ItemDataProviderInterface::class);
178
+ $ itemDataProviderProphecy ->getItem ('AppBundle\Entity\User ' , '3 ' , 'operation_name ' , ['fetch_data ' => true ])
179
+ ->willReturn ('foo ' )
180
+ ->shouldBeCalledTimes (1 );
181
+
182
+ $ routeNameResolverProphecy = $ this ->prophesize (RouteNameResolverInterface::class);
183
+
184
+ $ routerProphecy = $ this ->prophesize (RouterInterface::class);
185
+ $ routerProphecy ->match ('/users/3 ' )->willReturn ([
186
+ '_api_resource_class ' => 'AppBundle\Entity\User ' ,
187
+ '_api_item_operation_name ' => 'operation_name ' ,
188
+ 'id ' => 3 ,
189
+ ])->shouldBeCalledTimes (1 );
190
+
191
+ $ propertyNameCollectionFactory = $ propertyNameCollectionFactoryProphecy ->reveal ();
192
+ $ propertyMetadataFactory = $ propertyMetadataFactoryProphecy ->reveal ();
193
+
194
+ $ converter = new IriConverter (
195
+ $ propertyNameCollectionFactory ,
196
+ $ propertyMetadataFactory ,
197
+ $ itemDataProviderProphecy ->reveal (),
198
+ $ routeNameResolverProphecy ->reveal (),
199
+ $ routerProphecy ->reveal (),
200
+ null ,
201
+ new IdentifiersExtractor ($ propertyNameCollectionFactory , $ propertyMetadataFactory , null , $ this ->getResourceClassResolver ())
202
+ );
203
+ $ converter ->getItemFromIri ('/users/3 ' , ['fetch_data ' => true ]);
204
+ }
205
+
171
206
public function testGetIriFromResourceClass ()
172
207
{
173
208
$ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
0 commit comments