Settings

Behat uses YAML for its configuration file.

PaulGibbs\WordpressBehatExtension

Extension PaulGibbs\WordpressBehatExtension integrates WordPress into Behat. These are its configuration options:

PaulGibbs\WordpressBehatExtension:
  default_driver: wpcli
  path: ~

  # User settings.
  users:
    admin:
      username: admin
      password: admin
    editor:
      username: editor
      password: editor
    author:
      username: author
      password: author
    contributor:
      username: contributor
      password: contributor
    subscriber:
      username: subscriber
      password: subscriber

  # WordPress settings.
  site_url: ~
  permalinks:
    author_archive: author/%s/
  database:
    restore_after_test: false
    backup_path: ~

  # Driver settings.
  wpcli:
    alias: dev
    binary: wp
Option Default value Description
default_driver “wpcli” Optional.
The driver to use (“wpcli”, “wpapi”, “blackbox”).
path null Required.
Path to WordPress files.
users.* see example Optional.
Keys must match names of WordPress roles.
permalinks.* see example Optional.
Permalink pattern for the specific kind of link.
%s is replaced with an ID/object name, as appropriate.
site_url null Optional.
If your site’s home_url() and site_url() values mismatch,
set this to the site_url() value. Defaults to mink.base_url
wpcli.alias null Optional.
WP-CLI alias (preferred over wpcli.path).
wpcli.binary wp Optional.
Path and name of WP-CLI binary.
database.restore_after_test false Optional.
If true, WordHat will restore your site’s database to its initial state between feature tests.
database.backup_path see example Optional.
If restore_after_test is true, and the value is a file path, WordHat will use that as the backup to restore the database from. If the path is an absolute directory, then before any tests are run, WordHat will generate a database backup and temporarily store it here. If the path has not been set, WordHat will pick its own temporary folder.

Behat\MinkExtension

Behat\MinkExtension:
  # Recommended settings.
  base_url: ~
Option Default value Description
base_url null If you use relative paths in your tests, define a URL to use as the basename.

The Behat\MinkExtension extension integrates Mink into Behat. Visit its website for more information.