From 3dbcdfca22c6663becbe4b14a0ec041dbb3f970e Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Fri, 9 Feb 2024 13:05:46 +0100 Subject: [PATCH] Skip tests not working on ORM 3 Related: https://github.com/doctrine/orm/issues/11240 --- .../Query/QueryResultTypeWalkerTest.php | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php b/tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php index 1393a9bc..6ab3ee8c 100644 --- a/tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php +++ b/tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php @@ -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; @@ -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([