@@ -726,6 +726,47 @@ public function testAttributes()
726
726
$ eagerExtensionTest ->applyToCollection ($ queryBuilder , new QueryNameGenerator (), Dummy::class);
727
727
}
728
728
729
+ public function testNotInAttributes ()
730
+ {
731
+ $ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
732
+ $ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ());
733
+
734
+ $ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
735
+ $ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
736
+ $ relationPropertyMetadata = new PropertyMetadata ();
737
+ $ relationPropertyMetadata = $ relationPropertyMetadata ->withReadableLink (true );
738
+
739
+ $ propertyMetadataFactoryProphecy ->create (Dummy::class, 'relatedDummy ' , ['serializer_groups ' => ['foo ' ]])->willReturn ($ relationPropertyMetadata )->shouldBeCalled ();
740
+
741
+ $ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
742
+
743
+ $ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
744
+ $ classMetadataProphecy ->associationMappings = [
745
+ 'relatedDummy ' => ['fetch ' => 3 , 'joinColumns ' => [['nullable ' => true ]], 'targetEntity ' => RelatedDummy::class],
746
+ ];
747
+
748
+ $ relatedClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
749
+ $ relatedClassMetadataProphecy ->associationMappings = [];
750
+
751
+ $ emProphecy = $ this ->prophesize (EntityManager::class);
752
+ $ emProphecy ->getClassMetadata (Dummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
753
+
754
+ $ queryBuilderProphecy ->getRootAliases ()->willReturn (['o ' ]);
755
+ $ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy );
756
+
757
+ $ request = Request::create ('/api/dummies ' , 'GET ' , []);
758
+
759
+ $ requestStack = new RequestStack ();
760
+ $ requestStack ->push ($ request );
761
+
762
+ $ serializerContextBuilderProphecy = $ this ->prophesize (SerializerContextBuilderInterface::class);
763
+ $ serializerContextBuilderProphecy ->createFromRequest ($ request , true )->shouldBeCalled ()->willReturn ([AbstractNormalizer::GROUPS => ['foo ' ], AbstractNormalizer::ATTRIBUTES => ['relatedDummy ' ]]);
764
+
765
+ $ queryBuilder = $ queryBuilderProphecy ->reveal ();
766
+ $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false , $ requestStack , $ serializerContextBuilderProphecy ->reveal (), true );
767
+ $ eagerExtensionTest ->applyToCollection ($ queryBuilder , new QueryNameGenerator (), Dummy::class);
768
+ }
769
+
729
770
public function testApplyToCollectionNoPartial ()
730
771
{
731
772
$ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
0 commit comments