| 1 | <?php |
||
| 16 | class CitationResourceMatchFinderTest extends \PHPUnit_Framework_TestCase { |
||
| 17 | |||
| 18 | public function testCanConstruct() { |
||
| 19 | |||
| 20 | $store = $this->getMockBuilder( '\SMW\Store' ) |
||
| 21 | ->disableOriginalConstructor() |
||
| 22 | ->getMockForAbstractClass(); |
||
| 23 | |||
| 24 | $this->assertInstanceOf( |
||
| 25 | '\SCI\CitationResourceMatchFinder', |
||
| 26 | new CitationResourceMatchFinder( $store ) |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @dataProvider uidTypeProvider |
||
| 32 | */ |
||
| 33 | public function testFindMatchForUidTypeOf( $key, $id ) { |
||
| 34 | |||
| 35 | $queryResult = $this->getMockBuilder( '\SMWQueryResult' ) |
||
| 36 | ->disableOriginalConstructor() |
||
| 37 | ->getMock(); |
||
| 38 | |||
| 39 | $store = $this->getMockBuilder( '\SMW\Store' ) |
||
| 40 | ->disableOriginalConstructor() |
||
| 41 | ->getMockForAbstractClass(); |
||
| 42 | |||
| 43 | $store->expects( $this->once() ) |
||
| 44 | ->method( 'getQueryResult' ) |
||
| 45 | ->will( $this->returnValue( $queryResult ) ); |
||
| 46 | |||
| 47 | $instance = new CitationResourceMatchFinder( $store ); |
||
| 48 | |||
| 49 | $instance->findMatchForResourceIdentifierTypeToValue( |
||
| 50 | $key, |
||
| 51 | $id |
||
| 52 | ); |
||
| 53 | } |
||
| 54 | |||
| 55 | public function uidTypeProvider() { |
||
| 56 | |||
| 57 | $provider[] = [ |
||
| 58 | 'oclc', |
||
| 59 | 42 |
||
| 60 | ]; |
||
| 61 | |||
| 62 | $provider[] = [ |
||
| 63 | 'viaf', |
||
| 64 | 42 |
||
| 65 | ]; |
||
| 66 | |||
| 67 | $provider[] = [ |
||
| 68 | 'doi', |
||
| 69 | 42 |
||
| 70 | ]; |
||
| 71 | |||
| 72 | $provider[] = [ |
||
| 73 | 'pmid', |
||
| 74 | 42 |
||
| 75 | ]; |
||
| 76 | |||
| 77 | $provider[] = [ |
||
| 78 | 'pmcid', |
||
| 79 | 42 |
||
| 80 | ]; |
||
| 81 | |||
| 82 | $provider[] = [ |
||
| 83 | 'olid', |
||
| 84 | 42 |
||
| 85 | ]; |
||
| 86 | |||
| 87 | return $provider; |
||
| 88 | } |
||
| 89 | |||
| 90 | } |
||
| 91 |