Passed
Pull Request — master (#136)
by None
04:09
created

PropertyRegistryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 66
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SCI\Tests;
4
5
use SCI\PropertyRegistry;
6
use SMW\PropertyRegistry as CorePropertyRegistry;
7
8
/**
9
 * @covers \SCI\PropertyRegistry
10
 * @group semantic-cite
11
 *
12
 * @license GNU GPL v2+
13
 * @since 1.0
14
 *
15
 * @author mwjames
16
 */
17
class PropertyRegistryTest extends \PHPUnit_Framework_TestCase {
18
19
	public function testCanConstruct() {
20
21
		$this->assertInstanceOf(
22
			'\SCI\PropertyRegistry',
23
			new PropertyRegistry()
24
		);
25
	}
26
27
	/**
28
	 * @dataProvider propertyIdProvider
29
	 */
30
	public function testRegisterTo( $id, $label ) {
31
32
		$corePropertyRegistry = CorePropertyRegistry::getInstance();
33
34
		$instance = new PropertyRegistry();
35
		$instance->registerTo( $corePropertyRegistry );
36
37
		$this->assertNotEmpty(
38
			$corePropertyRegistry->findPropertyLabelById ( $id )
39
		);
40
41
		$this->assertSame(
42
			$label,
43
			$corePropertyRegistry->findPropertyLabelById ( $id )
44
		);
45
	}
46
47
	public function propertyIdProvider() {
48
49
		$provider[] = [
50
			PropertyRegistry::SCI_DOI,
51
			'DOI'
52
		];
53
54
		$provider[] = [
55
			PropertyRegistry::SCI_PMCID,
56
			'PMCID'
57
		];
58
59
		$provider[] = [
60
			PropertyRegistry::SCI_CITE_KEY,
61
			'Citation key'
62
		];
63
64
		$provider[] = [
65
			PropertyRegistry::SCI_CITE_REFERENCE,
66
			'Citation reference'
67
		];
68
69
		$provider[] = [
70
			PropertyRegistry::SCI_CITE_TEXT,
71
			'Citation text'
72
		];
73
74
		$provider[] = [
75
			PropertyRegistry::SCI_CITE,
76
			'Citation resource'
77
		];
78
79
		return $provider;
80
	}
81
82
}
83