JsonLdTimeFormatterTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validProvider() 0 12 1
A getInstance() 0 6 1
1
<?php
2
3
namespace PPP\Wikidata\ValueFormatters\JsonLd;
4
5
use DataValues\TimeValue;
6
use PPP\Wikidata\ValueFormatters\IsoTimeFormatter;
7
use ValueFormatters\FormatterOptions;
8
9
/**
10
 * @covers PPP\Wikidata\ValueFormatters\JsonLd\JsonLdTimeFormatter
11
 *
12
 * @licence AGPLv3+
13
 * @author Thomas Pellissier Tanon
14
 */
15
class JsonLdTimeFormatterTest extends JsonLdFormatterTestBase {
16
17
	/**
18
	 * @see JsonLdFormatterTestBase::validProvider
19
	 */
20
	public function validProvider() {
21
		return array(
22
			array(
23
				new TimeValue('+00000001952-03-11T00:00:00Z', 0, 0, 0, TimeValue::PRECISION_DAY, 'http://www.wikidata.org/entity/Q1985786'),
24
				(object) array('@type' => 'Date', '@value' => '1952-03-11')
25
			),
26
			array(
27
				new TimeValue('+00000001952-03-11T01:01:01Z', 90, 0, 0, TimeValue::PRECISION_SECOND, 'http://www.wikidata.org/entity/Q1985786'),
28
				(object) array('@type' => 'DateTime', '@value' => '1952-03-11T01:01:01+01:30')
29
			),
30
		);
31
	}
32
33
	/**
34
	 * @see JsonLdFormatterTestBase::getInstance
35
	 */
36
	protected function getInstance(FormatterOptions $options = null) {
37
		return new JsonLdTimeFormatter(
38
			new IsoTimeFormatter($options),
39
			$options
40
		);
41
	}
42
}
43