function BuildTestBase::initMink

Same name in other branches
  1. 9 core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::initMink()
  2. 10 core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::initMink()
  3. 11.x core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::initMink()

Set up the Mink session manager.

Return value

\Behat\Mink\Session

2 calls to BuildTestBase::initMink()
BuildTestBase::setUp in core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
BuildTestBase::stopServer in core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
Stop the HTTP server, zero out all necessary variables.

File

core/tests/Drupal/BuildTests/Framework/BuildTestBase.php, line 220

Class

BuildTestBase
Provides a workspace to test build processes.

Namespace

Drupal\BuildTests\Framework

Code

protected function initMink() {
    // If the Symfony BrowserKit client can followMetaRefresh(), we should use
    // the Goutte descendent instead of ours.
    if (method_exists(SymfonyClient::class, 'followMetaRefresh')) {
        $client = new Client();
    }
    else {
        $client = new DrupalMinkClient();
    }
    $client->followMetaRefresh(TRUE);
    $driver = new GoutteDriver($client);
    $session = new Session($driver);
    $this->mink = new Mink();
    $this->mink
        ->registerSession('default', $session);
    $this->mink
        ->setDefaultSessionName('default');
    $session->start();
    return $session;
}

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