Fix overly strict validation for npg, ndl
This commit is contained in:
48
tests/MDNodaRepositoryTest.php
Normal file
48
tests/MDNodaRepositoryTest.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?PHP
|
||||
/**
|
||||
* This script contains tests for the home page.
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
require_once __DIR__ . '/../src/enums/MDValueEnumInterface.php';
|
||||
require_once __DIR__ . '/../src/enums/MDNodaRepository.php';
|
||||
|
||||
/**
|
||||
* Tests for home page.
|
||||
*/
|
||||
final class MDNodaRepositoryTest extends TestCase {
|
||||
/**
|
||||
* Tests that valid IDs actually validate as valid.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testValidIdsValidate():void {
|
||||
|
||||
// GND (Germany)
|
||||
self::assertNotFalse(MDNodaRepository::gnd->validateId("https://d-nb.info/gnd/102423008"));
|
||||
self::assertNotFalse(MDNodaRepository::gnd->validateId("http://d-nb.info/gnd/102423008"));
|
||||
self::assertNotFalse(MDNodaRepository::gnd->validateId("102423008"));
|
||||
|
||||
// NDL (Japan)
|
||||
self::assertNotFalse(MDNodaRepository::ndl->validateId("00967046"));
|
||||
self::assertNotFalse(MDNodaRepository::ndl->validateId("https://id.ndl.go.jp/auth/ndlna/00967046"));
|
||||
self::assertNotFalse(MDNodaRepository::ndl->validateId("http://id.ndl.go.jp/auth/ndlna/00967046"));
|
||||
|
||||
// NPG: National Portrait Gallery
|
||||
self::assertNotFalse(MDNodaRepository::npg->validateId("https://www.npg.org.uk/collections/search/person/mp01751"));
|
||||
|
||||
// Library of Congress
|
||||
self::assertNotFalse(MDNodaRepository::loc->validateId("https://id.loc.gov/authorities/names/n2022014604"));
|
||||
self::assertNotFalse(MDNodaRepository::loc->validateId("http://id.loc.gov/authorities/names/n2022014604"));
|
||||
self::assertNotFalse(MDNodaRepository::loc->validateId("n2022014604"));
|
||||
|
||||
|
||||
self::assertNotFalse(MDNodaRepository::loc->validateId("https://id.loc.gov/authorities/names/n2022014604"));
|
||||
self::assertNotFalse(MDNodaRepository::loc->validateId("http://id.loc.gov/authorities/names/n2022014604"));
|
||||
self::assertNotFalse(MDNodaRepository::loc->validateId("n2022014604"));
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user