StringResourceNodeTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 3
dl 0
loc 47
c 0
b 0
f 0
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetValue() 0 4 1
A testGetLanguageCode() 0 4 1
A testGetValueType() 0 4 1
A testGetType() 0 4 1
A testEquals() 0 4 1
A testNonEquals() 0 3 1
A nonEqualsProvider() 0 12 1
1
<?php
2
3
namespace PPP\DataModel;
4
5
/**
6
 * @covers PPP\DataModel\StringResourceNode
7
 *
8
 * @licence AGPLv3+
9
 * @author Thomas Pellissier Tanon
10
 */
11
class StringResourceNodeTest extends \PHPUnit_Framework_TestCase {
12
13
	public function testGetValue() {
14
		$node = new StringResourceNode('foo');
15
		$this->assertEquals('foo', $node->getValue());
16
	}
17
18
	public function testGetLanguageCode() {
19
		$node = new StringResourceNode('foo', 'fr');
20
		$this->assertEquals('fr', $node->getLanguageCode());
21
	}
22
23
	public function testGetValueType() {
24
		$node = new StringResourceNode('foo');
25
		$this->assertEquals('string', $node->getValueType());
26
	}
27
28
	public function testGetType() {
29
		$node = new StringResourceNode('foo');
30
		$this->assertEquals('resource', $node->getType());
31
	}
32
33
	public function testEquals() {
34
		$node = new StringResourceNode('a');
35
		$this->assertTrue($node->equals(new StringResourceNode('a')));
36
	}
37
38
	/**
39
	 * @dataProvider nonEqualsProvider
40
	 */
41
	public function testNonEquals(ResourceNode $node, $target) {
42
		$this->assertFalse($node->equals($target));
43
	}
44
45
	public function nonEqualsProvider() {
46
		return array(
47
			array(
48
				new StringResourceNode('a'),
49
				new MissingNode()
50
			),
51
			array(
52
				new StringResourceNode('a'),
53
				new StringResourceNode('b')
54
			),
55
		);
56
	}
57
}
58