Passed
Push — meaningfulInterfaces ( 00ef73...ff2825 )
by no
02:44
created

()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace Tests\Wikibase\DataModel\Serializers;
4
5
use PHPUnit_Framework_TestCase;
6
use Wikibase\DataModel\Serializers\Internal\AliasGroupSerializer;
7
use Wikibase\DataModel\Term\AliasGroup;
8
use Wikibase\DataModel\Term\AliasGroupFallback;
9
10
/**
11
 * @covers Wikibase\DataModel\Serializers\Internal\AliasGroupSerializer
12
 *
13
 * @licence GNU GPL v2+
14
 * @author Bene* < [email protected] >
15
 */
16
class AliasGroupSerializerTest extends PHPUnit_Framework_TestCase {
17
18
	/**
19
	 * @dataProvider serializationProvider
20
	 */
21
	public function testSerialization( $serialization, $object ) {
22
		$serializer = new AliasGroupSerializer();
23
		$this->assertSame( $serialization, $serializer->serialize( $object ) );
24
	}
25
26
	public function serializationProvider() {
27
		return array(
28
			array(
29
				array(),
30
				new AliasGroup( 'en', array() )
31
			),
32
			array(
33
				array(
34
					array( 'language' => 'en', 'value' => 'One' )
35
				),
36
				new AliasGroup( 'en', array( 'One' ) )
37
			),
38
			array(
39
				array(
40
					array( 'language' => 'en', 'value' => 'One' ),
41
					array( 'language' => 'en', 'value' => 'Pony' )
42
				),
43
				new AliasGroup( 'en', array( 'One', 'Pony' ) )
44
			),
45
			array(
46
				array(
47
					array( 'language' => 'de', 'value' => 'One', 'source' => 'fr' ),
48
					array( 'language' => 'de', 'value' => 'Pony', 'source' => 'fr' ),
49
				),
50
				new AliasGroupFallback( 'en', array( 'One', 'Pony' ), 'de', 'fr' )
51
			)
52
		);
53
	}
54
55
}
56