FirstNodeSimplifierTest::buildSimplifier()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace PPP\Module\TreeSimplifier;
4
5
use PPP\DataModel\FirstNode;
6
use PPP\DataModel\IntersectionNode;
7
use PPP\DataModel\MissingNode;
8
use PPP\DataModel\ResourceListNode;
9
use PPP\DataModel\StringResourceNode;
10
11
/**
12
 * @covers PPP\Module\TreeSimplifier\FirstNodeSimplifier
13
 *
14
 * @licence MIT
15
 * @author Thomas Pellissier Tanon
16
 */
17
class FirstNodeSimplifierTest extends NodeSimplifierBaseTest {
18
19
	protected function buildSimplifier() {
20
		return new FirstNodeSimplifier(new NodeSimplifierFactory());
21
	}
22
23
	public function simplifiableProvider() {
24
		return array(
25
			array(
26
				new FirstNode(new ResourceListNode(array()))
27
			)
28
		);
29
	}
30
31
	public function nonSimplifiableProvider() {
32
		return array(
33
			array(
34
				new IntersectionNode(array())
35
			)
36
		);
37
	}
38
39
	public function simplificationProvider() {
40
		return array(
41
			array(
42
				new ResourceListNode(array(
43
					new StringResourceNode('foo')
44
				)),
45
				new FirstNode(new ResourceListNode(array(
46
					new StringResourceNode('foo'),
47
					new StringResourceNode('bar')
48
				)))
49
			),
50
			array(
51
				new ResourceListNode(array()),
52
				new FirstNode(new ResourceListNode(array()))
53
			),
54
			array(
55
				new FirstNode(new MissingNode()),
56
				new FirstNode(new MissingNode())
57
			),
58
		);
59
	}
60
}
61