SerializerFactoryTest::testNewNodeSerializer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
c 0
b 0
f 0
rs 9.0856
nc 1
cc 1
eloc 16
nop 0
1
<?php
2
3
namespace PPP\DataModel;
4
use PPP\DataModel\Serializers\BasicResourceNodeSerializer;
5
6
/**
7
 * @covers PPP\DataModel\SerializerFactory
8
 *
9
 * @licence AGPLv3+
10
 * @author Thomas Pellissier Tanon
11
 */
12
class SerializerFactoryTest extends \PHPUnit_Framework_TestCase {
13
14
	public function testNewNodeSerializer() {
15
		$factory = new SerializerFactory(array(new BasicResourceNodeSerializer('test')));
16
		$this->assertEquals(
17
			array(
18
				'type' => 'triple',
19
				'subject' => array('type' => 'resource', 'value' => 's', 'value-type' => 'string'),
20
				'predicate' => array(
21
					'type'=> 'union',
22
					'list' => array(
23
						array('type' => 'sentence', 'value' => 'p')
24
					)
25
				),
26
				'object' => array('type' => 'missing')
27
			),
28
			$factory->newNodeSerializer()->serialize(
29
				new TripleNode(
30
					new ResourceListNode(array(new StringResourceNode('s'))),
31
					new UnionNode(array(new SentenceNode('p'))),
32
					new MissingNode()
33
				)
34
			)
35
		);
36
	}
37
}
38