WordPress / plugin-check

A repository for the new Plugin Check plugin from the WordPress Performance and Plugins Team.
https://wordpress.org/plugins/plugin-check/
GNU General Public License v2.0
198 stars 39 forks source link

Debug PHP 8 Behat test issue #377

Closed mukeshpanchal27 closed 5 months ago

mukeshpanchal27 commented 6 months ago

It seems that after the merge of commit https://github.com/WordPress/plugin-check/commit/eb3f847f7fc9f6b1ec124f1ab174e6b357d18796, the Behat test for PHP 8 is expected to fail.

Further discussion on this matter can be found here: https://github.com/WordPress/plugin-check/pull/367#issuecomment-1880731913.

ernilambar commented 5 months ago

When I try to run behat test in local (PHP 8.0). I get following PHP notices. But not sure this is the actual cause as in the end, test is passed successfully.

Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/nilambarsharma/Sites/audit/app/public/wp-content/plugins/plugin-check/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php on line 230
PHP Deprecated:  Method ReflectionParameter::getClass() is deprecated in /Users/nilambarsharma/Sites/audit/app/public/wp-content/plugins/plugin-check/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php on line 230

Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/nilambarsharma/Sites/audit/app/public/wp-content/plugins/plugin-check/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php on line 230
PHP Deprecated:  Method ReflectionParameter::getClass() is deprecated in /Users/nilambarsharma/Sites/audit/app/public/wp-content/plugins/plugin-check/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php on line 230

Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/nilambarsharma/Sites/audit/app/public/wp-content/plugins/plugin-check/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php on line 230
.PHP Deprecated:  Method ReflectionParameter::getClass() is deprecated in /Users/nilambarsharma/Sites/audit/app/public/wp-content/plugins/plugin-check/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php on line 142

Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/nilambarsharma/Sites/audit/app/public/wp-content/plugins/plugin-check/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php on line 142
PHP Deprecated:  Method ReflectionParameter::getClass() is deprecated in /Users/nilambarsharma/Sites/audit/app/public/wp-content/plugins/plugin-check/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php on line 142
Screenshot 2024-01-09 at 3 49 01 PM
mukeshpanchal27 commented 5 months ago

Thank you, @ernilambar. I encountered similar deprecated notices when running the tests locally, but strangely, the tests are passing. I'm currently working on replicating the issue to find a solution.

@swissspidy if you have any thoughts on this as it failed on every commit.

swissspidy commented 5 months ago

The issue seems to be related to the code coverage collection, as that runs on the PHP 8.0 / WP latest job.

To reproduce locally:

# Update PHPUnit to get latest php-code-coverage library
composer require --dev --ignore-platform-reqs --update-with-all-dependencies phpunit/phpunit
# Run tests with code coverage and xdebug enabled
BEHAT_CODE_COVERAGE=true XDEBUG_MODE=coverage composer behat

Will do some debugging both locally and on CI, though GitHub Actions is down right now.