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

CurlOptsTest::testOffsetExists()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
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