MDAllowedValueSets/tests/MDNodaRepositoryTest.php

61 lines
3.2 KiB
PHP
Raw Normal View History

<?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 {
2023-09-01 12:30:47 +02:00
self::assertEquals("XX5034943", MDNodaRepository::bne->validateId("http://datos.bne.es/persona/XX5034943"));
self::assertEquals("XX5034943", MDNodaRepository::bne->validateId("XX5034943"));
// GND (Germany)
self::assertEquals("102423008", MDNodaRepository::gnd->validateId("https://d-nb.info/gnd/102423008"));
self::assertEquals("102423008", MDNodaRepository::gnd->validateId("http://d-nb.info/gnd/102423008"));
self::assertEquals("102423008", MDNodaRepository::gnd->validateId("102423008"));
// NDL (Japan)
self::assertEquals("00967046", MDNodaRepository::ndl->validateId("00967046"));
self::assertEquals("00967046", MDNodaRepository::ndl->validateId("https://id.ndl.go.jp/auth/ndlna/00967046"));
self::assertEquals("00967046", MDNodaRepository::ndl->validateId("http://id.ndl.go.jp/auth/ndlna/00967046"));
// NPG: National Portrait Gallery
self::assertEquals('mp01751', MDNodaRepository::npg->validateId("https://www.npg.org.uk/collections/search/person/mp01751"));
// Library of Congress
self::assertEquals("n2022014604", MDNodaRepository::loc->validateId("https://id.loc.gov/authorities/names/n2022014604"));
self::assertEquals("n2022014604", MDNodaRepository::loc->validateId("http://id.loc.gov/authorities/names/n2022014604"));
self::assertEquals("n2022014604", MDNodaRepository::loc->validateId("n2022014604"));
self::assertEquals("sh2022014604", MDNodaRepository::lcsh->validateId("https://id.loc.gov/authorities/names/sh2022014604"));
self::assertEquals("sh2022014604", MDNodaRepository::lcsh->validateId("http://id.loc.gov/authorities/names/sh2022014604"));
self::assertEquals("sh2022014604", MDNodaRepository::lcsh->validateId("sh2022014604"));
self::assertEquals("sh85081569", MDNodaRepository::lcsh->validateId("http://id.loc.gov/authorities/subjects/sh85081569.html"));
2023-09-01 12:30:47 +02:00
self::assertEquals("PIM71684", MDNodaRepository::pim->validateId("PIM71684"));
self::assertEquals("PIM71684", MDNodaRepository::pim->validateId("https://opac-nevter.pim.hu/en/record/-/record/PIM71684"));
self::assertEquals("PIM71684", MDNodaRepository::pim->validateId("https://resolver.pim.hu/auth/PIM71684"));
self::assertEquals("86145857811423020454", MDNodaRepository::viaf->validateId("86145857811423020454"));
self::assertEquals("2869150688328112660005", MDNodaRepository::viaf->validateId("2869150688328112660005"));
self::assertEquals("248941990", MDNodaRepository::viaf->validateId("https://viaf.org/viaf/248941990"));
self::assertEquals("248941990", MDNodaRepository::viaf->validateId("http://viaf.org/viaf/248941990"));
2023-07-27 19:24:16 +02:00
}
}