You are here

ElasticsearchConnectorFeatureContext.php in Elasticsearch Connector 8.7

File

tests/src/Behat/features/bootstrap/ElasticsearchConnectorFeatureContext.php
View source
<?php

use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Testwork\Hook\Scope\BeforeSuiteScope;
use Drupal\DrupalExtension\Context\RawDrupalContext;

/**
 * Behat steps for testing the elasticsearch_connector module.
 *
 * @codingStandardsIgnoreStart
 */
class ElasticsearchConnectorFeatureContext extends RawDrupalContext implements SnippetAcceptingContext {

  /**
   * Setup for the test suite, enable some required modules and add content
   * title.
   *
   * @BeforeSuite
   */
  public static function prepare(BeforeSuiteScope $scope) {

    /** @var \Drupal\Core\Extension\ModuleHandler $moduleHandler */
    $moduleHandler = \Drupal::service('module_handler');
    if (!$moduleHandler
      ->moduleExists('elasticsearch_connector')) {
      \Drupal::service('module_installer')
        ->install([
        'elasticsearch_connector',
      ]);
    }

    // Also uninstall the inline form errors module for easier testing.
    if ($moduleHandler
      ->moduleExists('inline_form_errors')) {
      \Drupal::service('module_installer')
        ->uninstall([
        'inline_form_errors',
      ]);
    }
  }

}

Classes

Namesort descending Description
ElasticsearchConnectorFeatureContext Behat steps for testing the elasticsearch_connector module.