ModuleResponseSerializerTest::testSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 2
Metric Value
c 3
b 0
f 2
dl 0
loc 17
rs 9.4285
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
3
namespace PPP\Module\DataModel\Serializers;
4
5
use PPP\DataModel\MissingNode;
6
use PPP\DataModel\Serializers\MissingNodeSerializer;
7
use PPP\Module\DataModel\ModuleResponse;
8
9
/**
10
 * @covers PPP\Module\DataModel\Serializers\ModuleResponseSerializer
11
 *
12
 * @licence MIT
13
 * @author Thomas Pellissier Tanon
14
 */
15
class ModuleResponseSerializerTest extends \PHPUnit_Framework_TestCase {
16
17
	public function testSerialize() {
18
		$serializer = new ModuleResponseSerializer(new MissingNodeSerializer());
19
		$this->assertEquals(
20
			array(
21
				'language' => 'en',
22
				'tree' => array('type' => 'missing'),
23
				'measures' => (object) array('accuracy' => 1),
24
				'trace' => array('a')
25
			),
26
			$serializer->serialize(new ModuleResponse(
27
				'en',
28
				new MissingNode(),
29
				array('accuracy' => 1),
30
				array('a')
31
			))
32
		);
33
	}
34
}
35