ClaimQuerySerializerTest::serializationProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 12
rs 9.4285
1
<?php
2
3
namespace WikidataQueryApi\Query\Serializers;
4
5
use Wikibase\DataModel\Entity\ItemId;
6
use Wikibase\DataModel\Entity\PropertyId;
7
use WikidataQueryApi\Query\ClaimQuery;
8
9
/**
10
 * @covers WikidataQueryApi\Query\Serializers\ClaimQuerySerializer
11
 *
12
 * @licence GPLv2+
13
 * @author Thomas Pellissier Tanon
14
 */
15
class ClaimQuerySerializerTest extends SerializerBaseTest {
16
17
	public function buildSerializer() {
18
		return new ClaimQuerySerializer();
19
	}
20
21
	public function serializableProvider() {
22
		return [
23
			[
24
				new ClaimQuery( new PropertyId( 'P42' ), new ItemId( 'Q42' ) )
25
			],
26
			[
27
				new ClaimQuery( new PropertyId( 'P42' ) )
28
			],
29
		];
30
	}
31
32
	public function nonSerializableProvider() {
33
		return [
34
			[
35
				5
36
			],
37
			[
38
				[]
39
			],
40
			[
41
				new ItemId( 'Q42' )
42
			],
43
		];
44
	}
45
46
	public function serializationProvider() {
47
		return [
48
			[
49
				'claim[42:42]',
50
				new ClaimQuery( new PropertyId( 'P42' ), new ItemId( 'Q42' ) )
51
			],
52
			[
53
				'claim[42]',
54
				new ClaimQuery( new PropertyId( 'P42' ) )
55
			],
56
		];
57
	}
58
}
59