#8649 closed defect (bug) (fixed)
Improves PHP 8.1 compatibility
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 11.0.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Core | Keywords: | has-patch has-unit-tests |
Cc: |
Description
There are a lot of deprecation notices in PHP 8.1 + we need to use PHPUnit 9.0 + we need to really enjoy Yoast PHPUnit polyfills editing our PHPUnit testcase methods and replace some deprecated Assertions.
Change History (21)
This ticket was mentioned in PR #13 on buddypress/buddypress by imath.
15 months ago
#2
- Keywords has-unit-tests added
This ticket was mentioned in Slack in #buddypress by imath. View the logs.
10 months ago
10 months ago
#6
@renatonascalves Thanks a lot for your recommandations. I've applied them and ran tests locally using PHP 7.4.30 and PHP 8.1.9. In both cases everything went fine. Could you have another look at it?
renatonascalves commented on PR #13:
10 months ago
#7
@imath Could you also add support for the Github Action to run in pull requests?
renatonascalves commented on PR #13:
10 months ago
#9
@imath Cool! I think the last task is adding support for PHPUnit here: https://github.com/buddypress/buddypress/blob/master/.github/workflows/unit-tests.yml#L61-L62
"phpunit/phpunit": "^7.5",
renatonascalves commented on PR #13:
10 months ago
#10
Looks like there is an actual bug in the unit tests. 🤔
rafiahmedd commented on PR #13:
10 months ago
#11
renatonascalves commented on PR #13:
10 months ago
#12
@rafiahmedd Are you using WordPress 5.7?
10 months ago
#13
@renatonascalves yes there are bugs related to WordPress 5.7. I believe it's due to the fact wp-phpunit/wp-phpunit:5.7
doesn't include WordPress changes about using Yoast polifyier ((I believe these were included in 5.9).
I think @rafiahmedd tested on BuddyPress master, not this PR's branch 😉.
I'm wondering if it wouldn't fail if we were simply removing these lines into our GH action: https://github.com/buddypress/buddypress/blob/412b003469beef19af079e428f0e40ee5bd09887/.github/workflows/unit-tests.yml#L61|L63
It should use wp-phpunit/wp-phpunit:6.0
which includes Yoast polifyier... I'll try to give it a try locally.
renatonascalves commented on PR #13:
10 months ago
#14
I'd think it was going to fail since WordPress 5.7 won't won't work with "phpunit/phpunit": "^7.5"
. But maybe it will work with wp-phpunit/wp-phpunit:6.0
.
It's worth a test.
rafiahmedd commented on PR #13:
10 months ago
#15
@imath yeah you are right I tested this with the master branch. I will check this from this branch.
10 months ago
#16
Touchdown 🏈 @renatonascalves I was right about my intuition, using the wp-phpunit/wp-phpunit
and PHPunit version for all tests fixes the failing tests under WP 5.7. I believe the risk of doing so is very limited as we only rely on WP Unit Tests class / factory and not on testcases. What's your opinion about it?
rafiahmedd commented on PR #13:
10 months ago
#17
The latest changes working perfectly. I think we can go with this one.
10 months ago
#18
Awesome many thanks to you both @renatonascalves & @rafiahmedd I'll commit changes on trunk asap 🍾🥂
Trac ticket: https://buddypress.trac.wordpress.org/ticket/8649