ce-deploy

PHPUnit tests

Step that runs PHPUnit against the specified path in the codebase. Requires that you provide a phpunit.xml config file, unless you’re using Drupal 8 or above, in one of the following locations:

As a final fallback it checks for Drupal’s default PHPUnit configuration file at web/core/phpunit.xml.dist .

Optionally installs PHPUnit with composer if you want it to do so.

For more information on PHPUnit, see https://docs.phpunit.de

Using with Drupal

Ideally to use the role with Drupal you should start with the Coder module , which means having this in your composer.json file:

  "require-dev": {
    "drupal/coder": "^8.3"
  }

If you include coder in your application it will automatically download PHPUnit. Leave the Ansible default variables for this role as they are and the role will automatically run PHPUnit tests against the entire modules directory using the default configuration file provided by the Drupal project.

Default variables

---
phpunit:
  install: false # set to true if you want ce-deploy to attempt to composer install phpunit
  group: unit # comma separated list of group names to run
  target: ../modules # directory or file to test, defaults to Drupal's modules directory
  bin: "{{ live_symlink_dest }}/vendor/bin/phpunit" # location of phpunit
  tests_path: "{{ live_symlink_dest }}/{{ webroot }}/core" # directory containing the PHPUnit 'tests' directory, defaults to Drupal's core directory
  working_dir: "{{ live_symlink_dest }}"  # path to execute composer from