Completed
Push — master ( 4bbbcd...b12113 )
by Andy
01:43
created

CurlOptsTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 33
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testOffsetExists() 0 7 1
A testArrayIterator() 0 9 3
A testArrayAccess() 0 11 1
1
<?php
2
3
namespace Palmtree\Curl\Tests;
4
5
use Palmtree\Curl\Curl;
6
use Palmtree\Curl\CurlError;
7
use Palmtree\Curl\CurlOpts;
8
use Palmtree\Curl\Exception\BadMethodCallException;
9
use Palmtree\Curl\Exception\CurlErrorException;
10
use Palmtree\Curl\Exception\InvalidArgumentException;
11
use Palmtree\Curl\Tests\Fixtures\WebServer;
12
use PHPUnit\Framework\TestCase;
13
14
class CurlOptsTest extends TestCase
15
{
16
    public function testOffsetExists()
17
    {
18
        $opts = new CurlOpts([
19
            CURLOPT_BINARYTRANSFER => true,
20
        ]);
21
22
        $this->assertTrue(isset($opts[CURLOPT_BINARYTRANSFER]));
23
    }
24
25
    public function testArrayAccess()
26
    {
27
        $opts = new CurlOpts([]);
28
29
        $opts[CURLOPT_BINARYTRANSFER] = true;
30
31
        $this->assertTrue($opts->get(CURLOPT_BINARYTRANSFER));
32
33
        unset($opts[CURLOPT_BINARYTRANSFER]);
34
35
        $this->assertNull($opts->get(CURLOPT_BINARYTRANSFER));
36
    }
37
38
    public function testArrayIterator()
39
    {
40
        $opts = new CurlOpts([
41
            CURLOPT_BINARYTRANSFER => true,
42
        ]);
43
44
        foreach ($opts as $key => $value) {
45
            if ($key === CURLOPT_BINARYTRANSFER) {
46
                $this->assertTrue($value);
47
            }
48
        }
49
    }
50
}
51