Allow using Wikidata links for fetching information for actors
This commit is contained in:
		
							
								
								
									
										59
									
								
								tests/NodaWikidataFetcherTest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								tests/NodaWikidataFetcherTest.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,59 @@ | ||||
| <?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"); | ||||
|  | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user