ExtensionTest::testConstructor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Tests\Unit\SubPageList;
4
5
use PHPUnit\Framework\TestCase;
6
use SubPageList\Extension;
7
use SubPageList\Settings;
8
9
/**
10
 * @covers \SubPageList\Extension
11
 *
12
 * @group SubPageList
13
 *
14
 * @licence GNU GPL v2+
15
 * @author Jeroen De Dauw < [email protected] >
16
 */
17
class ExtensionTest extends TestCase {
18
19
	/**
20
	 * @dataProvider constructorProvider
21
	 *
22
	 * @param Settings $settings
23
	 */
24
	public function testConstructor( Settings $settings ) {
25
		$extension = new Extension( $settings );
26
27
		$this->assertEquals( $settings, $extension->getSettings() );
28
	}
29
30
	public function constructorProvider() {
31
		$argLists = [
32
			[ Settings::newFromGlobals( $GLOBALS ) ]
33
		];
34
35
		return $argLists;
36
	}
37
38
	/**
39
	 * @dataProvider instanceProvider
40
	 *
41
	 * @param Extension $extension
42
	 */
43
	public function testGetSlaveConnectionProvider( Extension $extension ) {
44
		$this->assertInstanceOf( 'SubPageList\DBConnectionProvider', $extension->getSlaveConnectionProvider() );
45
	}
46
47
	public function instanceProvider() {
48
		$argLists = [];
49
50
		$argLists[] = [ new Extension( Settings::newFromGlobals( $GLOBALS ) ) ];
51
52
		return $argLists;
53
	}
54
55
	/**
56
	 * @dataProvider instanceProvider
57
	 *
58
	 * @param Extension $extension
59
	 */
60
	public function testGetCacheInvalidator( Extension $extension ) {
61
		$this->assertInstanceOf( 'SubPageList\CacheInvalidator', $extension->getCacheInvalidator() );
62
	}
63
64
}
65