-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathHttpAsyncClientTestCase.php
More file actions
52 lines (47 loc) · 1.41 KB
/
HttpAsyncClientTestCase.php
File metadata and controls
52 lines (47 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
declare(strict_types=1);
namespace Http\Client\Curl\Tests\Functional;
use Http\Client\Tests\HttpAsyncClientTest;
use PHPUnit\Framework\Attributes\DataProvider;
/**
* Base class for asynchronous functional client tests.
*/
abstract class HttpAsyncClientTestCase extends HttpAsyncClientTest
{
/**
* @dataProvider requestProvider
*/
#[DataProvider('requestProvider')]
public function testAsyncSendRequest(string $httpMethod, string $uri, array $httpHeaders, ?string $requestBody): void
{
if ($requestBody !== null && in_array($httpMethod, ['GET', 'HEAD', 'TRACE'], true)) {
self::markTestSkipped('cURL can not send body using '.$httpMethod);
}
parent::testAsyncSendRequest(
$httpMethod,
$uri,
$httpHeaders,
$requestBody
);
}
/**
* @dataProvider requestWithOutcomeProvider
*/
#[DataProvider('requestWithOutcomeProvider')]
public function testSendAsyncRequestWithOutcome(
array $uriAndOutcome,
string $httpVersion,
array $httpHeaders,
?string $requestBody
): void {
if ( $requestBody !== null) {
self::markTestSkipped('cURL can not send body using GET');
}
parent::testSendAsyncRequestWithOutcome(
$uriAndOutcome,
$httpVersion,
$httpHeaders,
$requestBody
);
}
}