summaryrefslogtreecommitdiff
blob: 24c344901353653755cddbb8aa3ae38dc0b27bb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php

namespace SMW\Tests\Configuration;

use SMW\Configuration\Configuration;

use ReflectionClass;

/**
 * @covers \SMW\Configuration\Configuration
 *
 * @ingroup Test
 *
 * @group SMW
 * @group SMWExtension
 *
 * @licence GNU GPL v2+
 * @since 1.9.1
 *
 * @author mwjames
 */
class ConfigurationTest extends \PHPUnit_Framework_TestCase {

	public function getClass() {
		return '\SMW\Configuration\Configuration';
	}

	public function testCanConstruct() {
		$this->assertInstanceOf( $this->getClass(), new Configuration );
	}

	public function testGet() {

		$instance = new Configuration;

		$reflector = new ReflectionClass( $this->getClass() );
		$container = $reflector->getProperty( 'container' );
		$container->setAccessible( true );
		$container->setValue( $instance, array( 'Foo' => 'Fuyu' ) );

		$this->assertEquals( 'Fuyu', $instance->get( 'Foo' ) );

	}

	public function testGetThrowsException() {

		$this->setExpectedException( 'InvalidArgumentException' );

		$instance = new Configuration;
		$this->assertEquals( 'Fuyu', $instance->get( 9001 ) );

	}

}