2022-04-02 19:34:16 +02:00
|
|
|
<?PHP
|
|
|
|
/**
|
2022-05-17 23:27:40 +02:00
|
|
|
* This script contains tests for the uncertainty helper.
|
2022-04-02 19:34:16 +02:00
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
*/
|
|
|
|
declare(strict_types = 1);
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
/**
|
2022-05-17 23:27:40 +02:00
|
|
|
* This script contains tests for the uncertainty helper.
|
2022-04-02 19:34:16 +02:00
|
|
|
*/
|
|
|
|
final class NodaUncertaintyHelperTest extends TestCase {
|
|
|
|
/**
|
|
|
|
* Removes uncertainty indicators from an time name.
|
|
|
|
*
|
2023-11-06 23:46:30 +01:00
|
|
|
* @group ValidOutput
|
|
|
|
* @small
|
|
|
|
*
|
2022-04-02 19:34:16 +02:00
|
|
|
* @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.
|
|
|
|
*
|
2023-11-06 23:46:30 +01:00
|
|
|
* @group ValidOutput
|
|
|
|
* @small
|
|
|
|
*
|
2022-04-02 19:34:16 +02:00
|
|
|
* @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.
|
|
|
|
*
|
2023-11-06 23:46:30 +01:00
|
|
|
* @group ValidOutput
|
|
|
|
* @small
|
|
|
|
*
|
2022-04-02 19:34:16 +02:00
|
|
|
* @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.
|
|
|
|
*
|
2023-11-06 23:46:30 +01:00
|
|
|
* @group ValidOutput
|
|
|
|
* @small
|
|
|
|
*
|
2022-04-02 19:34:16 +02:00
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public static function testGuessPlaceCertainty():void {
|
|
|
|
|
|
|
|
self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("wohl Berlin"), false);
|
|
|
|
self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("Berlin"), true);
|
|
|
|
|
2023-10-27 19:06:08 +02:00
|
|
|
self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("?-Italien"), false);
|
|
|
|
|
2022-04-02 19:34:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes uncertainty indicators from an actor name.
|
|
|
|
*
|
2023-11-06 23:46:30 +01:00
|
|
|
* @group ValidOutput
|
|
|
|
* @small
|
|
|
|
*
|
2022-04-02 19:34:16 +02:00
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public static function testCleanUncertaintyIndicatorsPersinst():void {
|
|
|
|
|
|
|
|
self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsPersinst("wohl Barbarossa"), "Barbarossa");
|
|
|
|
self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsPersinst("Barbarossa"), "Barbarossa");
|
2023-10-27 19:06:08 +02:00
|
|
|
self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsPersinst("?-Barbarossa"), "Barbarossa");
|
2022-04-02 19:34:16 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attempts guessing whether persinst is uncertain.
|
|
|
|
*
|
2023-11-06 23:46:30 +01:00
|
|
|
* @group ValidOutput
|
|
|
|
* @small
|
|
|
|
*
|
2022-04-02 19:34:16 +02:00
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public static function testGuessPersinstCertainty():void {
|
|
|
|
|
|
|
|
self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("wohl Barbarossa"), false);
|
|
|
|
self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("Barbarossa"), true);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|