| 1 | <?php |
||
| 16 | class OptionsTest extends \PHPUnit_Framework_TestCase { |
||
| 17 | |||
| 18 | public function testCanConstruct() { |
||
| 19 | |||
| 20 | $this->assertInstanceOf( |
||
| 21 | '\SCI\Options', |
||
| 22 | new Options() |
||
| 23 | ); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function testAddOption() { |
||
| 27 | |||
| 28 | $instance = new Options(); |
||
| 29 | |||
| 30 | $this->assertFalse( |
||
| 31 | $instance->has( 'Foo' ) |
||
| 32 | ); |
||
| 33 | |||
| 34 | $instance->set( 'Foo', 42 ); |
||
| 35 | |||
| 36 | $this->assertEquals( |
||
| 37 | 42, |
||
| 38 | $instance->get( 'Foo' ) |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 42 | public function testUnregisteredKeyThrowsException() { |
||
| 43 | |||
| 44 | $instance = new Options(); |
||
| 45 | |||
| 46 | $this->expectException( 'InvalidArgumentException' ); |
||
| 47 | $instance->get( 'Foo' ); |
||
| 48 | } |
||
| 49 | |||
| 50 | } |
||
| 51 |