Skip to content

Commit d32e399

Browse files
committed
Fix more tests on ORM 3
1 parent 231392d commit d32e399

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ public function test(Type $expectedType, string $dql, ?string $expectedException
239239
*/
240240
public function getTestData(): iterable
241241
{
242+
$ormVersion = InstalledVersions::getVersion('doctrine/orm');
243+
$hasOrm3 = strpos($ormVersion, '3.') === 0;
244+
245+
$dbalVersion = InstalledVersions::getVersion('doctrine/dbal');
246+
$hasDbal4 = strpos($dbalVersion, '4.') === 0;
247+
242248
yield 'just root entity' => [
243249
new ObjectType(One::class),
244250
'
@@ -355,7 +361,7 @@ public function getTestData(): iterable
355361
]),
356362
$this->constantArray([
357363
[new ConstantIntegerType(0), new ObjectType(One::class)],
358-
[new ConstantStringType('id'), $this->numericString()],
364+
[new ConstantStringType('id'), $hasDbal4 ? new IntegerType() : $this->numericString()],
359365
[new ConstantStringType('intColumn'), new IntegerType()],
360366
])
361367
),
@@ -377,7 +383,7 @@ public function getTestData(): iterable
377383
]),
378384
$this->constantArray([
379385
[new ConstantIntegerType(0), new ObjectType(Many::class)],
380-
[new ConstantStringType('id'), $this->numericString()],
386+
[new ConstantStringType('id'), $hasDbal4 ? new IntegerType() : $this->numericString()],
381387
[new ConstantStringType('intColumn'), new IntegerType()],
382388
])
383389
),
@@ -398,7 +404,7 @@ public function getTestData(): iterable
398404
]),
399405
$this->constantArray([
400406
[new ConstantStringType('one'), new ObjectType(One::class)],
401-
[new ConstantStringType('id'), $this->numericString()],
407+
[new ConstantStringType('id'), $hasDbal4 ? new IntegerType() : $this->numericString()],
402408
[new ConstantStringType('intColumn'), new IntegerType()],
403409
])
404410
),
@@ -508,7 +514,7 @@ public function getTestData(): iterable
508514
yield 'just root entity and scalars' => [
509515
$this->constantArray([
510516
[new ConstantIntegerType(0), new ObjectType(One::class)],
511-
[new ConstantStringType('id'), $this->numericString()],
517+
[new ConstantStringType('id'), $hasDbal4 ? new IntegerType() : $this->numericString()],
512518
]),
513519
'
514520
SELECT o, o.id
@@ -1177,8 +1183,6 @@ public function getTestData(): iterable
11771183
',
11781184
];
11791185

1180-
$ormVersion = InstalledVersions::getVersion('doctrine/orm');
1181-
$hasOrm3 = strpos($ormVersion, '3.0') === 0;
11821186
if (!$hasOrm3) {
11831187
yield 'date_add function' => [
11841188
$this->constantArray([

0 commit comments

Comments
 (0)