Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP 8.1 to CI #9006

Merged
merged 1 commit into from
Oct 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- "7.3"
- "7.4"
- "8.0"
- "8.1"

steps:
- name: "Checkout"
Expand All @@ -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"

derrabus marked this conversation as resolved.
Show resolved Hide resolved
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"

Expand Down
6 changes: 4 additions & 2 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason to lower strictness for this assert?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type returned by the database driver is beyond our control. In PHP 8.1, various PDO drivers have become more type-aware and return integers and floats where we've received a string previously.

self::assertSame(strlen($product['name']), $item['length']);

// Driver return types for the `square_root` column are inconsistent depending on the underlying
Expand Down