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

ResourceIdentifierFactoryTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 69
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SCI\Tests\DataValues;
4
5
use SCI\DataValues\ResourceIdentifierFactory;
6
7
/**
8
 * @covers \SCI\DataValues\ResourceIdentifierFactory
9
 * @group semantic-cite
10
 *
11
 * @license GNU GPL v2+
12
 * @since 1.0
13
 *
14
 * @author mwjames
15
 */
16
class ResourceIdentifierFactoryTest extends \PHPUnit_Framework_TestCase {
17
18
	public function testCanConstruct() {
19
20
		$this->assertInstanceOf(
21
			'\SCI\DataValues\ResourceIdentifierFactory',
22
			new ResourceIdentifierFactory()
23
		);
24
	}
25
26
	public function testUnknownTypeMatchThrowsException() {
27
28
		$instance = new ResourceIdentifierFactory();
29
30
		$this->expectException( 'RuntimeException' );
31
		$instance->newResourceIdentifierStringValueForType( 'foo' );
32
	}
33
34
	/**
35
	 * @dataProvider typeProvider
36
	 */
37
	public function testUidValueForType( $type ) {
38
39
		$instance = new ResourceIdentifierFactory();
40
41
		$this->assertInstanceOf(
42
			'\SCI\DataValues\ResourceIdentifierStringValue',
43
			$instance->newResourceIdentifierStringValueForType( $type )
44
		);
45
	}
46
47
	public function typeProvider() {
48
49
		$provider[] = [
50
			'DOI'
51
		];
52
53
		$provider[] = [
54
			'VIAF'
55
		];
56
57
		$provider[] = [
58
			'OCLC'
59
		];
60
61
		$provider[] = [
62
			'OLID'
63
		];
64
65
		$provider[] = [
66
			'PMCID'
67
		];
68
69
		$provider[] = [
70
			'PMID'
71
		];
72
73
		$provider[] = [
74
			'pubmed'
75
		];
76
77
		$provider[] = [
78
			'pmc'
79
		];
80
81
		return $provider;
82
	}
83
84
}
85