You are here

protected function ClientTest::getGuzzle in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/fabpot/goutte/Goutte/Tests/ClientTest.php \Goutte\Tests\ClientTest::getGuzzle()
19 calls to ClientTest::getGuzzle()
ClientTest::testConvertsGuzzleHeadersToArrays in vendor/fabpot/goutte/Goutte/Tests/ClientTest.php
ClientTest::testCreatesResponse in vendor/fabpot/goutte/Goutte/Tests/ClientTest.php
ClientTest::testCustomUserAgent in vendor/fabpot/goutte/Goutte/Tests/ClientTest.php
ClientTest::testCustomUserAgentConstructor in vendor/fabpot/goutte/Goutte/Tests/ClientTest.php
ClientTest::testHandlesRedirectsCorrectly in vendor/fabpot/goutte/Goutte/Tests/ClientTest.php

... See full list

File

vendor/fabpot/goutte/Goutte/Tests/ClientTest.php, line 35

Class

ClientTest
Goutte Client Test.

Namespace

Goutte\Tests

Code

protected function getGuzzle(array $responses = []) {
  if (empty($responses)) {
    $responses = [
      new GuzzleResponse(200, [], '<html><body><p>Hi</p></body></html>'),
    ];
  }
  $this->mock = new MockHandler($responses);
  $handlerStack = HandlerStack::create($this->mock);
  $this->history = [];
  $handlerStack
    ->push(Middleware::history($this->history));
  $guzzle = new GuzzleClient(array(
    'redirect.disable' => true,
    'base_uri' => '',
    'handler' => $handlerStack,
  ));
  return $guzzle;
}