Passed
Pull Request — master (#306)
by Tobias
02:05
created

CurlIntegrationTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 8

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testSendRequest() 0 9 4
A createHttpAdapter() 0 5 1
A testSendRequestWithOutcome() 0 7 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Buzz\Test\Integration;
6
7
use Buzz\Client\Curl;
8
9
class CurlIntegrationTest extends BaseIntegrationTest
10
{
11
    protected function createHttpAdapter()
12
    {
13
        $client = new Curl();
14
15
        return $client;
16
    }
17
18
    /**
19
     * @dataProvider requestProvider
20
     * @group        integration
21
     */
22
    public function testSendRequest($method, $uri, array $headers, $body)
23
    {
24
        if (defined('HHVM_VERSION')) {
25
            static::markTestSkipped('This test can not run under HHVM');
26
        }
27
        if (null !== $body && in_array($method, ['GET', 'HEAD', 'TRACE'], true)) {
28
            static::markTestSkipped('cURL can not send body using '.$method);
29
        }
30
        parent::testSendRequest($method, $uri, $headers, $body);
31
    }
32
33
    /**
34
     * @dataProvider requestWithOutcomeProvider
35
     * @group        integration
36
     */
37
    public function testSendRequestWithOutcome($uriAndOutcome, $protocolVersion, array $headers, $body)
38
    {
39
        if (null !== $body && '1.0' !== $protocolVersion) {
40
            $this->markTestSkipped('cURL can not send body using GET');
41
        }
42
43
        parent::testSendRequestWithOutcome($uriAndOutcome, $protocolVersion, $headers, $body);
44
    }
45
}
46