23
23
use ApiPlatform \Core \Operation \Factory \SubresourceOperationFactory ;
24
24
use ApiPlatform \Core \Operation \PathSegmentNameGeneratorInterface ;
25
25
use ApiPlatform \Core \Tests \Fixtures \DummyEntity ;
26
- use ApiPlatform \Core \Tests \Fixtures \DummyEntityFilterAnnotated ;
27
26
use ApiPlatform \Core \Tests \Fixtures \DummyValidatedEntity ;
28
27
use ApiPlatform \Core \Tests \Fixtures \RelatedDummyEntity ;
29
28
use PHPUnit \Framework \TestCase ;
@@ -397,7 +396,6 @@ public function testCreateWithMaxDepthMultipleSubresources()
397
396
*/
398
397
public function testCreateWithMaxDepthMultipleSubresourcesSameMaxDepth ()
399
398
{
400
-
401
399
/**
402
400
* DummyEntity -subresource (maxDepth=1)-> RelatedDummyEntity -anotherSubresource-> DummyEntity
403
401
* DummyEntity -secondSubresource (maxDepth=1)-> dummyValidatedEntity -moreSubresource-> RelatedDummyEntity.
@@ -407,7 +405,6 @@ public function testCreateWithMaxDepthMultipleSubresourcesSameMaxDepth()
407
405
$ resourceMetadataFactoryProphecy ->create (RelatedDummyEntity::class)->shouldBeCalled ()->willReturn (new ResourceMetadata ('relatedDummyEntity ' ));
408
406
$ resourceMetadataFactoryProphecy ->create (DummyValidatedEntity::class)->shouldBeCalled ()->willReturn (new ResourceMetadata ('dummyValidatedEntity ' ));
409
407
410
-
411
408
$ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
412
409
$ propertyNameCollectionFactoryProphecy ->create (DummyEntity::class)->shouldBeCalled ()->willReturn (new PropertyNameCollection (['subresource ' , 'secondSubresource ' ]));
413
410
$ propertyNameCollectionFactoryProphecy ->create (RelatedDummyEntity::class)->shouldBeCalled ()->willReturn (new PropertyNameCollection (['bar ' , 'anotherSubresource ' ]));
@@ -439,29 +436,29 @@ public function testCreateWithMaxDepthMultipleSubresourcesSameMaxDepth()
439
436
440
437
$ this ->assertEquals ([
441
438
'api_dummy_entities_subresource_get_subresource ' => [
442
- 'property ' => 'subresource ' ,
443
- 'collection ' => false ,
444
- 'resource_class ' => RelatedDummyEntity::class,
445
- 'shortNames ' => ['relatedDummyEntity ' , 'dummyEntity ' ],
446
- 'identifiers ' => [
447
- ['id ' , DummyEntity::class, true ],
448
- ],
449
- 'route_name ' => 'api_dummy_entities_subresource_get_subresource ' ,
450
- 'path ' => '/dummy_entities/{id}/subresources.{_format} ' ,
451
- 'operation_name ' => 'subresource_get_subresource ' ,
452
- ] + SubresourceOperationFactory::ROUTE_OPTIONS ,
439
+ 'property ' => 'subresource ' ,
440
+ 'collection ' => false ,
441
+ 'resource_class ' => RelatedDummyEntity::class,
442
+ 'shortNames ' => ['relatedDummyEntity ' , 'dummyEntity ' ],
443
+ 'identifiers ' => [
444
+ ['id ' , DummyEntity::class, true ],
445
+ ],
446
+ 'route_name ' => 'api_dummy_entities_subresource_get_subresource ' ,
447
+ 'path ' => '/dummy_entities/{id}/subresources.{_format} ' ,
448
+ 'operation_name ' => 'subresource_get_subresource ' ,
449
+ ] + SubresourceOperationFactory::ROUTE_OPTIONS ,
453
450
'api_dummy_entities_second_subresource_get_subresource ' => [
454
- 'property ' => 'secondSubresource ' ,
455
- 'collection ' => false ,
456
- 'resource_class ' => DummyValidatedEntity::class,
457
- 'shortNames ' => ['dummyValidatedEntity ' , 'dummyEntity ' ],
458
- 'identifiers ' => [
459
- ['id ' , DummyEntity::class, true ],
460
- ],
461
- 'route_name ' => 'api_dummy_entities_second_subresource_get_subresource ' ,
462
- 'path ' => '/dummy_entities/{id}/second_subresources.{_format} ' ,
463
- 'operation_name ' => 'second_subresource_get_subresource ' ,
464
- ] + SubresourceOperationFactory::ROUTE_OPTIONS
451
+ 'property ' => 'secondSubresource ' ,
452
+ 'collection ' => false ,
453
+ 'resource_class ' => DummyValidatedEntity::class,
454
+ 'shortNames ' => ['dummyValidatedEntity ' , 'dummyEntity ' ],
455
+ 'identifiers ' => [
456
+ ['id ' , DummyEntity::class, true ],
457
+ ],
458
+ 'route_name ' => 'api_dummy_entities_second_subresource_get_subresource ' ,
459
+ 'path ' => '/dummy_entities/{id}/second_subresources.{_format} ' ,
460
+ 'operation_name ' => 'second_subresource_get_subresource ' ,
461
+ ] + SubresourceOperationFactory::ROUTE_OPTIONS ,
465
462
], $ subresourceOperationFactory ->create (DummyEntity::class));
466
463
}
467
464
0 commit comments