Public | Automated Build

Last pushed: a day ago
Short Description
Western Michigan University's Docker image for testing Drupal modules.
Full Description

Western Michigan University's Docker image for testing Drupal modules.

Supported tags and respective Dockerfile links

For more information about this image and its history, please see the westernmichiganuniversity/drupal-testbot repository on Bitbucket.

What is included?

This image starts with the official Drupal image from the Docker library, then adds MySQL server, Drush and an installed, minimal Drupal instance. The included startup script automates installing a Drupal module in this minimal instance and running a test suite against it using Behat or SimpleTest. An alternative startup script is also included for testing a full Drupal site build.

How to use this image

To test a Drupal module with this image, map the directory that contains the .module file into the container as /project and specify the module's shortname with the MODULE environment variable. For example, if you are working on the custom module my_module.module:

$ cd /path/to/my_module
$ docker run -v $(pwd):/project -e MODULE=my_module westernmichiganuniversity/drupal-testbot

Alternatively, to test a Drupal site build, map the project directory into the container as /project, specifying the relative path to the project's Drupal directory with the SITE_DIR environment variable, and run the container using / as the startup command. For example, if your project's Drupal directory is /my/project/web:

$ cd /my/project
$ docker run -v $(pwd):/project -e SITE_DIR=web westernmichiganuniversity/drupal-testbot /

Additional command-line options

  • -e TEST_MODE
    Set to behat or simpletest to select the testing platform. When using /, only behat is supported. Default is behat.

    When TEST_MODE=behat, set this to change the parameters passed to the Behat executable. For example, set -e BEHAT_PARAMETERS="-dl" to list all test statements available for use by the module's scenarios. Default is --no-interaction --format=junit --format=pretty.

    When TEST_MODE=simpletest, set this to the name of a test class to run only that one case (e.g., -e SIMPLETEST_CLASS=MyTestCase). If not set, the default is to run all test cases in the module's .test file, which is expected to be located in the root of the module's directory.

  • -e PROFILE
    For / only, set this to the name of the Drupal profile to install. Default is minimal.

  • -v /path/on/host:/var/www/html/sites/all/modules/module_name
    -v /path/on/host:/var/www/html/sites/all/libraries/library_name
    Set this to map in additional module or library dependencies. Note that the container startup script will automatically copy in any dependencies found in the module's vendor/drupal directory, so you only need to set this option if other dependencies are required.


The directory mapped in as /project is expected to contain the following files and subdirectories (see WMU Drupal module skeleton):

  • behat.yml.dist or behat.yml (for Behat): Configuration file for the Behat test suite.

  • composer.json: Composer manifest describing the module's dependencies. For Behat, this must include drupal/drupal-extension and jarnaiz/behat-junit-formatter in the require-dev section.

  • features/ (for Behat): Contains Behat test cases (*.feature) and additional context (bootstrap/FeatureContext.php).

  • my_module.test (for SimpleTest): Contains all SimpleTest test cases for the module. Alternatively, you can place your test cases in a different .test file and use -e SIMPLETEST_CLASS to specify the test case to run.

  • test-reports/: The results of the test run will be written to this directory as XML.

  • vendor/: A directory, generated by composer install, that contains all of the module's dependencies. For Behat, the Behat executable is assumed to be at vendor/bin/behat.

For /

When using the alternative startup script, the directory mapped in as /project is expected to include a subdirectory containing Drupal (specified at runtime as SITE_DIR), in addition to the requirements above (see the WMU Drupal project template).


View license information for the software contained in this image.

Supported Docker versions

This image is officially supported on Docker version 1.10.2 for use by WMU Web developers.

Docker Pull Command