yukihiko-shinoda/docker-compose-phpunit-wordpress-plugin

Repository files navigation

docker build automated?docker build passing?image size and number of layersTwitter URL

Supplies PHPUnit environment built acording to official document on WordPress.org.

Contents:

This environment provides following tools:

  • PHPUnit
  • Mockery
  • PHP_CodeSniffer

And also can work with Visual Studio Code. You can lint your code on editor in real time.

You can skip much steps to prepare environment. And you will be able to start Unit Test for WordPres plugin with only few steps.

You don't need to install any SDKs in your PC without only few requirements. You will be free from regular maintenance for development environment.

  • Docker
  • Docker Compose

Tutorial with screenshot are available on the Wiki.

If you want to use other editor or IDE, you also can use this environment only for running PHPUnit or PHP_CodeSniffer.

git clone https://.com/yukihiko-shinoda/docker-compose-phpunit-wordpress-plugin.git

Copy .env.dist to .env.

copy .env.dist .env

Edit .env to set PATH_TO_INDIVIDUAL_PLUGIN_DIRECTORY.

Ex:

PATH_TO_INDIVIDUAL_PLUGIN_DIRECTORY=../plugins/staticpress2019
# DOCKER_IMAGE_PHPUNIT=futureys/phpunit-wordpress-plugin:4.3.22-php7.1.33-apache-buster
# MYSQL_VERSION=5.6
docker-compose run phpunit

And then, you can execute PHPUnit and PHP_CodeSniffer.

phpunit
phpcs

UI test is not available by this environment.