49 lines
2.0 KiB
PHP
49 lines
2.0 KiB
PHP
<?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::lcsh->validateId("https://id.loc.gov/authorities/names/sh2022014604"));
|
|
self::assertNotFalse(MDNodaRepository::lcsh->validateId("http://id.loc.gov/authorities/names/sh2022014604"));
|
|
self::assertNotFalse(MDNodaRepository::lcsh->validateId("sh2022014604"));
|
|
|
|
}
|
|
}
|