function WebDriverTestBase::initMink

Same name and namespace in other branches
  1. 9 core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::initMink()
  2. 8.9.x core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::initMink()
  3. 10 core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::initMink()

Initializes Mink sessions.

Overrides BrowserTestBase::initMink

File

core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php, line 53

Class

WebDriverTestBase
Runs a browser test using a driver that supports JavaScript.

Namespace

Drupal\FunctionalJavascriptTests

Code

protected function initMink() {
  if (!is_a($this->minkDefaultDriverClass, DrupalSelenium2Driver::class, TRUE)) {
    throw new \UnexpectedValueException(sprintf("%s has to be an instance of %s", $this->minkDefaultDriverClass, DrupalSelenium2Driver::class));
  }
  $this->minkDefaultDriverArgs = [
    'chrome',
    [
      'goog:chromeOptions' => [
        'w3c' => FALSE,
      ],
    ],
    'http://localhost:4444',
  ];
  try {
    return parent::initMink();
  } catch (\Exception $e) {
    // If it's not possible to get a mink connection ensure that mink's own
    // destructor is called immediately, to avoid it being called in
    // ::tearDown(), then rethrow the exception.
    $this->mink = NULL;
    throw $e;
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.