From 70b0f50d13d88f7ecd6edb26798528d342c2c3df Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sat, 2 Oct 2021 17:20:20 +0200 Subject: [PATCH] Add PHP 8.1 to CI (#9006) Signed-off-by: Alexander M. Turek --- .github/workflows/continuous-integration.yml | 6 ++++++ tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index bf30840bacd..9d911483d5a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -19,6 +19,7 @@ jobs: - "7.3" - "7.4" - "8.0" + - "8.1" steps: - name: "Checkout" @@ -34,6 +35,11 @@ jobs: coverage: "pcov" ini-values: "zend.assertions=1" + # To be removed as soon as https://github.com/doctrine/dbal/pull/4818 is released. + - name: "Switch to dev dependencies" + if: "${{ matrix.php-version == '8.1' }}" + run: "composer config minimum-stability dev" + - name: "Install dependencies with Composer" uses: "ramsey/composer-install@v1" diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php index 70c42914997..45b4d28fe1c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php @@ -50,7 +50,9 @@ public function typesShouldBeConvertedForDQLFunctions(): void $result = $query->getSingleResult(); self::assertSame(6, $result['count']); - self::assertSame('325', $result['sales']); + + // While other drivers will return a string, pdo_sqlite returns an integer as of PHP 8.1 + self::assertEquals(325, $result['sales']); // Driver return type and precision is determined by the underlying php extension, most seem to return a string. // pdo_mysql and mysqli both currently return '54.1667' so this is the maximum precision we can assert. @@ -68,7 +70,7 @@ public function typesShouldBeConvertedForDQLFunctions(): void foreach ($query->getResult() as $i => $item) { $product = self::PRODUCTS[$i]; - self::assertSame(ltrim($product['price'], '-'), $item['absolute']); + self::assertEquals(ltrim($product['price'], '-'), $item['absolute']); self::assertSame(strlen($product['name']), $item['length']); // Driver return types for the `square_root` column are inconsistent depending on the underlying