14
14
use ApiPlatform \Core \Bridge \Doctrine \Orm \Extension \EagerLoadingExtension ;
15
15
use ApiPlatform \Core \Bridge \Doctrine \Orm \Util \QueryNameGenerator ;
16
16
use ApiPlatform \Core \Metadata \Property \Factory \PropertyMetadataFactoryInterface ;
17
- use ApiPlatform \Core \Metadata \Property \Factory \PropertyNameCollectionFactoryInterface ;
18
17
use ApiPlatform \Core \Metadata \Property \PropertyMetadata ;
19
18
use ApiPlatform \Core \Metadata \Resource \Factory \ResourceMetadataFactoryInterface ;
20
19
use ApiPlatform \Core \Metadata \Resource \ResourceMetadata ;
@@ -37,8 +36,6 @@ public function testApplyToCollection()
37
36
$ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
38
37
$ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ());
39
38
40
- $ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
41
-
42
39
$ relationPropertyMetadata = new PropertyMetadata ();
43
40
$ relationPropertyMetadata = $ relationPropertyMetadata ->withReadableLink (true );
44
41
@@ -64,7 +61,7 @@ public function testApplyToCollection()
64
61
$ queryBuilderProphecy ->innerJoin ('o.relatedDummy2 ' , 'a11 ' )->shouldBeCalled (1 );
65
62
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled (2 )->willReturn ($ emProphecy ->reveal ());
66
63
67
- $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy -> reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
64
+ $ eagerExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
68
65
$ eagerExtensionTest ->applyToCollection ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class);
69
66
}
70
67
@@ -73,8 +70,6 @@ public function testApplyToItem()
73
70
$ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
74
71
$ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ());
75
72
76
- $ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
77
-
78
73
$ relationPropertyMetadata = new PropertyMetadata ();
79
74
$ relationPropertyMetadata = $ relationPropertyMetadata ->withReadableLink (true );
80
75
@@ -116,7 +111,7 @@ public function testApplyToItem()
116
111
$ queryBuilderProphecy ->leftJoin ('o.relatedDummy4 ' , 'a11233 ' )->shouldBeCalled (1 );
117
112
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled (2 )->willReturn ($ emProphecy ->reveal ());
118
113
119
- $ orderExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy -> reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
114
+ $ orderExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
120
115
$ orderExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class, []);
121
116
}
122
117
@@ -125,8 +120,6 @@ public function testCreateItemWithOperationName()
125
120
$ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
126
121
$ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ());
127
122
128
- $ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
129
-
130
123
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
131
124
$ propertyMetadataFactoryProphecy ->create (Dummy::class, 'foo ' , ['item_operation_name ' => 'item_operation ' ])->shouldBeCalled ()->willReturn (new PropertyMetadata ());
132
125
@@ -141,7 +134,7 @@ public function testCreateItemWithOperationName()
141
134
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
142
135
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
143
136
144
- $ orderExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy -> reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
137
+ $ orderExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
145
138
$ orderExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class, [], 'item_operation ' );
146
139
}
147
140
@@ -150,8 +143,6 @@ public function testCreateCollectionWithOperationName()
150
143
$ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
151
144
$ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ());
152
145
153
- $ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
154
-
155
146
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
156
147
$ propertyMetadataFactoryProphecy ->create (Dummy::class, 'foo ' , ['collection_operation_name ' => 'collection_operation ' ])->shouldBeCalled ()->willReturn (new PropertyMetadata ());
157
148
@@ -166,7 +157,7 @@ public function testCreateCollectionWithOperationName()
166
157
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
167
158
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
168
159
169
- $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy -> reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
160
+ $ eagerExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
170
161
$ eagerExtensionTest ->applyToCollection ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class, 'collection_operation ' );
171
162
}
172
163
@@ -177,8 +168,6 @@ public function testDenormalizeItemWithCorrectResourceClass()
177
168
$ resourceMetadataFactoryProphecy ->create (RelatedDummy::class)->willReturn (new ResourceMetadata ())->shouldBeCalled ();
178
169
$ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ())->shouldBeCalled ();
179
170
180
- $ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
181
-
182
171
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
183
172
184
173
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
@@ -190,7 +179,7 @@ public function testDenormalizeItemWithCorrectResourceClass()
190
179
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
191
180
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
192
181
193
- $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy -> reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
182
+ $ eagerExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
194
183
$ eagerExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), RelatedDummy::class, ['id ' => 1 ], 'item_operation ' , ['resource_class ' => Dummy::class]);
195
184
}
196
185
@@ -201,8 +190,6 @@ public function testDenormalizeItemWithExistingGroups()
201
190
$ resourceMetadataFactoryProphecy ->create (RelatedDummy::class)->willReturn (new ResourceMetadata ())->shouldBeCalled ();
202
191
$ resourceMetadataFactoryProphecy ->create (Dummy::class)->shouldNotBeCalled ();
203
192
204
- $ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
205
-
206
193
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
207
194
208
195
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
@@ -214,7 +201,7 @@ public function testDenormalizeItemWithExistingGroups()
214
201
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
215
202
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
216
203
217
- $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy -> reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
204
+ $ eagerExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
218
205
$ eagerExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), RelatedDummy::class, ['id ' => 1 ], 'item_operation ' , ['groups ' => 'some_groups ' ]);
219
206
}
220
207
@@ -227,8 +214,6 @@ public function testMaxDepthReached()
227
214
$ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
228
215
$ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ());
229
216
230
- $ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
231
-
232
217
$ relationPropertyMetadata = new PropertyMetadata ();
233
218
$ relationPropertyMetadata = $ relationPropertyMetadata ->withReadableLink (true );
234
219
@@ -257,7 +242,7 @@ public function testMaxDepthReached()
257
242
$ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy ->reveal ());
258
243
$ queryBuilderProphecy ->innerJoin (Argument::type ('string ' ), Argument::type ('string ' ))->shouldBeCalled ();
259
244
260
- $ eagerExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy -> reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
245
+ $ eagerExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
261
246
$ eagerExtensionTest ->applyToCollection ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class);
262
247
}
263
248
@@ -266,8 +251,6 @@ public function testForceEager()
266
251
$ resourceMetadataFactoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
267
252
$ resourceMetadataFactoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ());
268
253
269
- $ propertyNameCollectionFactoryProphecy = $ this ->prophesize (PropertyNameCollectionFactoryInterface::class);
270
-
271
254
$ relationPropertyMetadata = new PropertyMetadata ();
272
255
$ relationPropertyMetadata = $ relationPropertyMetadata ->withReadableLink (true );
273
256
@@ -290,7 +273,7 @@ public function testForceEager()
290
273
$ queryBuilderProphecy ->innerJoin ('o.relation ' , 'a0 ' )->shouldBeCalled (1 );
291
274
$ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled (2 )->willReturn ($ emProphecy ->reveal ());
292
275
293
- $ orderExtensionTest = new EagerLoadingExtension ($ propertyNameCollectionFactoryProphecy -> reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , true );
276
+ $ orderExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , true );
294
277
$ orderExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class, []);
295
278
}
296
279
}
0 commit comments