1 | <?php |
||
15 | class ApiRequester |
||
16 | { |
||
17 | protected $method = 'get'; |
||
18 | protected $path = '/'; |
||
19 | protected $requestHeader = []; |
||
20 | protected $query = []; |
||
21 | protected $requestBody = null; |
||
22 | /** |
||
23 | * @var Schema |
||
24 | */ |
||
25 | protected $swaggerSchema = null; |
||
26 | |||
27 | protected $statusExpected = 200; |
||
28 | protected $assertHeader = []; |
||
29 | |||
30 | /** |
||
31 | * @var ClientInterface |
||
32 | */ |
||
33 | protected $guzzleHttpClient; |
||
34 | |||
35 | public function __construct() |
||
39 | |||
40 | /** |
||
41 | * @param Schema $schema |
||
42 | * @return $this |
||
43 | */ |
||
44 | public function withSwaggerSchema($schema) |
||
50 | |||
51 | /** |
||
52 | * @return bool |
||
53 | */ |
||
54 | public function hasSwaggerSchema() |
||
58 | |||
59 | /** |
||
60 | * @param string $method |
||
61 | * @return ApiRequester |
||
62 | */ |
||
63 | public function withMethod($method) |
||
69 | |||
70 | /** |
||
71 | * @param string $path |
||
72 | * @return ApiRequester |
||
73 | */ |
||
74 | public function withPath($path) |
||
80 | |||
81 | /** |
||
82 | * @param array $requestHeader |
||
83 | * @return ApiRequester |
||
84 | */ |
||
85 | public function withRequestHeader($requestHeader) |
||
96 | |||
97 | /** |
||
98 | * @param array $query |
||
99 | * @return ApiRequester |
||
100 | */ |
||
101 | public function withQuery($query) |
||
112 | |||
113 | /** |
||
114 | * @param null $requestBody |
||
115 | * @return ApiRequester |
||
116 | */ |
||
117 | public function withRequestBody($requestBody) |
||
123 | |||
124 | public function assertResponseCode($code) |
||
130 | |||
131 | public function assertHeaderContains($header, $contains) |
||
137 | |||
138 | /** |
||
139 | * @return mixed |
||
140 | * @throws Exception\DefinitionNotFoundException |
||
141 | * @throws Exception\HttpMethodNotFoundException |
||
142 | * @throws Exception\InvalidDefinitionException |
||
143 | * @throws Exception\PathNotFoundException |
||
144 | * @throws GuzzleException |
||
145 | * @throws NotMatchedException |
||
146 | * @throws StatusCodeNotMatchedException |
||
147 | */ |
||
148 | public function send() |
||
224 | } |
||
225 |