Interim commit.
[yaffs-website] / web / modules / contrib / video_embed_field / tests / src / Kernel / MockHttpClient.php
1 <?php
2
3 namespace Drupal\Tests\video_embed_field\Kernel;
4
5 use GuzzleHttp\ClientInterface;
6 use Psr\Http\Message\RequestInterface;
7
8 /**
9  * An exceptional HTTP client mock.
10  */
11 class MockHttpClient implements ClientInterface {
12
13   /**
14    * An exception message for the client methods.
15    */
16   const EXCEPTION_MESSAGE = "The HTTP mock can't do anything.";
17
18   /**
19    * {@inheritdoc}
20    */
21   public function send(RequestInterface $request, array $options = []) {
22     throw new \Exception(static::EXCEPTION_MESSAGE);
23   }
24
25   /**
26    * {@inheritdoc}
27    */
28   public function sendAsync(RequestInterface $request, array $options = []) {
29     throw new \Exception(static::EXCEPTION_MESSAGE);
30   }
31
32   /**
33    * {@inheritdoc}
34    */
35   public function request($method, $uri, array $options = []) {
36     throw new \Exception(static::EXCEPTION_MESSAGE);
37   }
38
39   /**
40    * {@inheritdoc}
41    */
42   public function requestAsync($method, $uri, array $options = []) {
43     throw new \Exception(static::EXCEPTION_MESSAGE);
44   }
45
46   /**
47    * {@inheritdoc}
48    */
49   public function getConfig($option = NULL) {
50     throw new \Exception(static::EXCEPTION_MESSAGE);
51   }
52
53   /**
54    * Patch up a magic method call.
55    */
56   public function head($url) {
57     throw new \Exception(static::EXCEPTION_MESSAGE);
58   }
59
60 }