-
Notifications
You must be signed in to change notification settings - Fork 265
PHPLIB-1502: Test with PHP 8.4 #1484
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
Changes from all commits
a46f253
3e82bd1
57949f1
8b2a763
865f8c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
// Supported PHP versions. Add new versions to the beginning of the list | ||
$modernPhpVersions = [ | ||
'8.4', | ||
'8.3', | ||
'8.2', | ||
'8.1', | ||
|
@@ -13,7 +14,9 @@ | |
]; | ||
$supportedPhpVersions = array_merge($modernPhpVersions, $legacyPhpVersions); | ||
|
||
$latestPhpVersion = max($supportedPhpVersions); | ||
// TODO: use max() once PHP 8.4 is stable | ||
//$latestPhpVersion = max($supportedPhpVersions); | ||
$latestPhpVersion = '8.3'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since PHP 8.4 isn't stable yet, I figured that the extra tests that run on the latest PHP version should continue to run on 8.3 |
||
$lowestPhpVersion = min($supportedPhpVersions); | ||
|
||
// Supported MongoDB versions. Add new versions after "rapid" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,9 @@ php --ri mongodb | |
|
||
install_composer | ||
|
||
# Remove psalm as it's not compatible with PHP 8.4: https://github.com/vimeo/psalm/pull/10928 | ||
if [ "$PHP_VERSION" == "8.4" ]; then | ||
php composer.phar remove --no-update --dev vimeo/psalm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we only run PHPUnit, I decided to explicitly remove the psalm dependency instead of ignoring any upper bounds for PHP version constraints, as that may result in actually incompatible packages being pulled in. |
||
fi | ||
|
||
php composer.phar update $COMPOSER_FLAGS |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -860,6 +860,9 @@ public function testDanglingOpenWritableStream(): void | |
$code = <<<'PHP' | ||
require '%s'; | ||
require '%s'; | ||
// Don't report deprecations - if the issue exists this code will | ||
// result in a fatal error | ||
error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this due to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The deprecation in question is about implicit nullable args in a PHPUnit class, which is loaded when we call |
||
$client = MongoDB\Tests\FunctionalTestCase::createTestClient(); | ||
$database = $client->selectDatabase(getenv('MONGODB_DATABASE') ?: 'phplib_test'); | ||
$gridfs = $database->selectGridFSBucket(); | ||
|
@@ -903,6 +906,9 @@ public function testDanglingOpenWritableStreamWithGlobalStreamWrapperAlias(): vo | |
$code = <<<'PHP' | ||
require '%s'; | ||
require '%s'; | ||
// Don't report deprecations - if the issue exists this code will | ||
// result in a fatal error | ||
error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); | ||
$client = MongoDB\Tests\FunctionalTestCase::createTestClient(); | ||
$database = $client->selectDatabase(getenv('MONGODB_DATABASE') ?: 'phplib_test'); | ||
$database->selectGridFSBucket()->registerGlobalStreamWrapperAlias('alias'); | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -9,7 +9,9 @@ | |||||||||||||||
use stdClass; | ||||||||||||||||
|
||||||||||||||||
use function hex2bin; | ||||||||||||||||
use function phpversion; | ||||||||||||||||
use function preg_quote; | ||||||||||||||||
use function version_compare; | ||||||||||||||||
|
||||||||||||||||
class MatchesTest extends FunctionalTestCase | ||||||||||||||||
{ | ||||||||||||||||
|
@@ -69,6 +71,10 @@ public function testOperatorExists(): void | |||||||||||||||
|
||||||||||||||||
public function testOperatorType(): void | ||||||||||||||||
{ | ||||||||||||||||
if (version_compare(phpversion(), '8.4', '>=')) { | ||||||||||||||||
$this->markTestIncomplete('Test fails on PHP 8.4 due to deprecations'); | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
Comment on lines
+74
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: I prefer using the
Suggested change
But the best is to use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, good point. There's also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be tricky for server version checks as it'd need to use a persistent client connection. But there may be an opportunity there to streamline everything with a service that captures all of that information when PHPUnit is first loaded (fetching the URI from environment variables). |
||||||||||||||||
$c = new Matches(['x' => ['$$type' => 'string']]); | ||||||||||||||||
$this->assertResult(true, $c, ['x' => 'foo'], 'string matches string type'); | ||||||||||||||||
$this->assertResult(false, $c, ['x' => 1], 'integer does not match string type'); | ||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was responsible for Evergreen not exiting with a setup failure when something went wrong. With this change, any error while installing dependencies will cause a setup failure.