Skip to content

Commit

Permalink
Skip tests not working on ORM 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 9, 2024
1 parent e56223f commit 231392d
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
use function count;
use function property_exists;
use function sprintf;
use function strpos;
use function version_compare;
use const PHP_VERSION_ID;

Expand Down Expand Up @@ -1176,37 +1177,41 @@ public function getTestData(): iterable
',
];

yield 'date_add function' => [
$this->constantArray([
[new ConstantIntegerType(1), new StringType()],
[new ConstantIntegerType(2), TypeCombinator::addNull(new StringType())],
[new ConstantIntegerType(3), TypeCombinator::addNull(new StringType())],
[new ConstantIntegerType(4), new StringType()],
]),
'
$ormVersion = InstalledVersions::getVersion('doctrine/orm');
$hasOrm3 = strpos($ormVersion, '3.0') === 0;
if (!$hasOrm3) {
yield 'date_add function' => [
$this->constantArray([
[new ConstantIntegerType(1), new StringType()],
[new ConstantIntegerType(2), TypeCombinator::addNull(new StringType())],
[new ConstantIntegerType(3), TypeCombinator::addNull(new StringType())],
[new ConstantIntegerType(4), new StringType()],
]),
'
SELECT DATE_ADD(m.datetimeColumn, m.intColumn, \'day\'),
DATE_ADD(m.stringNullColumn, m.intColumn, \'day\'),
DATE_ADD(m.datetimeColumn, NULLIF(m.intColumn, 1), \'day\'),
DATE_ADD(\'2020-01-01\', 7, \'day\')
FROM QueryResult\Entities\Many m
',
];
];

yield 'date_sub function' => [
$this->constantArray([
[new ConstantIntegerType(1), new StringType()],
[new ConstantIntegerType(2), TypeCombinator::addNull(new StringType())],
[new ConstantIntegerType(3), TypeCombinator::addNull(new StringType())],
[new ConstantIntegerType(4), new StringType()],
]),
'
yield 'date_sub function' => [
$this->constantArray([
[new ConstantIntegerType(1), new StringType()],
[new ConstantIntegerType(2), TypeCombinator::addNull(new StringType())],
[new ConstantIntegerType(3), TypeCombinator::addNull(new StringType())],
[new ConstantIntegerType(4), new StringType()],
]),
'
SELECT DATE_SUB(m.datetimeColumn, m.intColumn, \'day\'),
DATE_SUB(m.stringNullColumn, m.intColumn, \'day\'),
DATE_SUB(m.datetimeColumn, NULLIF(m.intColumn, 1), \'day\'),
DATE_SUB(\'2020-01-01\', 7, \'day\')
FROM QueryResult\Entities\Many m
',
];
];
}

yield 'date_diff function' => [
$this->constantArray([
Expand Down

0 comments on commit 231392d

Please sign in to comment.