summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Bootstrap/tests/phpunit/Definition/V3ModuleDefinitionTest.php
blob: cb52a6ae6161f7653f8ebe845d62a7aa3e9d7ae7 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php

namespace Bootstrap\Tests\Definition;

use Bootstrap\Definition\V3ModuleDefinition;
use Bootstrap\BootstrapManager;

/**
 * @uses \Bootstrap\Definition\V3ModuleDefinition
 *
 * @ingroup Test
 *
 * @group extension-bootstrap
 * @group mediawiki-databaseless
 *
 * @license GNU GPL v3+
 * @since 1.0
 *
 * @author mwjames
 */
class V3ModuleDefinitionTest extends \PHPUnit_Framework_TestCase {

	public function testCanConstruct() {

		$this->assertInstanceOf(
			'\Bootstrap\Definition\ModuleDefinition',
			new V3ModuleDefinition()
		);
	}

	/**
	 * @dataProvider keyProvider
	 */
	public function testGet( $key ) {

		$instance = new V3ModuleDefinition();

		$this->assertInternalType(
			'array',
			$instance->get( $key )
		);
	}

	public function testBootstrapManagerIntegration() {

		$instance = new BootstrapManager( new V3ModuleDefinition() );
		$instance->addAllBootstrapModules();

		$this->assertTrue( true );
	}

	public function testGetOnInvalidKeyThrowsException() {

		$instance = new V3ModuleDefinition();

		$this->setExpectedException( 'InvalidArgumentException' );
		$instance->get( 'Foo' );
	}

	public function keyProvider() {

		$provider = array(
			array( 'core' ),
			array( 'optional' ),
			array( 'descriptions' )
		);

		return $provider;
	}

}