Skip to content

phase2/behat-drupal-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DrupalExtension

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.

Installation

This extension requires:

Through Composer

  1. Define dependencies in your composer.json:
   {
       "require": {
           ...
           "phase2/drupal-extension": "dev-master"
       },
       "repositories": [
         ...
         {
           "type": "vcs",
           "url": "https://github.com/phase2/behat-drupal-extension"
         }
       ]
   }
  1. Install/update your vendors
   $ curl http://getcomposer.org/installer | php
   $ php composer.phar install
  1. Activate extension in your behat.yml
   default:
     # ...
       extensions:
         Phase2\Behat\DrupalExtension\Extension:
           drupal_root: /path/to/drupal
           base_url: http://example.com/

Usage

After installing extension, there are 2 usage options available for you:

  1. 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.

  1. Extend Phase2\Behat\DrupalExtension\Context\DrupalMinkContext with your context or subcontext if you need additional step definitions or hooks.

Configuration

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.

Releases

No releases published

Packages

No packages published

Languages