From 3ed218fbac470374296758d033c0ccdfe96df0f9 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sat, 2 Apr 2022 19:34:16 +0200 Subject: [PATCH] Add tests for class NodaUncertaintyHelper --- tests/NodaUncertaintyHelperTest.php | 86 +++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 tests/NodaUncertaintyHelperTest.php diff --git a/tests/NodaUncertaintyHelperTest.php b/tests/NodaUncertaintyHelperTest.php new file mode 100644 index 0000000..1ad2366 --- /dev/null +++ b/tests/NodaUncertaintyHelperTest.php @@ -0,0 +1,86 @@ + + */ +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); + + } +}