Added additional variants of nomisma, iconclass IDs
This commit is contained in:
@@ -408,8 +408,13 @@ final class MDNodaRepositoryTest extends TestCase {
|
||||
public static function iconclassIdForValidationProvider():Generator {
|
||||
|
||||
yield "45C221 ; url, http" => ["45C221", "http://iconclass.org/rkd/45C221"];
|
||||
yield "45C221 ; url, http, www." => ["45C221", "http://www.iconclass.org/rkd/45C221"];
|
||||
yield "45C221 ; url, http, www., trailing slash" => ["45C221", "http://www.iconclass.org/rkd/45C221/"];
|
||||
yield "45C221 ; url, https" => ["45C221", "http://iconclass.org/rkd//45C221"];
|
||||
yield "45C221(+321) ; url, https" => ["45C221(+321)", "http://iconclass.org/rkd//45C221(+321)"];
|
||||
yield "45C221 ; ID" => ["45C221", "45C221"];
|
||||
yield "45C221(+321) ; ID" => ["45C221(+321)", "45C221(+321)"];
|
||||
yield "45C221(%2B321) > 45C221(+321) ; ID" => ["45C221(+321)", "45C221(%2B321)"];
|
||||
yield "Broken input / adfdasjfklasäj%l" => [false, "adfdasjfklasäj%l"];
|
||||
|
||||
}
|
||||
@@ -429,6 +434,36 @@ final class MDNodaRepositoryTest extends TestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for validating nomisma entries.
|
||||
*
|
||||
* @return Generator<string, array{0: string|false, 1: string}>
|
||||
*/
|
||||
public static function nomismaIdForValidationProvider():Generator {
|
||||
|
||||
yield "1234 (url, https)" => ["1234", "https://nomisma.org/id/1234"];
|
||||
yield "1234" => ["1234", "https://nomisma.org/id/1234"];
|
||||
yield "glass (url, https)" => ["glass", "https://nomisma.org/id/glass"];
|
||||
yield "glass" => ["glass", "glass"];
|
||||
yield "Broken input / empty string" => [false, ""];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure validating nomisma references.
|
||||
*
|
||||
* @param string|false $expected Expected output.
|
||||
* @param string $inputString Input string.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[DataProvider('nomismaIdForValidationProvider')]
|
||||
public function testNomismaIdValidation(string|false $expected, string $inputString):void {
|
||||
|
||||
self::assertEquals($expected, MDNodaRepository::nomisma->validateId($inputString));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests conversion of already validated and set up entries to strings.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user