31
31
use Doctrine \Common \Persistence \ObjectRepository ;
32
32
use Doctrine \DBAL \Connection ;
33
33
use Doctrine \DBAL \Platforms \AbstractPlatform ;
34
+ use Doctrine \DBAL \Types \Type as DBALType ;
34
35
use Doctrine \ORM \AbstractQuery ;
35
36
use Doctrine \ORM \EntityManager ;
36
37
use Doctrine \ORM \EntityRepository ;
@@ -123,7 +124,7 @@ public function testGetSubresource()
123
124
124
125
$ identifiers = ['id ' ];
125
126
$ queryBuilder = $ this ->prophesize (QueryBuilder::class);
126
- $ queryBuilder ->setParameter ('id_p1 ' , 1 )->shouldBeCalled ()->willReturn ($ queryBuilder );
127
+ $ queryBuilder ->setParameter ('id_p1 ' , 1 , DBALType:: INTEGER )->shouldBeCalled ()->willReturn ($ queryBuilder );
127
128
$ funcProphecy = $ this ->prophesize (Func::class);
128
129
$ func = $ funcProphecy ->reveal ();
129
130
@@ -141,6 +142,7 @@ public function testGetSubresource()
141
142
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
142
143
$ classMetadataProphecy ->hasAssociation ('relatedDummies ' )->willReturn (true )->shouldBeCalled ();
143
144
$ classMetadataProphecy ->getAssociationMapping ('relatedDummies ' )->shouldBeCalled ()->willReturn (['type ' => ClassMetadata::MANY_TO_MANY ]);
145
+ $ classMetadataProphecy ->getTypeOfField ('id ' )->willReturn (DBALType::INTEGER )->shouldBeCalled ();
144
146
145
147
$ managerProphecy ->getClassMetadata (Dummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
146
148
@@ -199,6 +201,7 @@ public function testGetSubSubresourceItem()
199
201
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
200
202
$ classMetadataProphecy ->hasAssociation ('relatedDummies ' )->willReturn (true )->shouldBeCalled ();
201
203
$ classMetadataProphecy ->getAssociationMapping ('relatedDummies ' )->shouldBeCalled ()->willReturn (['type ' => ClassMetadata::MANY_TO_MANY ]);
204
+ $ classMetadataProphecy ->getTypeOfField ('id ' )->willReturn (DBALType::INTEGER )->shouldBeCalled ();
202
205
203
206
$ dummyManagerProphecy = $ this ->prophesize (EntityManager::class);
204
207
$ dummyManagerProphecy ->createQueryBuilder ()->shouldBeCalled ()->willReturn ($ qb ->reveal ());
@@ -225,6 +228,7 @@ public function testGetSubSubresourceItem()
225
228
$ rClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
226
229
$ rClassMetadataProphecy ->hasAssociation ('thirdLevel ' )->shouldBeCalled ()->willReturn (true );
227
230
$ rClassMetadataProphecy ->getAssociationMapping ('thirdLevel ' )->shouldBeCalled ()->willReturn (['type ' => ClassMetadata::MANY_TO_ONE ]);
231
+ $ rClassMetadataProphecy ->getTypeOfField ('id ' )->willReturn (DBALType::INTEGER )->shouldBeCalled ();
228
232
229
233
$ rDummyManagerProphecy = $ this ->prophesize (EntityManager::class);
230
234
$ rDummyManagerProphecy ->createQueryBuilder ()->shouldBeCalled ()->willReturn ($ rqb ->reveal ());
@@ -243,8 +247,8 @@ public function testGetSubSubresourceItem()
243
247
$ queryBuilder ->andWhere ($ func )->shouldBeCalled ()->willReturn ($ queryBuilder );
244
248
245
249
$ queryBuilder ->getQuery ()->shouldBeCalled ()->willReturn ($ queryProphecy ->reveal ());
246
- $ queryBuilder ->setParameter ('id_p1 ' , 1 )->shouldBeCalled ()->willReturn ($ queryBuilder );
247
- $ queryBuilder ->setParameter ('id_p2 ' , 1 )->shouldBeCalled ()->willReturn ($ queryBuilder );
250
+ $ queryBuilder ->setParameter ('id_p1 ' , 1 , DBALType:: INTEGER )->shouldBeCalled ()->willReturn ($ queryBuilder );
251
+ $ queryBuilder ->setParameter ('id_p2 ' , 1 , DBALType:: INTEGER )->shouldBeCalled ()->willReturn ($ queryBuilder );
248
252
249
253
$ repositoryProphecy = $ this ->prophesize (EntityRepository::class);
250
254
$ repositoryProphecy ->createQueryBuilder ('o ' )->shouldBeCalled ()->willReturn ($ queryBuilder ->reveal ());
@@ -269,7 +273,7 @@ public function testQueryResultExtension()
269
273
270
274
$ identifiers = ['id ' ];
271
275
$ queryBuilder = $ this ->prophesize (QueryBuilder::class);
272
- $ queryBuilder ->setParameter ('id_p1 ' , 1 )->shouldBeCalled ()->willReturn ($ queryBuilder );
276
+ $ queryBuilder ->setParameter ('id_p1 ' , 1 , DBALType:: INTEGER )->shouldBeCalled ()->willReturn ($ queryBuilder );
273
277
$ funcProphecy = $ this ->prophesize (Func::class);
274
278
$ func = $ funcProphecy ->reveal ();
275
279
@@ -285,6 +289,7 @@ public function testQueryResultExtension()
285
289
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
286
290
$ classMetadataProphecy ->hasAssociation ('relatedDummies ' )->willReturn (true )->shouldBeCalled ();
287
291
$ classMetadataProphecy ->getAssociationMapping ('relatedDummies ' )->shouldBeCalled ()->willReturn (['type ' => ClassMetadata::MANY_TO_MANY ]);
292
+ $ classMetadataProphecy ->getTypeOfField ('id ' )->willReturn (DBALType::INTEGER )->shouldBeCalled ();
288
293
289
294
$ managerProphecy ->getClassMetadata (Dummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
290
295
$ this ->assertIdentifierManagerMethodCalls ($ managerProphecy );
@@ -386,9 +391,9 @@ public function testGetSubSubresourceItemLegacy()
386
391
387
392
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
388
393
$ classMetadataProphecy ->getIdentifier ()->shouldBeCalled ()->willReturn ($ identifiers );
389
- $ classMetadataProphecy ->getTypeOfField ('id ' )->shouldBeCalled ()->willReturn ('integer ' );
390
394
$ classMetadataProphecy ->hasAssociation ('relatedDummies ' )->willReturn (true )->shouldBeCalled ();
391
395
$ classMetadataProphecy ->getAssociationMapping ('relatedDummies ' )->shouldBeCalled ()->willReturn (['type ' => ClassMetadata::MANY_TO_MANY ]);
396
+ $ classMetadataProphecy ->getTypeOfField ('id ' )->shouldBeCalled ()->willReturn (DBALType::INTEGER );
392
397
393
398
$ dummyManagerProphecy = $ this ->prophesize (EntityManager::class);
394
399
$ dummyManagerProphecy ->createQueryBuilder ()->shouldBeCalled ()->willReturn ($ qb ->reveal ());
@@ -414,7 +419,7 @@ public function testGetSubSubresourceItemLegacy()
414
419
415
420
$ rClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
416
421
$ rClassMetadataProphecy ->getIdentifier ()->shouldBeCalled ()->willReturn ($ identifiers );
417
- $ rClassMetadataProphecy ->getTypeOfField ('id ' )->shouldBeCalled ()->willReturn (' integer ' );
422
+ $ rClassMetadataProphecy ->getTypeOfField ('id ' )->shouldBeCalled ()->willReturn (DBALType:: INTEGER );
418
423
$ rClassMetadataProphecy ->hasAssociation ('thirdLevel ' )->shouldBeCalled ()->willReturn (true );
419
424
$ rClassMetadataProphecy ->getAssociationMapping ('thirdLevel ' )->shouldBeCalled ()->willReturn (['type ' => ClassMetadata::MANY_TO_ONE ]);
420
425
@@ -435,8 +440,8 @@ public function testGetSubSubresourceItemLegacy()
435
440
$ queryBuilder ->andWhere ($ func )->shouldBeCalled ()->willReturn ($ queryBuilder );
436
441
437
442
$ queryBuilder ->getQuery ()->shouldBeCalled ()->willReturn ($ queryProphecy ->reveal ());
438
- $ queryBuilder ->setParameter ('id_p1 ' , 1 )->shouldBeCalled ()->willReturn ($ queryBuilder );
439
- $ queryBuilder ->setParameter ('id_p2 ' , 1 )->shouldBeCalled ()->willReturn ($ queryBuilder );
443
+ $ queryBuilder ->setParameter ('id_p1 ' , 1 , DBALType:: INTEGER )->shouldBeCalled ()->willReturn ($ queryBuilder );
444
+ $ queryBuilder ->setParameter ('id_p2 ' , 1 , DBALType:: INTEGER )->shouldBeCalled ()->willReturn ($ queryBuilder );
440
445
441
446
$ repositoryProphecy = $ this ->prophesize (EntityRepository::class);
442
447
$ repositoryProphecy ->createQueryBuilder ('o ' )->shouldBeCalled ()->willReturn ($ queryBuilder ->reveal ());
@@ -483,6 +488,7 @@ public function testGetSubresourceCollectionItem()
483
488
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
484
489
$ classMetadataProphecy ->hasAssociation ('relatedDummies ' )->willReturn (true )->shouldBeCalled ();
485
490
$ classMetadataProphecy ->getAssociationMapping ('relatedDummies ' )->shouldBeCalled ()->willReturn (['type ' => ClassMetadata::MANY_TO_MANY ]);
491
+ $ classMetadataProphecy ->getTypeOfField ('id ' )->shouldBeCalled ()->willReturn (DBALType::INTEGER );
486
492
487
493
$ dummyManagerProphecy = $ this ->prophesize (EntityManager::class);
488
494
$ dummyManagerProphecy ->createQueryBuilder ()->shouldBeCalled ()->willReturn ($ qb ->reveal ());
@@ -509,6 +515,7 @@ public function testGetSubresourceCollectionItem()
509
515
$ rClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
510
516
$ rClassMetadataProphecy ->hasAssociation ('id ' )->shouldBeCalled ()->willReturn (false );
511
517
$ rClassMetadataProphecy ->isIdentifier ('id ' )->shouldBeCalled ()->willReturn (true );
518
+ $ rClassMetadataProphecy ->getTypeOfField ('id ' )->shouldBeCalled ()->willReturn (DBALType::INTEGER );
512
519
513
520
$ rDummyManagerProphecy = $ this ->prophesize (EntityManager::class);
514
521
$ rDummyManagerProphecy ->createQueryBuilder ()->shouldBeCalled ()->willReturn ($ rqb ->reveal ());
@@ -526,8 +533,8 @@ public function testGetSubresourceCollectionItem()
526
533
$ queryBuilder ->andWhere ($ func )->shouldBeCalled ()->willReturn ($ queryBuilder );
527
534
528
535
$ queryBuilder ->getQuery ()->shouldBeCalled ()->willReturn ($ queryProphecy ->reveal ());
529
- $ queryBuilder ->setParameter ('id_p1 ' , 2 )->shouldBeCalled ()->willReturn ($ queryBuilder );
530
- $ queryBuilder ->setParameter ('id_p2 ' , 1 )->shouldBeCalled ()->willReturn ($ queryBuilder );
536
+ $ queryBuilder ->setParameter ('id_p1 ' , 2 , DBALType:: INTEGER )->shouldBeCalled ()->willReturn ($ queryBuilder );
537
+ $ queryBuilder ->setParameter ('id_p2 ' , 1 , DBALType:: INTEGER )->shouldBeCalled ()->willReturn ($ queryBuilder );
531
538
532
539
$ repositoryProphecy = $ this ->prophesize (EntityRepository::class);
533
540
$ repositoryProphecy ->createQueryBuilder ('o ' )->shouldBeCalled ()->willReturn ($ queryBuilder ->reveal ());
0 commit comments