@@ -95,7 +95,7 @@ public function testApplyToCollection()
95
95
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled (2 )->willReturn ($ emProphecy ->reveal ());
96
96
97
97
$ queryBuilder = $ queryBuilderProphecy ->reveal ();
98
- $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal ());
98
+ $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
99
99
$ eagerExtensionTest ->applyToCollection ($ queryBuilder , new QueryNameGenerator (), Dummy::class);
100
100
}
101
101
@@ -182,7 +182,7 @@ public function testApplyToItem()
182
182
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled (2 )->willReturn ($ emProphecy ->reveal ());
183
183
184
184
$ queryBuilder = $ queryBuilderProphecy ->reveal ();
185
- $ orderExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal ());
185
+ $ orderExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
186
186
187
187
$ orderExtensionTest ->applyToItem ($ queryBuilder , new QueryNameGenerator (), Dummy::class, []);
188
188
}
@@ -206,7 +206,7 @@ public function testCreateItemWithOperationName()
206
206
$ emProphecy ->getClassMetadata (Dummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
207
207
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
208
208
209
- $ orderExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal ());
209
+ $ orderExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
210
210
$ orderExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class, [], 'item_operation ' );
211
211
}
212
212
@@ -229,15 +229,16 @@ public function testCreateCollectionWithOperationName()
229
229
$ emProphecy ->getClassMetadata (Dummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
230
230
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
231
231
232
- $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal ());
232
+ $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
233
233
$ eagerExtensionTest ->applyToCollection ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class, 'collection_operation ' );
234
234
}
235
235
236
236
public function testDenormalizeItemWithCorrectResourceClass ()
237
237
{
238
238
$ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
239
239
//Dummy is the correct class for the denormalization context serialization groups, and we're fetching RelatedDummy
240
- $ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ());
240
+ $ resourceMetadataFactoryProphecy ->create (RelatedDummy::class)->willReturn (new ResourceMetadata ())->shouldBeCalled ();
241
+ $ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ())->shouldBeCalled ();
241
242
$ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
242
243
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
243
244
@@ -249,14 +250,15 @@ public function testDenormalizeItemWithCorrectResourceClass()
249
250
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
250
251
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
251
252
252
- $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal ());
253
+ $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
253
254
$ eagerExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), RelatedDummy::class, ['id ' => 1 ], 'item_operation ' , ['resource_class ' => Dummy::class]);
254
255
}
255
256
256
257
public function testDenormalizeItemWithExistingGroups ()
257
258
{
258
259
$ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
259
260
//groups exist from the context, we don't need to compute them again
261
+ $ resourceMetadataFactoryProphecy ->create (RelatedDummy::class)->willReturn (new ResourceMetadata ())->shouldBeCalled ();
260
262
$ resourceMetadataFactoryProphecy ->create (Dummy::class)->shouldNotBeCalled ();
261
263
$ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
262
264
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
@@ -269,7 +271,7 @@ public function testDenormalizeItemWithExistingGroups()
269
271
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
270
272
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
271
273
272
- $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal ());
274
+ $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
273
275
$ eagerExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), RelatedDummy::class, ['id ' => 1 ], 'item_operation ' , ['groups ' => 'some_groups ' ]);
274
276
}
275
277
@@ -321,11 +323,11 @@ public function testMaxDepthReached()
321
323
$ queryBuilderProphecy ->innerJoin (Argument::type ('string ' ), Argument::type ('string ' ))->shouldBeCalled ();
322
324
$ queryBuilderProphecy ->addSelect (Argument::type ('string ' ))->shouldBeCalled ();
323
325
324
- $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal ());
326
+ $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
325
327
$ eagerExtensionTest ->applyToCollection ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class);
326
328
}
327
329
328
- public function testFetchNotOnlyEager ()
330
+ public function testForceEager ()
329
331
{
330
332
$ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
331
333
$ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ());
@@ -362,9 +364,7 @@ public function testFetchNotOnlyEager()
362
364
363
365
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled (2 )->willReturn ($ emProphecy ->reveal ());
364
366
365
- $ queryBuilder = $ queryBuilderProphecy ->reveal ();
366
-
367
- $ orderExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
367
+ $ orderExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , true );
368
368
$ orderExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class, []);
369
369
}
370
370
}
0 commit comments