Completed
Push — master ( d991f2...2b3b24 )
by Julián
04:04
created

OptionFileTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 28
rs 10
1
<?php
2
3
/*
4
 * A PSR7 aware cURL client (https://github.com/juliangut/spiral).
5
 *
6
 * @license BSD-3-Clause
7
 * @link https://github.com/juliangut/spiral
8
 * @author Julián Gutiérrez <[email protected]>
9
 */
10
11
namespace Jgut\Spiral\Tests\Option;
12
13
use Jgut\Spiral\Option\OptionFile;
14
15
/**
16
 * File option tests.
17
 */
18
class OptionFileTest extends \PHPUnit_Framework_TestCase
19
{
20
    /**
21
     * @expectedException \Jgut\Spiral\Exception\OptionException
22
     */
23
    public function testNoAccess()
24
    {
25
        $option = new OptionFile(CURLOPT_COOKIEFILE);
26
27
        static::assertEquals(CURLOPT_COOKIEFILE, $option->getOption());
28
        static::assertEquals('', $option->getValue());
29
30
        $option->setValue('fake_file');
31
    }
32
33
    public function testAccessors()
34
    {
35
        $file = sys_get_temp_dir() . '/JgutSpiralOptionFile';
36
        touch($file);
37
38
        $option = new OptionFile(CURLOPT_COOKIEFILE);
39
40
        $option->setValue($file);
41
        static::assertEquals($file, $option->getValue());
42
43
        unlink($file);
44
    }
45
}
46