You are here

public function FeatureContext::before in Open Social 8.9

Same name and namespace in other branches
  1. 8.3 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::before()
  2. 8.4 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::before()
  3. 8.5 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::before()
  4. 8.6 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::before()
  5. 8.7 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::before()
  6. 8.8 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::before()
  7. 10.3.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::before()
  8. 10.0.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::before()
  9. 10.1.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::before()
  10. 10.2.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::before()

@BeforeScenario

Parameters

\Behat\Behat\Hook\Scope\BeforeScenarioScope $scope:

File

tests/behat/features/bootstrap/FeatureContext.php, line 47

Class

FeatureContext
Defines application features from the specific context.

Namespace

Drupal\social\Behat

Code

public function before(BeforeScenarioScope $scope) {

  // Start a session if not already done.
  // Needed since https://github.com/minkphp/Mink/pull/705
  // Otherwise resizeWindow will throw an error.
  if (!$this
    ->getSession()
    ->isStarted()) {
    $this
      ->getSession()
      ->start();
  }

  // Let's disable the tour module for all tests by default.
  \Drupal::configFactory()
    ->getEditable('social_tour.settings')
    ->set('social_tour_enabled', 0)
    ->save();

  /** @var \Behat\Testwork\Environment\Environment $environment */
  $environment = $scope
    ->getEnvironment();
  $this->minkContext = $environment
    ->getContext(SocialMinkContext::class);
  $this
    ->getSession()
    ->resizeWindow(1280, 2024, 'current');
}