Behat Drupal Extension System-wide installation

Profile picture for user devraj

Earlier in stand alone installation we installed composer and behat to specific project directory and our commands were limited to that directory only. In this video we will do System Wide installation. A system-wide installation allows you to maintain a single copy of the testing tool set and use it for multiple test environments. Configuration is slightly more complex than the stand-alone installation but many people prefer the flexibility and ease-of-maintenance this setup provides.

Step 1: Install Composer. 

$ curl -sS https://getcomposer.org/installer |
$ php mv composer.phar /usr/local/bin/composer

Step 2: Install the Drupal Extension:

$ cd /opt/
$ sudo mkdir drupalextension
$ cd drupalextension/

Step 3: Inside drupal extension folder create a file called composer.json and paste below code:

{
  "require": {
    "drupal/drupal-extension": "^3.2"
  },
  "config": {
    "bin-dir": "bin/"
  }
}

Step 4: Run composer composer install command. 

$ composer install

Step 5: Check the installation works by typing below command.

$ bin/behat --help

If you were successful, you’ll see the help output.

Step 6: Make the binary available system-wide

$ ln -s /opt/drupalextension/bin/behat /usr/local/bin/behat

Step 7: Check behat outside folder

$ behat --version
Tags