Skip to content

Commit

Permalink
Fix more tests on ORM 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 9, 2024
1 parent 231392d commit d32e399
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ public function test(Type $expectedType, string $dql, ?string $expectedException
*/
public function getTestData(): iterable
{
$ormVersion = InstalledVersions::getVersion('doctrine/orm');
$hasOrm3 = strpos($ormVersion, '3.') === 0;

$dbalVersion = InstalledVersions::getVersion('doctrine/dbal');
$hasDbal4 = strpos($dbalVersion, '4.') === 0;

yield 'just root entity' => [
new ObjectType(One::class),
'
Expand Down Expand Up @@ -355,7 +361,7 @@ public function getTestData(): iterable
]),
$this->constantArray([
[new ConstantIntegerType(0), new ObjectType(One::class)],
[new ConstantStringType('id'), $this->numericString()],
[new ConstantStringType('id'), $hasDbal4 ? new IntegerType() : $this->numericString()],
[new ConstantStringType('intColumn'), new IntegerType()],
])
),
Expand All @@ -377,7 +383,7 @@ public function getTestData(): iterable
]),
$this->constantArray([
[new ConstantIntegerType(0), new ObjectType(Many::class)],
[new ConstantStringType('id'), $this->numericString()],
[new ConstantStringType('id'), $hasDbal4 ? new IntegerType() : $this->numericString()],
[new ConstantStringType('intColumn'), new IntegerType()],
])
),
Expand All @@ -398,7 +404,7 @@ public function getTestData(): iterable
]),
$this->constantArray([
[new ConstantStringType('one'), new ObjectType(One::class)],
[new ConstantStringType('id'), $this->numericString()],
[new ConstantStringType('id'), $hasDbal4 ? new IntegerType() : $this->numericString()],
[new ConstantStringType('intColumn'), new IntegerType()],
])
),
Expand Down Expand Up @@ -508,7 +514,7 @@ public function getTestData(): iterable
yield 'just root entity and scalars' => [
$this->constantArray([
[new ConstantIntegerType(0), new ObjectType(One::class)],
[new ConstantStringType('id'), $this->numericString()],
[new ConstantStringType('id'), $hasDbal4 ? new IntegerType() : $this->numericString()],
]),
'
SELECT o, o.id
Expand Down Expand Up @@ -1177,8 +1183,6 @@ public function getTestData(): iterable
',
];

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

0 comments on commit d32e399

Please sign in to comment.