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

Test against PHP 8.2 and MongoDB 6.0 #2490

Merged
merged 1 commit into from
Dec 20, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
name: "Coding Standards"
uses: "doctrine/.github/.github/workflows/[email protected]"
with:
php-version: "8.1"
php-version: "8.2"
12 changes: 4 additions & 8 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ jobs:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
mongodb-version:
- "6.0"
- "5.0"
- "4.4"
- "4.2"
- "4.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

4.0 has reached end of life in April 2022, no need to test against it. 4.2 will be gone in April 2023 by the way

driver-version:
- "stable"
topology:
Expand All @@ -34,11 +35,11 @@ jobs:
include:
- dependencies: "lowest"
php-version: "7.4"
mongodb-version: "3.6"
mongodb-version: "4.2"
driver-version: "1.5.0"
topology: "server"
- topology: "sharded_cluster"
php-version: "8.0"
php-version: "8.2"
mongodb-version: "4.4"
driver-version: "stable"
dependencies: "highest"
Expand Down Expand Up @@ -76,11 +77,6 @@ jobs:
- name: "Show driver information"
run: "php --ri mongodb"

# Remove this when laminas/laminas-code 4.5 is released
Copy link
Member Author

Choose a reason for hiding this comment

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

it has been ;)

- name: "Use dev stability"
if: "${{ matrix.php-version == '8.1' }}"
run: composer config minimum-stability dev

# This allows installing symfony/console 3.4 and 6
- name: "Remove phpbench/phpbench"
run: composer remove --no-update --dev phpbench/phpbench
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,5 @@ jobs:
name: composer.lock
path: composer.lock

# https://github.com/doctrine/.github/issues/3
- name: "Run PHP_CodeSniffer"
- name: "Run PHPBench"
run: "vendor/bin/phpbench run --report=default --revs=100 --iterations=5 --report=aggregate"
28 changes: 0 additions & 28 deletions tests/Doctrine/ODM/MongoDB/Tests/Aggregation/Stage/LookupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,34 +278,6 @@ public function testLookupStageReferenceManyStoreAsRef(): void
self::assertSame('malarzm', $result[1]['users'][0]['username']);
}

public function testLookupStageReferenceManyWithoutUnwindMongoDB34(): void
Copy link
Member Author

Choose a reason for hiding this comment

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

This test started failing with MongoDB 6.0. Given is was written specifically for 3.4 it's ok to get rid of it

{
$builder = $this->dm->createAggregationBuilder(SimpleReferenceUser::class);
$builder
->lookup('users')
->alias('users');

$expectedPipeline = [
[
'$lookup' => [
'from' => 'users',
'localField' => 'users',
'foreignField' => '_id',
'as' => 'users',
],
],
];

self::assertEquals($expectedPipeline, $builder->getPipeline());

$result = $builder->execute()->toArray();

self::assertCount(1, $result);
self::assertCount(2, $result[0]['users']);
self::assertSame('alcaeus', $result[0]['users'][0]['username']);
self::assertSame('malarzm', $result[0]['users'][1]['username']);
}

public function testLookupStageReferenceOneInverse(): void
{
$builder = $this->dm->createAggregationBuilder(User::class);
Expand Down
3 changes: 2 additions & 1 deletion tests/Doctrine/ODM/MongoDB/Tests/Functional/EnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use MongoDB\BSON\ObjectId;
use ValueError;

use function preg_quote;
use function sprintf;

/** @requires PHP >= 8.1 */
Expand Down Expand Up @@ -44,7 +45,7 @@ public function testLoadingInvalidBackingValueThrowsError(): void
$this->dm->getDocumentCollection(Card::class)->insertOne($document);

$this->expectException(ValueError::class);
$this->expectExceptionMessage(sprintf('"ABC" is not a valid backing value for enum "%s"', Suit::class));
$this->expectExceptionMessageMatches(sprintf('/^"ABC" is not a valid backing value for enum "?%s"?$/', preg_quote(Suit::class)));
Copy link
Member Author

Choose a reason for hiding this comment

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

Quotes are gone in 8.2

$this->dm->getRepository(Card::class)->findOneBy([]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function testTest(): void

assert(isset($collection[0], $collection[1], $collection[2]));
// place element '0' after '1'
/** @var ArrayCollection<int, MODM29Embedded> $collection */
Copy link
Member Author

Choose a reason for hiding this comment

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

This suddenly made Psalm fail

$collection = new ArrayCollection([
$collection[1],
$collection[0],
Expand Down