ekandreas/testrunner

There is no license information available for the latest version (0.3.1) of this package.

0.3.1 2016-01-11 22:53 UTC

This package is auto-updated.

Last update: 2024-12-25 21:46:02 UTC


README

License

*** 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

Requirements

  • Docker-machine with VirtualBox
  • PHP Composer

Setup

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 file example

<!-- deploy.php -->
<?php
date_default_timezone_set('Europe/Stockholm');

include_once 'vendor/ekandreas/testrunner/recipe.php';

set( 'docker_host_name', 'tests');

Complete run

vendor/bin/dep tests

Partitial run

Booting up Docker and make installation

dep tests:up

Rebuild Docker container images

dep tests:rebuild

Running just the tests (after tests:up)

dep tests:run

Stop the tests

This will kill the containers

dep tests:stop

Killing Docker machine

This will kill the virtual test machine

dep tests:kill

Recipe parameters, options

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.

TODO

  • Just one single command dep tests to check and startup mysql and install if missing.