Creating A Local Test Environment Essay

834 Words Jul 27th, 2015 4 Pages
## Introduction
In the following article I will describe how to create a local test environment “Travis like” for running a PHP syntax check and your PHPUnit test suite using DUnit, Docker and Git.

## What is DUnit?
DUnit is a simple library that allows to test your PHP code against multiple PHP configurations using [Docker](https://www.docker.com/whatisdocker/). By default, it performs a syntax check and run your [PHPUnit](https://phpunit.de/) test suite.

Under the hood DUnit, with its CLI built with the Symfony console (see my article about [Console Wars](http://www.sitepoint.com/console-wars-php-cli-libraries/)), builds different Docker images and run the tests against your code.

DUnit includes preconfigured containers for the following PHP versions:

- PHP 5.2 - PHP 5.3 - PHP 5.4 - PHP 5.5 - PHP 5.6 - PHP 7.0-dev - HHVM stable - HHVM nightly

and has the following native extensions installed:

- apc (apcu on PHP 5.5 and newer) - curl - gd - intl (PHP 5.3 and newer) - json - mcrypt

## Installation
DUnit requires Docker. The [Docker documentation](https://docs.docker.com/installation/) provides specific installation guides for different systems.
After installing Docker, you can install DUnit via [Composer](https://getcomposer.org/) writing in your project `composer.json`:
```
{ "require-dev": { "vectorface/dunit": "^2.1" }
}
``` or running in your project folder `composer require vectorface/dunit --dev`

## Quick start
That’s all DUnit is…

Related Documents