You are here

protected function DrupalOrgTest::getGuzzleMock in Freelinking 4.0.x

Same name and namespace in other branches
  1. 8.3 tests/src/Unit/Plugin/freelinking/DrupalOrgTest.php \Drupal\Tests\freelinking\Unit\Plugin\freelinking\DrupalOrgTest::getGuzzleMock()

Create Guzzle client instance with mock handlers.

Return value

\GuzzleHttp\Client The Guzzle HTTP Client.

1 call to DrupalOrgTest::getGuzzleMock()
DrupalOrgTest::setUp in tests/src/Unit/Plugin/freelinking/DrupalOrgTest.php

File

tests/src/Unit/Plugin/freelinking/DrupalOrgTest.php, line 172

Class

DrupalOrgTest
Tests the drupalorg plugin.

Namespace

Drupal\Tests\freelinking\Unit\Plugin\freelinking

Code

protected function getGuzzleMock() {
  $mock = new MockHandler([
    new Response(200, [
      'Content-Type' => 'text/html',
    ], '<body><h1 class="page-subtitle">Freelinking</h1><div>Test Page Content.</div></body>'),
  ]);
  $handler = HandlerStack::create($mock);
  return new Client([
    'handler' => $handler,
  ]);
}