PHPackages                             tuutti/drupal-test-runner - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. tuutti/drupal-test-runner

ActiveLibrary

tuutti/drupal-test-runner
=========================

Tool to run Drupal tests

1.1.6(5y ago)01.1kGPL-2.0-or-laterPHP

Since Nov 16Pushed 5y ago1 watchersCompare

[ Source](https://github.com/tuutti/drupal-test-runner)[ Packagist](https://packagist.org/packages/tuutti/drupal-test-runner)[ RSS](/packages/tuutti-drupal-test-runner/feed)WikiDiscussions main Synced 6d ago

READMEChangelogDependenciesVersions (3)Used By (0)

Drupal test runner
==================

[](#drupal-test-runner)

[![Tests](https://github.com/tuutti/drupal-test-runner/workflows/CI/badge.svg)](https://github.com/tuutti/drupal-test-runner/actions)

Provides a set of tools to make testing Drupal easier.

Requirements
------------

[](#requirements)

- make (GNU)
- composer
- php
- composer

Installation
------------

[](#installation)

`$ composer global require tuutti/drupal-test-runner ^1.0`

This will create `drupal-tr` executable that works as a wrapper for our make commands. You can either call it directly from composer's binary folder or add composer's global bin dir to your `$PATH` variable: `PATH="$PATH:$HOME/.composer/vendor/bin"`.

Usage
-----

[](#usage)

Available installers:

- [contrib](#contrib-installer)
- [composer-project](#composer-project-installer)

### Setup Drupal

[](#setup-drupal)

`drupal-tr` to install Drupal with selected installer (`INSTALLER_TYPE`)

### Run tests

[](#run-tests)

`drupal-tr run-tests` to run tests with selected test runner (`TEST_RUNNER`)

### Utility tools

[](#utility-tools)

`drupal-tr run-drush-server` to start a drush server listening on `DRUPAL_BASE_URL`.

Configuration
-------------

[](#configuration)

Variable nameDefault valueRequiredDescription`DRUPAL_DB_URL`YThe database url, for example `mysql://drupal:drupal@localhost/drupal``INSTALLER_TYPE``contrib`NThe test type (contrib or composer-project)`TEST_RUNNER``phpunit`NThe test runner (phpunit or core)`PHP_BINARY``$(which php)`NPath to PHP binary`DRUSH``$(which drush)`, fallbacks to `vendor/bin/drush`NPath to drush binary. If Drush is not found it will be installed with composer`DRUPAL_BASE_URL`Fallbacks to `SIMPLETEST_BASE_URL` if setNThe base url (required for functional tests)`SIMPLETEST_BASE_URL`NSame as `DRUPAL_BASE_URL``TEST_RUNNER_ROOT`Defaults to `DRUPAL_ROOT`NContrib installer
-----------------

[](#contrib-installer)

Use `contrib` when testing something that is not packaged with Drupal core, like Drupal modules or themes. Core version is determined by `DRUPAL_CORE_VERSION` variable and will be installed to given `DRUPAL_ROOT` using `DRUPAL_INSTALL_PROFILE` installation profile.

Your `DRUPAL_MODULE_PATH` (git root by default) will be added to composer.json's `repositories` automatically and installed with `composer require drupal/$DRUPAL_MODULE_NAME`. For this to work your package MUST have a composer.json file containing `type` and `name` values starting with `drupal`, for example:

```
{
  "name": "drupal/your_module",
  "type": "drupal-module"
}
```

See [composer/installers](https://github.com/composer/installers) for available types.

*NOTE*: `DRUPAL_ROOT` cannot be inside the `DRUPAL_MODULE_PATH` folder.

### Contrib installer configuration

[](#contrib-installer-configuration)

Variable nameDefault valueRequiredDescription`DRUPAL_MODULE_NAME`YThe module/theme name`DRUPAL_INSTALL_PROFILE`minimalNThe install profile used to install Drupal`DRUPAL_ROOT``git root/../drupal`NThe path where Drupal will be installed`DRUPAL_CORE_VERSION`9.0.xNThe core version`DRUPAL_MODULE_PATH``git root`NPath to the module`DRUPAL_TEST_GROUPS``$DRUPAL_MODULE_NAME `The test groups. A comma separated list of group names (from `@group` annotation)#### Contrib installer Github actions example

[](#contrib-installer-github-actions-example)

`.github/workflows/ci.yml`:

```
on: [push]
name: CI
env:
  MYSQL_ROOT_PASSWORD: drupal
  SIMPLETEST_DB: "mysql://drupal:drupal@mariadb:3306/drupal"
  SIMPLETEST_BASE_URL: "http://127.0.0.1:8080"
  DRUPAL_MODULE_NAME: "your_module"
  DRUPAL_CORE_VERSION: 9.0.x
jobs:
  test-contrib:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: true
      matrix:
        php-version: ['7.4']
    container:
      image: ghcr.io/tuutti/drupal-php-docker:${{ matrix.php-version }}

    services:
      mariadb:
        image: mariadb:10.5
        env:
          MYSQL_USER: drupal
          MYSQL_PASSWORD: drupal
          MYSQL_DATABASE: drupal
          MYSQL_ROOT_PASSWORD: drupal
        ports:
          - 3306:3306
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 1

      - name: Set variables
        run: |
          echo "$HOME/.config/composer/vendor/bin" >> $GITHUB_PATH

      - name: Setup Drupal test runner
        run: |
          composer global require tuutti/drupal-test-runner ^1.0

      - name: Setup Drupal
        run: drupal-tr

      - name: Run tests
        run: TEST_RUNNER=core drupal-tr run-tests
```

### Contrib installer Gitlab ci example

[](#contrib-installer-gitlab-ci-example)

```
variables:
  DRUPAL_MODULE_NAME: your_module
  SIMPLETEST_BASE_URL: http://127.0.0.1:8080
  DRUPAL_CORE_VERSION: 8.9.x
  DRUPAL_INSTALL_PROFILE: minimal
  MYSQL_DATABASE: drupal
  MYSQL_ROOT_PASSWORD: drupal
  SIMPLETEST_DB: mysql://root:drupal@mariadb/drupal
  TEST_RUNNER: core

before_script:
- export PATH=$HOME/.composer/vendor/bin:$PATH
- composer global require tuutti/drupal-test-runner ^1.0
- drupal-tr
- drupal-tr run-drush-server &

services:
- mariadb:latest

test:7.3:
  image: registry.gitlab.com/tuutti/drupal-php-docker:7.3
  script:
    - drupal-tr run-tests
```

Composer-project installer
--------------------------

[](#composer-project-installer)

Use `composer-project` installer to test Drupal sites that can be installed with composer. For example [drupal-composer/drupal-project](https://github.com/drupal-composer/drupal-project).

Installs Drupal using `DRUPAL_INSTALL_PROFILE` or existing config when `EXISTING_CONFIG` is set to `true`.

### Composer-project installer Github actions example

[](#composer-project-installer-github-actions-example)

```
on: [push]
name: CI
env:
  SIMPLETEST_DB: "mysql://drupal:drupal@db:3306/drupal"
  SIMPLETEST_BASE_URL: "http://127.0.0.1:8888"
  EXISTING_CONFIG: true
  INSTALLER_TYPE: composer-project
jobs:
  tests:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: true
      matrix:
        php-version: ['7.4']
    container:
      image: ghcr.io/tuutti/drupal-php-docker:${{ matrix.php-version }}
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 1

      - name: Set variables
        run: |
          echo "$HOME/.config/composer/vendor/bin" >> $GITHUB_PATH
      - name: Setup drupal
        run: |
          composer global require tuutti/drupal-test-runner
          drupal-tr

      - name: Run PHPUnit tests
        run: |
          drupal-tr run-drush-server &
          drupal-tr run-tests
```

### Configuration

[](#configuration-1)

Variable nameDefault valueRequiredDescription`DRUPAL_INSTALL_PROFILE`minimalNThe install profile used to install Drupal`EXISTING_CONFIG`falseNInstalls Drupal using existing configuration`DRUPAL_ROOT``git root`NThe git root`DRUPAL_TEST_GROUPS`The test groups. A comma separated list of group names (from `@group` annotation)Test runners
------------

[](#test-runners)

### phpunit

[](#phpunit)

Uses `vendor/bin/phpunit` to run tests (default). Attempts to read configuration file from `PHPUNIT_CONFIG_FILE`.

Variable nameDefault valueRequiredDescription`PHPUNIT_CONFIG_FILE``git root/phpunit.xml.dist`NPath to phpunit config file`DRUPAL_TESTSUITES`NLimit tests to certain types, like `unit` or `kernel``DRUPAL_TEST_GROUPS`NThe test groups. A comma separated list of group names (from `@group` annotation)### core

[](#core)

Uses core's `core/scripts/run-tests.sh` to run tests.

Set `TEST_RUNNER=core` to use this.

Variable nameDefault valueRequiredDescription`DRUPAL_TESTSUITES`NLimit tests to certain types, like `PHPUnit-Kernel``DRUPAL_TEST_GROUPS`YThe test groups. A comma separated list of group names (from `@group` annotation)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2007d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/06136d0ee7040e3e819470aa6f30b6629ab6c5655b35bd8123ea43dcc55b130e?d=identicon)[tuutti](/maintainers/tuutti)

---

Top Contributors

[![tuutti](https://avatars.githubusercontent.com/u/771113?v=4)](https://github.com/tuutti "tuutti (41 commits)")

### Embed Badge

![Health badge](/badges/tuutti-drupal-test-runner/health.svg)

```
[![Health](https://phpackages.com/badges/tuutti-drupal-test-runner/health.svg)](https://phpackages.com/packages/tuutti-drupal-test-runner)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
