| 1 | <?php |
||
| 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 |