Version 1
[yaffs-website] / web / modules / contrib / video_embed_field / tests / src / Kernel / MockHttpClient.php
diff --git a/web/modules/contrib/video_embed_field/tests/src/Kernel/MockHttpClient.php b/web/modules/contrib/video_embed_field/tests/src/Kernel/MockHttpClient.php
new file mode 100644 (file)
index 0000000..58ade66
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+
+namespace Drupal\Tests\video_embed_field\Kernel;
+
+use GuzzleHttp\ClientInterface;
+use Psr\Http\Message\RequestInterface;
+
+/**
+ * An exceptional HTTP client mock.
+ */
+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);
+  }
+
+}