This extension provides Behat integration with Drupal CMS projects. It provides:
- DrupalMinkContext, which provides some useful step definitions for common Drupal functions, such as creating users and logging in.
This extension requires:
- Define dependencies in your composer.json:
{
"require": {
...
"phase2/drupal-extension": "dev-master"
},
"repositories": [
...
{
"type": "vcs",
"url": "https://github.com/phase2/behat-drupal-extension"
}
]
}
- Install/update your vendors
$ curl http://getcomposer.org/installer | php
$ php composer.phar install
- Activate extension in your behat.yml
default:
# ...
extensions:
Phase2\Behat\DrupalExtension\Extension:
drupal_root: /path/to/drupal
base_url: http://example.com/
After installing extension, there are 2 usage options available for you:
- Set the context class in the configuration file to use DrupalMinkContext.
# behat.yml
default:
context:
class: Phase2\Behat\DrupalExtension\Context\DrupalMinkContext
This will give you access to all of the pre-defined Drupal and Mink steps without needing to create a FeatureContext of your own.
- Extend
Phase2\Behat\DrupalExtension\Context\DrupalMinkContext
with your context or subcontext if you need additional step definitions or hooks.
DrupalExtension comes with a flexible configuration system, that gives you the ability to configure how Drupal is used.
drupal_root
- specifies the path to your Drupal document root.base_url
- specify the URL to be used when bootstrapping Drupal. If using MinkExtension, this should match the base_url in the MinkExtension settings.module
- specify the name of an enabled Drupal module to run the feature suite bundled with the module.