semperit/minkcivicrmhelpers

Shared helper functions for running Mink tests against CiviCRM.

Installs: 9 109

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:drupal-custom-module

dev-master 2024-05-18 18:31 UTC

This package is auto-updated.

Last update: 2024-05-18 18:31:16 UTC


README

This provides a Drupal 8/9+ module that can be shared among Mink tests that run against CiviCRM. It provides a trait with some helper functions, like assertNoPageErrors() to check if any errors appear on the page or CiviCRM popped up any javascript error boxes on the page.

It also provides a basic starting point for your setUp function which is likely to be common across all tests.

Usage

  1. composer require semperit/minkcivicrmhelpers
  2. Include the following in your test class (inside the class definition not at the top of the file):
    use \Drupal\Tests\mink_civicrm_helpers\Traits\Utils;
  3. Include the following var declaration in the class (this tells the drupal test system what it needs during bootstrap):
    /**
     * @var array
     */
    protected static $modules = [
      'mink_civicrm_helpers',
    ];
  4. Then typically your setUp() functions will look like this, which installs the extension and does some initial basic config:
    public function setUp(): void {
      parent::setUp();
      $this->setUpExtension('_put_your_extension_key_here_');
    }
  5. For further usage see the code comments inside the trait.