CurlOptsTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

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

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\CurlOpts;
6
use PHPUnit\Framework\TestCase;
7
8
class CurlOptsTest extends TestCase
9
{
10
    public function testOffsetExists()
11
    {
12
        $opts = new CurlOpts([
13
            CURLOPT_BINARYTRANSFER => true,
14
        ]);
15
16
        $this->assertTrue(isset($opts[CURLOPT_BINARYTRANSFER]));
17
    }
18
19
    public function testArrayAccess()
20
    {
21
        $opts = new CurlOpts([]);
22
23
        $opts[CURLOPT_BINARYTRANSFER] = true;
24
25
        $this->assertTrue($opts->get(CURLOPT_BINARYTRANSFER));
26
27
        unset($opts[CURLOPT_BINARYTRANSFER]);
28
29
        $this->assertNull($opts->get(CURLOPT_BINARYTRANSFER));
30
    }
31
32
    public function testArrayIterator()
33
    {
34
        $opts = new CurlOpts([
35
            CURLOPT_BINARYTRANSFER => true,
36
        ]);
37
38
        foreach ($opts as $key => $value) {
39
            if ($key === CURLOPT_BINARYTRANSFER) {
40
                $this->assertTrue($value);
41
            }
42
        }
43
    }
44
}
45