Western Michigan University's Docker image for testing Drupal modules.
Supported tags and respective
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
/start-site.sh as the startup command. For example, if your project's Drupal directory is
$ cd /my/project $ docker run -v $(pwd):/project -e SITE_DIR=web westernmichiganuniversity/drupal-testbot /start-site.sh
Additional command-line options
simpletestto select the testing platform. When using /start-site.sh, only
behatis supported. Default is
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.
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
.testfile, which is expected to be located in the root of the module's directory.
For /start-site.sh only, set this to the name of the Drupal profile to install. Default is
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/drupaldirectory, 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(for Behat): Configuration file for the Behat test suite.
composer.json: Composer manifest describing the module's dependencies. For Behat, this must include
features/(for Behat): Contains Behat test cases (
*.feature) and additional context (
my_module.test(for SimpleTest): Contains all SimpleTest test cases for the module. Alternatively, you can place your test cases in a different
.testfile and use
-e SIMPLETEST_CLASSto 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
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.