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
|
|
|
|