-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Contents:
Download:
To mount WordPress plugin project directory into environment container, otherwise, you'll get error.
cf. Installation [Developing inside a Container using Visual Studio Code Remote Development]
git clone https://github.com/yukihiko-shinoda/docker-compose-phpunit-wordpress-plugin.git
Enter into cloned directory and open Visual Studio Code.
Case when Windows GUI:
Right click margin of folder > Click [Open with Code]
When open Visual Studio Code, the notification dialog about extension recommendations will be presented.
Click [Install All] button. (Leave other dialog at once.)
After finish to install extension, create .env file:
Then, edit .env
to set PATH_TO_INDIVIDUAL_PLUGIN_DIRECTORY
key.
Value should be the path to WordPress plugin project directory.
Ex:
PATH_TO_INDIVIDUAL_PLUGIN_DIRECTORY=../plugins/staticpress2019
Then, save file.
Click on the quick actions Status Bar item in the lower left corner, then, click "Remote-Containers: Reopen in Container".
Click [Open Workspace] button.
Then, you can explore WordPress plugin project files and WordPress libraries, and when you open PHP file, code analysis process will start.
After finish code analysis, correct warnings for PHP code will be presented.
Let's open terminal.
And then, you can execute PHPUnit and PHP_CodeSniffer.
Type:
phpunit
or:
phpcs
and hit enter key, you'll get result.
Before restart, remove database container.
docker stop database && docker rm database
This is limitation since install shell script doesn't have idempotency.
Update .env file to comment in DOCKER_IMAGE_PHPUNIT
and MYSQL_VERSION
Ex:
DOCKER_IMAGE_PHPUNIT=futureys/phpunit-wordpress-plugin:4.3.22-php7.1.33-apache-buster
MYSQL_VERSION=5.6
You can choose image for legacy environment from repository futureys/phpunit-wordpress-plugin on Docker Hub.
If your required tag is not found, write Issues to order image.
Order template:
- Which WordPress version you required
- Which PHP version you required
- Which MySQL version expected to work togather (if you know)
- Which WordPress plugin you are developing
Because images are built by matrix, from the perspective of development and build time cost, it's better to reduce kind of images as less as possible.
Has plugin project been initialized? Plugin project should have following files:
- .phpcs.xml.dist
- bin/install-wp-tests.sh
- phpunit.xml.dist
- tests/bootstrap.php
if these files don't exist, initialize plugin project at first.
cf. Developing inside a Container using Visual Studio Code Remote Development