*** WORK IN PROGRESS ***
When you develop a plugin for WordPress it's important to also build test cases and use them continuous.
This package is a helper to run tests within your plugin folder but use Docker as a testing instance and report generator.
The testsuite should be placed within a plugin that's going to be tested.
root
│ wp-admin
└───wp-content
├───plugins
│ ├───your-plugin <- install with composer require ekandreas/testrunner:*
│ │ ...
Note! First time is going to take a long time due to creating images and installing wordpress-develop folder, etc.
To continuously run tests to a plugin use the partitial test command:
dep tests:run
- Docker-machine with VirtualBox
- PHP Composer
Install this lib with composer, eg:
composer require ekandreas/testrunner:dev-master
Now create a deployment file in root of your plugin, eg:
<!-- deploy.php -->
date_default_timezone_set('Europe/Stockholm');
include_once 'vendor/ekandreas/testrunner/recipe.php';
You can now enjoy tests with docker with the following deployment command:
vendor/bin/dep tests
This is only the first time, aprox 10 min first time.
And with continuous tests:
vendor/bin/dep tests:run
Only seconds to a test report.
<!-- deploy.php -->
<?php
date_default_timezone_set('Europe/Stockholm');
include_once 'vendor/ekandreas/testrunner/recipe.php';
set( 'docker_host_name', 'tests');
vendor/bin/dep tests
dep tests:up
dep tests:rebuild
dep tests:run
This will kill the containers
dep tests:stop
This will kill the virtual test machine
dep tests:kill
If you don't want to use the default docker-machine, define your own, eg:
<!-- deploy.php -->
date_default_timezone_set('Europe/Stockholm');
include_once 'vendor/ekandreas/testrunner/recipe.php';
set( 'docker_host_name', 'tests');
If you don't have a docker machine setup then the deploy script will try to create it for you. Virtualbox as default.
- Just one single command
dep tests
to check and startup mysql and install if missing.