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