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

Rewrite PHPUnit test scaffolding to work with PHP 8.0+ compat code #285

Closed
schlessera opened this issue Mar 25, 2021 · 1 comment · Fixed by #297
Closed

Rewrite PHPUnit test scaffolding to work with PHP 8.0+ compat code #285

schlessera opened this issue Mar 25, 2021 · 1 comment · Fixed by #297

Comments

@schlessera
Copy link
Member

The way the PHPUnit tests are currently being scaffolded does not work with PHP 8.0+:

PHP Parse error:  syntax error, unexpected token "match", expecting identifier in
phar://phpunit/Framework/MockObject/Builder/Match.php on line 15

To fix this, the tests should be scaffolded in such a way that they make use of the WordPress Core compatibility code found in https://core.trac.wordpress.org/changeset/49037. However, that will require a rewrite to make the scaffolded tests rely on PHPUnit being executed as a Composer dev dependency.

@amirhossein-karimi
Copy link

amirhossein-karimi commented May 16, 2022

Just remove
if ( PHP_MAJOR_VERSION >= 8 ) { echo "The scaffolded tests cannot currently be run on PHP 8.0+. See https://github.com/wp-cli/scaffold-command/issues/285" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped exit( 1 ); }
from bootstrap.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants