OptionsTest::testAddOption()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace SBL\Tests;
4
5
use SBL\Options;
6
use SMW\Tests\PHPUnitCompat;
7
8
/**
9
 * @covers \SBL\Options
10
 * @group semantic-breadcrumb-links
11
 *
12
 * @license GNU GPL v2+
13
 * @since   1.2
14
 *
15
 * @author mwjames
16
 */
17
class OptionsTest extends \PHPUnit_Framework_TestCase {
18
19
	use PHPUnitCompat;
20
21
	public function testCanConstruct() {
22
23
		$this->assertInstanceOf(
24
			'\SBL\Options',
25
			new Options()
26
		);
27
	}
28
29
	public function testAddOption() {
30
31
		$instance = new Options();
32
33
		$this->assertFalse(
34
			$instance->has( 'Foo' )
35
		);
36
37
		$instance->set( 'Foo', 42 );
38
39
		$this->assertEquals(
40
			42,
41
			$instance->get( 'Foo' )
42
		);
43
	}
44
45
	public function testUnregisteredKeyThrowsException() {
46
47
		$instance = new Options();
48
49
		$this->setExpectedException( 'InvalidArgumentException' );
50
		$instance->get( 'Foo' );
51
	}
52
53
}
54