| 1 | <?php |
||
| 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 |