PHPLIB-1369 Upgrade to PHPUnit 10#1412
Conversation
4cde98f to
83bd963
Compare
| } | ||
|
|
||
| public function tearDown(): void | ||
| protected function onNotSuccessfulTest(Throwable $t): never |
There was a problem hiding this comment.
Oh, I like this way of handling failed tests 💪
There was a problem hiding this comment.
Available since PHPUnit 3.4 (sebastianbergmann/phpunit@8e6c10c), yet there's no trace of this in the documentation 🤷
|
|
||
| - name: "Run PHPUnit" | ||
| run: "vendor/bin/phpunit -v" | ||
| run: "vendor/bin/phpunit" |
There was a problem hiding this comment.
I was thinking about removing the output of skipped tests, so I agree with this change 👍
There was a problem hiding this comment.
It's also, the -v option isn't available on PHPUnit 10
a453911 to
2f9bed3
Compare
996967e to
08e1870
Compare
jmikola
left a comment
There was a problem hiding this comment.
One question about the Rector config, but everything else LGTM.
| // Modernize code | ||
| $rectorConfig->sets([LevelSetList::UP_TO_PHP_74]); | ||
| $rectorConfig->sets([ | ||
| LevelSetList::UP_TO_PHP_74, |
There was a problem hiding this comment.
Should this have been bumped to PHP 8.1 in 24214b6?
There was a problem hiding this comment.
The PHP 8.1 rules have to be tuned. Some like ReadOnlyPropertyRector and ClassPropertyAssignToConstructorPromotionRector need to be challenged.
https://jira.mongodb.org/browse/PHPLIB-1536
| return; | ||
| } | ||
|
|
||
| $exporter = new Exporter(); |
There was a problem hiding this comment.
Noted that the internal property was removed from the Comparator base class in sebastianbergmann/comparator@bf22fc1
| } | ||
|
|
||
| public function tearDown(): void | ||
| protected function onNotSuccessfulTest(Throwable $t): never |
There was a problem hiding this comment.
Available since PHPUnit 3.4 (sebastianbergmann/phpunit@8e6c10c), yet there's no trace of this in the documentation 🤷
| { | ||
| (new CommandObserver())->observe( | ||
| function () use ($modifiers): void { | ||
| // @todo revert this lines after PHPC-2457 |
There was a problem hiding this comment.
Technically, this should become irrelevant after #1439
| namespace MongoDB\Tests; | ||
|
|
||
| use MongoDB; | ||
| use PHPUnit\Framework\Attributes\DataProvider; |
There was a problem hiding this comment.
Unrelated to this PR, but I'm wondering what use MongoDB; above is used for. Looks like this dates back to eafad05.
There was a problem hiding this comment.
This prevent duplication of class names as use statement and in the SKIPPED_CLASSES list.
| $class = new ReflectionClass($this); | ||
|
|
||
| return sprintf('%s.%s', $class->getShortName(), hash('crc32b', $this->getName())); | ||
| return sprintf('%s.%s', $class->getShortName(), hash('xxh3', $this->name())); |
There was a problem hiding this comment.
Noted: https://xxhash.com/ available since PHP 8.1 (see: hash_algos()).
| $constraint = IsBsonType::anyOf(...(array) $operator['$$type']); | ||
|
|
||
| if (! $constraint->evaluate($actual, '', true)) { | ||
| self::failAt(sprintf('%s is not an expected BSON type: %s', $this->exporter()->shortenedExport($actual), implode(', ', $types)), $keyPath); |
There was a problem hiding this comment.
Noted that $types was never defined. This dates back to 4608a73. Curious that it wasn't caught by static analysis, unless this snuck into the baseline.
* v1.x: (95 commits) PHPLIB-1369 Upgrade to PHPUnit 10 (#1412) Higher phpunit version required (#1463) Fix deprecations in tests (#1458) Deprecate functionality to be removed (#1441) Expect BulkWriteException (#1455) Merge v1.20 into v1.x (#1447) PHPLIB-1525 Removes dependency to Symfony PHPUnit bridge (#1413) Change deprecated assertObjectHasAttribute to assertObjectHasProperty (#1432) Performance: Keep collections and indexes between GridFS tests (#1421) Add final annotations to non-internal Operation classes (#1410) Fix types accepted by $round (#1401) Replace arrayHasKey with assertArrayHasKey in tests (#1403) PHPLIB-1514 Make data providers static (#1404) PHPLIB-1515 Replace assertObjectHasAttribute with assertObjectHasProperty (#1405) Restore Prose22_RangeExplicitEncryptionTest (#1400) Remove Prose22_RangeExplicitEncryptionTest that requires ext-mongodb < 1.20 (#1394) Use `match` instead of `switch` when a simple value is returned (#1393) Remove PHPUnit functions polyfill (#1395) Update branch names for GHA workflows (#1390) PHPLIB-1419 Encode Agg builder objects in Collection methods (#1383) ...
* v1.x: (101 commits) PHPLIB-1541: Include specs repository as a submodule (#1429) PHPLIB-1548 Inherit `typeMap` option in `Collection::listSearchIndexes()` (#1482) Fix array shape for `Collection::listSearchIndex($options)` (#1480) PHPLIB-1545: Deprecate CreateCollection flags option and related constants (#1477) Fix junit logging (#1475) Deprecate typeMap on operations without meaningful result (#1473) PHPLIB-1369 Upgrade to PHPUnit 10 (#1412) Higher phpunit version required (#1463) Fix deprecations in tests (#1458) Deprecate functionality to be removed (#1441) Expect BulkWriteException (#1455) Merge v1.20 into v1.x (#1447) PHPLIB-1525 Removes dependency to Symfony PHPUnit bridge (#1413) Change deprecated assertObjectHasAttribute to assertObjectHasProperty (#1432) Performance: Keep collections and indexes between GridFS tests (#1421) Add final annotations to non-internal Operation classes (#1410) Fix types accepted by $round (#1401) Replace arrayHasKey with assertArrayHasKey in tests (#1403) PHPLIB-1514 Make data providers static (#1404) PHPLIB-1515 Replace assertObjectHasAttribute with assertObjectHasProperty (#1405) ...
Fix PHPLIB-1369
@annotationsto#[Attributes]hasFailedwith the methodonNotSuccessfulTestinFunctionalTestCasecreateStubingetInvalidDocumentCodecValuesTestCase::exporter()is deprecated andComparisonFailure5th argument was removed)