*/ declare(strict_types = 1); use PHPUnit\Framework\TestCase; /** * This script contains tests for the uncertainty helper. * * @covers \NodaUncertaintyHelper */ final class NodaUncertaintyHelperTest extends TestCase { /** * Removes uncertainty indicators from an time name. * * @group ValidOutput * @small * * @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. * * @group ValidOutput * @small * * @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. * * @group ValidOutput * @small * * @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. * * @group ValidOutput * @small * * @return void */ public static function testGuessPlaceCertainty():void { self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("wohl Berlin"), false); self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("Berlin"), true); self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("?-Italien"), false); } /** * Removes uncertainty indicators from an actor name. * * @group ValidOutput * @small * * @return void */ public static function testCleanUncertaintyIndicatorsPersinst():void { self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsPersinst("wohl Barbarossa"), "Barbarossa"); self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsPersinst("Barbarossa"), "Barbarossa"); self::assertEquals(NodaUncertaintyHelper::cleanUncertaintyIndicatorsPersinst("?-Barbarossa"), "Barbarossa"); } /** * Attempts guessing whether persinst is uncertain. * * @group ValidOutput * @small * * @return void */ public static function testGuessPersinstCertainty():void { self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("wohl Barbarossa"), false); self::assertEquals(NodaUncertaintyHelper::guessPlaceCertainty("Barbarossa"), true); } }