Skip to content

Commit 1dd6fd7

Browse files
committed
Tests not to fail on PHP 8 and below
1 parent 1a72c65 commit 1dd6fd7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,13 @@ public function test(
241241
$result = $query->getResult();
242242
self::assertGreaterThan(0, count($result));
243243

244+
$expectedTypesForRealResultCheck = [$expectedTypeWithStringify];
245+
if (PHP_VERSION_ID >= 80125) { // before this version, you always get stringified results (https://github.com/php/php-src/blob/php-8.1.25/UPGRADING#L122-L139)
246+
$expectedTypesForRealResultCheck[] = $expectedTypeWithoutStringify;
247+
}
248+
244249
foreach ($result as $row) {
245-
foreach ([$expectedTypeWithStringify, $expectedTypeWithoutStringify] as $type) {
250+
foreach ($expectedTypesForRealResultCheck as $type) {
246251
$rowType = ConstantTypeHelper::getTypeFromValue($row);
247252
self::assertTrue(
248253
$type->accepts($rowType, true)->yes(),

0 commit comments

Comments
 (0)