PHPackages                             elife/isolated-drupal-behat-extension - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. elife/isolated-drupal-behat-extension

Abandoned → [elife/isolated-drupal-behat-extension](/?search=elife%2Fisolated-drupal-behat-extension)ArchivedLibrary[Testing &amp; Quality](/categories/testing)

elife/isolated-drupal-behat-extension
=====================================

Extension for Behat that tests Drupal sites in isolation

0.2.5(9y ago)43.8k1[2 issues](https://github.com/elifesciences/isolated-drupal-behat-extension/issues)GPL-2.0+PHPPHP &gt;=5.4

Since Aug 14Pushed 9y ago11 watchersCompare

[ Source](https://github.com/elifesciences/isolated-drupal-behat-extension)[ Packagist](https://packagist.org/packages/elife/isolated-drupal-behat-extension)[ Docs](https://github.com/elifesciences/isolated-drupal-behat-extension)[ RSS](/packages/elife-isolated-drupal-behat-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (12)Versions (8)Used By (0)

Isolated-Drupal Behat Extension
===============================

[](#isolated-drupal-behat-extension)

[![Build Status](https://camo.githubusercontent.com/aa1d5e78131cfbd4b78cad13be46d1c27d15450a03c285c9e97ca3fd85a4a1b2/68747470733a2f2f7472617669732d63692e6f72672f656c696665736369656e6365732f69736f6c617465642d64727570616c2d62656861742d657874656e73696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/elifesciences/isolated-drupal-behat-extension)

What does the extension do?
---------------------------

[](#what-does-the-extension-do)

The [Drupal extension for Behat](https://github.com/jhedstrom/drupalextension) allows you to use [Behat](https://github.com/behat/behat) to writes scenarios that describe and test the functionality of your Drupal 7 site.

It's flexible, in that you are able to do things such as test remote sites. Because of this, however, it doesn't run each scenario in isolation, which means that they can be influenced by each other, as well as the existing site. When using Behat to purely test your codebase this is dangerous, as scenarios might pass or fail when in fact the opposite should happen.

This extension solves this problem by running each scenario on a freshly-installed site, which allows you to test your site with confidence.

### Isn't that slow?

[](#isnt-that-slow)

Yes. To help counter this, the extension actually copies the first install, then copies that back instead of actually installing the site again. This means that the first scenario might take a little while to run, but you won't notice much of a difference with the others.

### Won't this destroy the site that I'm working on?

[](#wont-this-destroy-the-site-that-im-working-on)

No. It (mis)uses [Drupal's multi-site feature](https://www.drupal.org/documentation/install/multi-site), so that your site isn't touched. If your site is available at , for example, it installs a site into `sites/localhost` and tests on that (Drupal will serve it instead of your normal site), then removes it when the suite is finished.

### How does it know what modules to enable?

[](#how-does-it-know-what-modules-to-enable)

It assumes that your [install profile](https://www.drupal.org/node/306267) will set up your site. That said, you could add steps in your feature to enable modules etc as needed.

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

[](#requirements)

- [Behat 3.x](https://github.com/behat/behat)
- [Drupal extension for Behat 3.x](https://github.com/jhedstrom/drupalextension)
- A web server locally running your site.

Enabling the extension
----------------------

[](#enabling-the-extension)

1. Add the extension to your dependencies (`composer require elife/isolated-drupal-behat-extension`).
2. Add the extension to your Behat configuration:

    ```
    default:
      extensions:
        eLife\IsolatedDrupalBehatExtension:
          db_url: 'mysql://user:password@localhost/db_name'
    ```

    See below for configuration options.
3. Run Behat as normal.

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

[](#configuration)

The extension will use configuration options for the [Drupal extension for Behat](https://github.com/jhedstrom/drupalextension) to know where your site is located, what URL it's served on etc.

Its own options are:

### `db_url`

[](#db_url)

This is **required**. It is a connection string to a database that the isolated sites can be installed into.

This doesn't have to be the same type as your production setup, so you could use SQLite rather than MySQL. (Though bear in mind that if you're not using Drupal's database abstraction layer at any point you will need to use the same database type.)

#### Examples

[](#examples)

- `mysql://user:password@localhost/db_name`
- `sqlite:/db_name.sqlite`

### `profile`

[](#profile)

This is the name of the install profile to use. The default value is `standard`.

### `settings_file`

[](#settings_file)

This is a path to a `settings.php` file to use. This is empty by default.

Note that the following values will be overwritten to ensure isolation:

- `$base_url`
- `$databases`
- `$drupal_hash_salt`
- `$conf["file_public_path"]`
- `$conf["file_private_path"]`
- `$conf["file_temporary_path"]`

### `clean_up`

[](#clean_up)

By default, the extension will remove the sites it created after the suite has finished. If you're running the suite a few times in quick succession, this means it will be installing a site each time, which can be quite slow. Setting this value to `false` (the default is `true`) which cause it *not* clean up the filesystem, so the second (and subsequent) runs will use the copy of the installed site from the first run. This will be quicker, but it's up to the developer to make sure that no changes have been made to the install process (if required, the master site will need to be manually removed).

Running the extension's tests
-----------------------------

[](#running-the-extensions-tests)

```
$ composer install
$ ./vendor/bin/phpunit
$ ./vendor/bin/behat
```

Extending the extension
-----------------------

[](#extending-the-extension)

You can write your own Behat extension and listen for the following events:

- `elife_drupal.installing_site`
- `elife_drupal.mirroring_path`
- `elife_drupal.site_installed`
- `elife_drupal.site_settings`

This will allow you to interact with/extend the extension.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.8% 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 ~53 days

Recently: every ~68 days

Total

7

Last Release

3611d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e6aaeba393e9038b5a5a916e5f4e32ffb349436e3be2027be4828f486bc8c9d?d=identicon)[thewilkybarkid](/maintainers/thewilkybarkid)

---

Top Contributors

[![thewilkybarkid](https://avatars.githubusercontent.com/u/1784740?v=4)](https://github.com/thewilkybarkid "thewilkybarkid (44 commits)")[![kwiliarty](https://avatars.githubusercontent.com/u/407636?v=4)](https://github.com/kwiliarty "kwiliarty (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/elife-isolated-drupal-behat-extension/health.svg)

```
[![Health](https://phpackages.com/badges/elife-isolated-drupal-behat-extension/health.svg)](https://phpackages.com/packages/elife-isolated-drupal-behat-extension)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

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