1 | <?php |
||
20 | class EntitySerializationRoundtripTest extends \PHPUnit_Framework_TestCase { |
||
21 | |||
22 | public function itemProvider() { |
||
23 | $empty = new Item( new ItemId( 'Q42' ) ); |
||
24 | |||
25 | $withLabels = new Item(); |
||
26 | $withLabels->setLabel( 'en', 'Nyan Cat' ); |
||
27 | $withLabels->setLabel( 'fr', 'Nyan Cat' ); |
||
28 | |||
29 | $withDescriptions = new Item(); |
||
30 | $withDescriptions->setDescription( 'en', 'Nyan Cat' ); |
||
31 | $withDescriptions->setDescription( 'fr', 'Nyan Cat' ); |
||
32 | |||
33 | $withAliases = new Item(); |
||
34 | $withAliases->setAliases( 'en', array( 'Cat', 'My cat' ) ); |
||
35 | $withAliases->setAliases( 'fr', array( 'Cat' ) ); |
||
36 | |||
37 | $withStatements = new Item(); |
||
38 | $withStatements->getStatements()->addNewStatement( new PropertyNoValueSnak( 42 ), null, null, 'guid' ); |
||
39 | |||
40 | $withSiteLinks = new Item(); |
||
41 | $withSiteLinks->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Nyan Cat' ); |
||
42 | |||
43 | return [ |
||
44 | [ $empty ], |
||
45 | [ $withLabels ], |
||
46 | [ $withDescriptions ], |
||
47 | [ $withAliases ], |
||
48 | [ $withStatements ], |
||
49 | [ $withSiteLinks ], |
||
50 | ]; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @dataProvider itemProvider |
||
55 | */ |
||
56 | public function testItemSerializationRoundtrips( Item $item ) { |
||
65 | |||
66 | public function propertyProvider() { |
||
71 | |||
72 | /** |
||
73 | * @dataProvider propertyProvider |
||
74 | */ |
||
75 | public function testPropertySerializationRoundtrips( Property $property ) { |
||
84 | |||
85 | private function newSerializerFactory() { |
||
88 | |||
89 | private function newDeserializerFactory() { |
||
92 | |||
93 | } |
||
94 |