SettingsTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructor() 0 9 2
A constructorProvider() 0 16 2
1
<?php
2
3
namespace Tests\Unit\SubPageList;
4
5
use PHPUnit\Framework\TestCase;
6
use SubPageList\Settings;
7
8
/**
9
 * @covers \SubPageList\Settings
10
 *
11
 * @group SubPageList
12
 *
13
 * @licence GNU GPL v2+
14
 * @author Jeroen De Dauw < [email protected] >
15
 */
16
class SettingsTest extends TestCase {
17
18
	/**
19
	 * @dataProvider constructorProvider
20
	 *
21
	 * @param array $settings
22
	 */
23
	public function testConstructor( array $settings ) {
24
		$settingsObject = new Settings( $settings );
25
26
		foreach ( $settings as $name => $value ) {
27
			$this->assertEquals( $value, $settingsObject->get( $name ) );
28
		}
29
30
		$this->assertTrue( true );
31
	}
32
33
	public function constructorProvider() {
34
		$settingArrays = [
35
			[],
36
			[ 'foo' => 'bar' ],
37
			[ 'foo' => 'bar', 'baz' => 'BAH' ],
38
			[ '~[,,_,,]:3' => [ 9001, 4.2 ] ],
39
		];
40
41
		$argLists = [];
42
43
		foreach ( $settingArrays as $settingArray ) {
44
			$argLists[] = [ $settingArray ];
45
		}
46
47
		return $argLists;
48
	}
49
50
}
51