You are here

protected function ClientTest::mockClient in Little helpers 7.2

Create a client instance with a stubbed sendRequest() method.

1 call to ClientTest::mockClient()
ClientTest::testAddSlash in tests/Rest/ClientTest.php
Test that send() adds slashes automatically as needed.

File

tests/Rest/ClientTest.php, line 15

Class

ClientTest
Test the JSON/REST API-client.

Namespace

Drupal\little_helpers\Rest

Code

protected function mockClient(string $endpoint = 'https://example.com', array $options = []) {
  return $this
    ->getMockBuilder(Client::class)
    ->setConstructorArgs([
    $endpoint,
    $options,
  ])
    ->setMethods([
    'sendRequest',
  ])
    ->getMock();
}