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

[2.1] Fix PHP 8 unit test GHA job #6533

Merged
merged 19 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
38 changes: 0 additions & 38 deletions bin/ci/after-wp-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,41 +42,3 @@ if [[ -n $INSTALL_PWA_PLUGIN ]]; then
unzip -d "$WP_CORE_DIR/src/wp-content/plugins/" "$WP_CORE_DIR/src/wp-content/plugins/pwa.zip"
echo "done"
fi

if [[ $(php -r "echo PHP_VERSION;") == 8.0* ]]; then
echo "Installing compatible PHPUnit for use with PHP 8..."

DIFF=$(
cat <<-EOF
diff --git a/composer.json b/composer.json
index 5934aedec..2977df4a9 100644
--- a/composer.json
+++ b/composer.json
@@ -86,7 +86,17 @@
],
"files": [
"tests/php/register-wp-cli-commands.php",
- "docs/includes/register-wp-cli-commands.php"
+ "docs/includes/register-wp-cli-commands.php",
+ "${WP_TESTS_DIR}/includes/phpunit7/MockObject/Builder/NamespaceMatch.php",
+ "${WP_TESTS_DIR}/includes/phpunit7/MockObject/Builder/ParametersMatch.php",
+ "${WP_TESTS_DIR}/includes/phpunit7/MockObject/InvocationMocker.php",
+ "${WP_TESTS_DIR}/includes/phpunit7/MockObject/MockMethod.php"
+ ],
+ "exclude-from-classmap": [
+ "vendor/phpunit/phpunit/src/Framework/MockObject/Builder/NamespaceMatch.php",
+ "vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php",
+ "vendor/phpunit/phpunit/src/Framework/MockObject/InvocationMocker.php",
+ "vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php"
]
},
"repositories": [
EOF
)

echo "${DIFF}" | git apply -
composer require --dev --ignore-platform-reqs --update-with-dependencies phpunit/phpunit:^7.5

PATH="$(composer config bin-dir --absolute):$PATH"
echo "done"
fi
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
"php-stubs/wordpress-stubs": "^5.3.2",
"phpcompatibility/phpcompatibility-wp": "2.1.1",
"phpdocumentor/reflection": "~3.0",
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5",
"roave/security-advisories": "dev-latest",
"sirbrillig/phpcs-variable-analysis": "2.11.0",
"wp-cli/export-command": "^2.0",
"wp-cli/extension-command": "^2.0",
"wp-cli/wp-cli": "^2.4",
"wp-cli/wp-cli-tests": "^3.0.11",
"wp-coding-standards/wpcs": "2.3.0"
"wp-coding-standards/wpcs": "2.3.0",
"yoast/wp-test-utils": "^0.2.2"
},
"suggest": {
"ext-intl": "Enables use of idn_to_utf8() to convert punycode domains to UTF-8 for use with an AMP Cache.",
Expand All @@ -58,6 +58,9 @@
}
},
"patches": {
"phpunit/phpunit-mock-objects": {
"Fix ReflectionParameter warnings on PHP 8": "patches/phpunit-mock-objects.patch"
},
"sabberworm/php-css-parser": {
"1. Add additional validation for size unit <https://github.com/sabberworm/PHP-CSS-Parser/pull/193>": "https://github.com/sabberworm/PHP-CSS-Parser/compare/3bc5ded67d77a52b81608cfc97f23b1bb0678e2f%5E...468da3441945e9c1bf402a3340b1d8326723f7d9.patch",
"2. Validate name-start code points for identifier <https://github.com/sabberworm/PHP-CSS-Parser/pull/185>": "https://github.com/sabberworm/PHP-CSS-Parser/compare/d42b64793f2edaffeb663c63e9de79069cdc0831%5E...113df5d55e94e21c6402021dfa959924941d4c29.patch",
Expand Down
Loading