Passed
Pull Request — master (#136)
by None
04:14
created

OptionsTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 35
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SCI\Tests;
4
5
use SCI\Options;
6
7
/**
8
 * @covers \SCI\Options
9
 * @group semantic-cite
10
 *
11
 * @license GNU GPL v2+
12
 * @since   1.0
13
 *
14
 * @author mwjames
15
 */
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