Add tests for class NodaUncertaintyHelper

This commit is contained in:
Joshua Ramon Enslin 2022-04-02 19:34:16 +02:00
parent e9309c7584
commit 3ed218fbac
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -0,0 +1,86 @@
<?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);
}
}