You are here

public static function FbInstantArticlesFeatureContext::prepare in Facebook Instant Articles 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Behat/features/bootstrap/FbInstantArticlesFeatureContext.php \FbInstantArticlesFeatureContext::prepare()

Install Facebook Instant Articles module.

@BeforeSuite

File

tests/src/Behat/features/bootstrap/FbInstantArticlesFeatureContext.php, line 20

Class

FbInstantArticlesFeatureContext
Defines application features used by all features.

Code

public static function prepare(BeforeSuiteScope $scope) {

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

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

  // Clear the FBIA Config so we start from scratch each time.
  // This is mostly handy when developing these tests locally.
  \Drupal::configFactory()
    ->getEditable('fb_instant_articles.settings')
    ->delete();
}