Opened 5 weeks ago
Last modified 5 weeks ago
#3610 new defect (bug)
Upgrading composer, npm and adding wp-env for PHPUnit
Reported by: | SirLouen | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | trunk |
Component: | Tools - Build | Keywords: | has-patch has-unit-tests |
Cc: |
Description
After checking buddypress docs, I noticed that they were using wp-env, which is massive for WP development with Docker, plus the complimentary scripts for PHPUnit testing with WP-Env running in the background.
First, trying to make my way through it, I noticed that both composer.json
and package.json
had dependencies issues.
For package.json
, stylelint
could not be in the latest version, only 14 or lower worked. And some other dependencies broke. So I've fixed all versions to make it happen
Same for composer.json
, I simply upgraded to the latest phpcodesniffer-composer-installer
compatible with the latest PHP 8+, and added PHPUnit 9 because I noticed that 10 and 11 were breaking tests. I will be opening an issue to sort this specifically in the future.
After this, for now, I've introduced two basic scripts similarly to the Buddypress implementation
One for WP-ENV
npm run wp-env start
Which runs the WP virtual environment via docker, and through .wp-env.json
, we can define to bring the root, bbPress folder to it, install the plugin and ready to rumble.
And then another script for basic PHPUnit running.
npm run test-php
Probably more scripts should be added in the future, but this is just a proof of concept to have this up and running.
Furthermore, I've added the necessary tweaks in the repo to start passing test with this script command, removing all deprecation warnings for PHP 8.2.
For now, I think this is ideal to have a good and more modern dev environment.
Attachments (1)
Change History (3)
This ticket was mentioned in PR #18 on bbpress/bbPress by @SirLouen.
5 weeks ago
#1
- Keywords has-unit-tests added
As described here:
https://bbpress.trac.wordpress.org/ticket/3610
After checking buddypress docs, I noticed that they were using wp-env, which is massive for WP development with Docker, plus the complimentary scripts for PHPUnit testing with WP-Env running in the background.
First, trying to make my way through it, I noticed that both composer.json
and package.json
had dependencies issues.
For package.json
, stylelint
could not be in the latest version, only 14 or lower worked. And some other dependencies broke. So I've fixed all versions to make it happen
Same for composer.json
, I simply upgraded to the latest phpcodesniffer-composer-installer
compatible with the latest PHP 8+, and added PHPUnit 9 because I noticed that 10 and 11 were breaking tests. I will be opening an issue to sort this specifically in the future.
After this, for now, I've introduced two basic scripts similarly to the Buddypress implementation
One for WP-ENV
npm run wp-env start
Which runs the WP virtual environment via docker, and through .wp-env.json
, we can define to bring the root, bbPress folder to it, install the plugin and ready to rumble.
And then another script for basic PHPUnit running.
npm run test-php
Probably more scripts should be added in the future, but this is just a proof of concept to have this up and running.
Furthermore, I've added the necessary tweaks in the repo to start passing test with this script command, removing all deprecation warnings for PHP 8.2.
For now, I think this is ideal to have a good and more modern dev environment.
This patch upgrades build tools for WP-ENV and PHPUnit working over it