@ -11,6 +11,7 @@ use PHPUnit\Framework\Attributes\Medium;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
|
||||
require_once __DIR__ . '/../../MDMysqli/test_connections.conf.php';
|
||||
require_once __DIR__ . '/../src/NodaWikidataFetcherDisambiguationIsDisallowedException.php';
|
||||
|
||||
/**
|
||||
* This script contains tests for the Wikidata fetcher.
|
||||
@ -37,6 +38,34 @@ final class NodaWikidataFetcherTest extends TestCase {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider providing a Wikidata ID for a dedicated wikidata item for disambiguation pages.
|
||||
*
|
||||
* @return array<string: array{0: string}>
|
||||
*/
|
||||
public static function disambiguationPageProvider():array {
|
||||
|
||||
return [
|
||||
'Disambiguation page for "Mochi" - Q6916210' => ['Q6916210'],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw error when attempting to load a dedicated wikidata entry for a disambiguation page.
|
||||
*
|
||||
* @param string $wikidata_id Wikidata ID.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[DataProvider('disambiguationPageProvider')]
|
||||
public function testWikidataIdFromLinkFailsForDisambiguationPages(string $wikidata_id):void {
|
||||
|
||||
self::expectException(NodaWikidataFetcherDisambiguationIsDisallowedException::class);
|
||||
NodaWikidataFetcher::getWikidataEntity($wikidata_id);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to check whether the HTML page is correctly generated.
|
||||
*
|
||||
|
Reference in New Issue
Block a user