You are here

class MockHttpClient in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/MockHttpClient.php \Drupal\Tests\video_embed_field\Kernel\MockHttpClient

An exceptional HTTP client mock.

Hierarchy

  • class \Drupal\Tests\video_embed_field\Kernel\MockHttpClient implements \GuzzleHttp\ClientInterface

Expanded class hierarchy of MockHttpClient

1 file declares its use of MockHttpClient
ProviderUrlParseTest.php in tests/src/Unit/ProviderUrlParseTest.php

File

tests/src/Kernel/MockHttpClient.php, line 11

Namespace

Drupal\Tests\video_embed_field\Kernel
View source
class MockHttpClient implements ClientInterface {

  /**
   * An exception message for the client methods.
   */
  const EXCEPTION_MESSAGE = "The HTTP mock can't do anything.";

  /**
   * {@inheritdoc}
   */
  public function send(RequestInterface $request, array $options = []) {
    throw new \Exception(static::EXCEPTION_MESSAGE);
  }

  /**
   * {@inheritdoc}
   */
  public function sendAsync(RequestInterface $request, array $options = []) {
    throw new \Exception(static::EXCEPTION_MESSAGE);
  }

  /**
   * {@inheritdoc}
   */
  public function request($method, $uri, array $options = []) {
    throw new \Exception(static::EXCEPTION_MESSAGE);
  }

  /**
   * {@inheritdoc}
   */
  public function requestAsync($method, $uri, array $options = []) {
    throw new \Exception(static::EXCEPTION_MESSAGE);
  }

  /**
   * {@inheritdoc}
   */
  public function getConfig($option = NULL) {
    throw new \Exception(static::EXCEPTION_MESSAGE);
  }

  /**
   * Patch up a magic method call.
   */
  public function head($url) {
    throw new \Exception(static::EXCEPTION_MESSAGE);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MockHttpClient::EXCEPTION_MESSAGE constant An exception message for the client methods.
MockHttpClient::getConfig public function Get a client configuration option.
MockHttpClient::head public function Patch up a magic method call.
MockHttpClient::request public function Create and send an HTTP request.
MockHttpClient::requestAsync public function Create and send an asynchronous HTTP request.
MockHttpClient::send public function Send an HTTP request.
MockHttpClient::sendAsync public function Asynchronously send an HTTP request.