87 lines
2.5 KiB
PHP
87 lines
2.5 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 __DIR__ . "/../src/NodaUncertaintyHelper.php";
|
||
|
|
||
|
/**
|
||
|
* Tests for home page.
|
||
|
*/
|
||
|
final class NodaUncertaintyHelperTest extends TestCase {
|
||
|
/**
|
||
|
* Removes uncertainty indicators from an time name.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function testCleanUncertaintyIndicatorsTime():void {
|
||
|
|
||
|
self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsTime("wohl 1950"), "1950");
|
||
|
self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsTime("1950"), "1950");
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Attempts guessing whether time is uncertain.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function testGuessTimeCertainty():void {
|
||
|
|
||
|
self::assertEquals(NodaUncertaintyHelper::guessTimeCertainty("wohl 1950"), false);
|
||
|
self::assertEquals(NodaUncertaintyHelper::guessTimeCertainty("1950"), true);
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Removes uncertainty indicators from an place name.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public static function testCleanUncertaintyIndicatorsPlace():void {
|
||
|
|
||
|
self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsPlace("wohl Berlin"), "Berlin");
|
||
|
self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsPlace("Berlin"), "Berlin");
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Attempts guessing whether place is uncertain.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public static function testGuessPlaceCertainty():void {
|
||
|
|
||
|
self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("wohl Berlin"), false);
|
||
|
self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("Berlin"), true);
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Removes uncertainty indicators from an actor name.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public static function testCleanUncertaintyIndicatorsPersinst():void {
|
||
|
|
||
|
self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsPersinst("wohl Barbarossa"), "Barbarossa");
|
||
|
self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsPersinst("Barbarossa"), "Barbarossa");
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Attempts guessing whether persinst is uncertain.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public static function testGuessPersinstCertainty():void {
|
||
|
|
||
|
self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("wohl Barbarossa"), false);
|
||
|
self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("Barbarossa"), true);
|
||
|
|
||
|
}
|
||
|
}
|