Drivers

WordHat provides a range of drivers for interacting with the WordPress site you are testing. A driver represents and manages the connection between the Behat and WordPress environments. Different drivers support different features.

  • The WP-CLI driver – the default – uses WP-CLI to communicate with WordPress.
  • The WordPress PHP driver loads WordPress in the same PHP context as Behat.
  • The Blackbox driver interacts with WordPress through a web browser, in an unpriviledged context.

To specify which driver to use for your tests, set default_driver in your behat.yml file.

Feature WP-CLI WordPress PHP Blackbox
Posts and comments. Yes Yes No
Terms for taxonomy. Yes Yes No
Manage users. Yes Yes No
Manage plugins. Yes Yes No
Switch theme. Yes Yes No
Clear cache. Yes Yes No
Database import/export. Yes No No
Run tests and site on different servers. Yes1 No Yes
Database transactions. No Yes No

  1. WP-CLI supports SSH connections to remote WordPress sites.