60 lines
1.8 KiB
PHP
60 lines
1.8 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/NodaWikidataFetcher.php";
|
|
require_once __DIR__ . "/../../MDErrorReporter/exceptions/generic/MDExpectedException.php";
|
|
require_once __DIR__ . "/../../MD_STD/src/MD_STD.php";
|
|
|
|
/**
|
|
* Tests for home page.
|
|
*/
|
|
final class NodaWikidataFetcherTest extends TestCase {
|
|
/**
|
|
* Test to check whether the HTML page is correctly generated.
|
|
*
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
* @group ValidOutput
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testWikidataIdFromLink():void {
|
|
|
|
self::assertEquals(NodaWikidataFetcher::getWikidataIdFromLink("https://www.wikidata.org/wiki/Q106697"), 'Q106697');
|
|
self::assertEquals(NodaWikidataFetcher::getWikidataIdFromLink("https://de.wikipedia.org/wiki/Fedor_Jagor"), 'Q106697');
|
|
|
|
}
|
|
|
|
/**
|
|
* Test to check whether the HTML page is correctly generated.
|
|
*
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
* @group ValidOutput
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testWikidataIdFromWikipediaRequiresWikipediaLink():void {
|
|
|
|
self::assertEquals(NodaWikidataFetcher::getWikidataIdFromWikipedia("https://en.about.museum-digital.org/"), '');
|
|
|
|
}
|
|
|
|
/**
|
|
* Test to check whether the HTML page is correctly generated.
|
|
*
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
* @group ValidOutput
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testCanGetWikidataIdByWikidataId():void {
|
|
|
|
self::assertEquals(NodaWikidataFetcher::getWikidataIdFromWikidataLink("https://www.wikidata.org/wiki/Q106697"), "Q106697");
|
|
|
|
}
|
|
}
|