Skip to content

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

Repository files navigation

💻PHPUnit Environment for WordPress Plugin🌐

docker build automated? docker build passing? image size and number of layers Twitter URL

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

Contents:

Benefit

🛠️Use for backend development

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.

🎈Easy to prepare

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

✨Clean for PC

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.

Requirement

  • Docker
  • Docker Compose

Optional

Quickstart

With Visual Studio Code (Recommend)

Tutorial with screenshot are available on the Wiki.

Without Visual Studio Code

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

1. Clone or download

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

2. Set environment variables

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

3. Execute Docker Compose run

docker-compose run phpunit

And then, you can execute PHPUnit and PHP_CodeSniffer.

phpunit
phpcs

Out of scope

UI test is not available by this environment.