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

PHPUnit / Codeception errors in PHP 8 #1214

Closed
yookoala opened this issue Jan 23, 2021 · 2 comments · Fixed by #1223
Closed

PHPUnit / Codeception errors in PHP 8 #1214

yookoala opened this issue Jan 23, 2021 · 2 comments · Fixed by #1223

Comments

@yookoala
Copy link
Member

yookoala commented Jan 23, 2021

Describe the bug

Ran into this error in PHP 8 testing:

ParseError: syntax error, unexpected token "match", expecting variable

The error is very similar to doctrine/dbal#4197, which is caused by sebastianbergmann/phpunit#4373. In short, an internal programming interface is using the keyword "match". Since PHP 8 introduced the match expression, it has became a reserved word. The solution for PHPUnit is to replace "match" with something else. And the fix (sebastianbergmann/phpunit#4374) was published in PHPUnit 9.3.

As shown in PHPUnit's compatibility table:
2021-01-23 16-30-14 的螢幕擷圖

PHPUnit 9 supports PHP 7.3+, which seems to be the targeted lowest supported PHP version now (?). And if I read it correctly, Codeception/Codeception#6000 is merged into Codeception 4.1.9 so we can expect it to be safe for PHP 8.

To Reproduce

  1. Run the acceptance test suite in PHP 8.0.x environment.
  2. See the error(s).

Expected behavior
All tests should be able to run in PHP 8 environment.

Screenshots
2021-01-23 16-22-04 的螢幕擷圖

Your System

  • PHP 8

Additional context
Blocks #1210.

@yookoala
Copy link
Member Author

Changing the codeception and phpunit version seems to require changes to a lot of libraries in vendor folder. It would be better if #1123 is merged before touching this subject.

@SKuipers
Copy link
Member

Great work! Yes, with our minimum version moving up to PHP 7.3, it'll be great to update our test suite to make use of newer PHPUnit and Codeception versions. I've merged your PRs and everything is looking good, all tests are green 👍 A massive thank you for doing the leg-work on these upgrades.

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

Successfully merging a pull request may close this issue.

2 participants