You are here

class TestClient in Drupal 8

Special client that can return a given response on the first doRequest().

Hierarchy

  • class \Drupal\BuildTests\Framework\DrupalMinkClient extends \Behat\Mink\Driver\Goutte\Client
    • class \Drupal\BuildTests\Framework\Tests\TestClient

Expanded class hierarchy of TestClient

File

core/tests/Drupal/BuildTests/Framework/Tests/DrupalMinkClientTest.php, line 82

Namespace

Drupal\BuildTests\Framework\Tests
View source
class TestClient extends DrupalMinkClient {
  protected $nextResponse = NULL;
  public function setNextResponse(Response $response) {
    $this->nextResponse = $response;
  }
  protected function doRequest($request) {
    if (NULL === $this->nextResponse) {
      return new Response();
    }
    $response = $this->nextResponse;
    $this->nextResponse = NULL;
    return $response;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalMinkClient::$followMetaRefresh protected property Whether to follow meta redirects or not.
DrupalMinkClient::followMetaRefresh public function Sets whether to automatically follow meta refresh redirects or not.
DrupalMinkClient::getMetaRefreshUrl private function Glean the meta refresh URL from the current page content.
DrupalMinkClient::request public function Calls a URI.
TestClient::$nextResponse protected property
TestClient::doRequest protected function Makes a request.
TestClient::setNextResponse public function