Allow automatic translations of days before 1000 CE

This commit is contained in:
2020-09-26 16:02:18 +02:00
committed by Stefan Rohde-Enslin
parent b405855fc2
commit c9d8d4bdbd
4 changed files with 133 additions and 4 deletions

View File

@ -35,6 +35,50 @@ final class NodaTimeAutotranslaterTest extends TestCase {
}
/**
* Test to check whether the HTML page is correctly generated.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
* @group ValidOutput
*
* @return void
*/
public function testCanTranslateSingleDayWith2DigitYear():void {
$timeInfo = [
"zeit_beginn" => "20",
"zeit_ende" => "20",
"zeit_zaehlzeit_jahr" => "0020",
"zeit_zaehlzeit_monat" => "05",
"zeit_zaehlzeit_tag" => "01",
];
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
self::assertEquals($output["de"], "01.05.20");
}
/**
* Test to check whether the HTML page is correctly generated.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
* @group ValidOutput
*
* @return void
*/
public function testCanTranslateSingleDayWith2DigitYearBeforeCommonEra():void {
$timeInfo = [
"zeit_beginn" => "-20",
"zeit_ende" => "-20",
"zeit_zaehlzeit_jahr" => "0020",
"zeit_zaehlzeit_monat" => "05",
"zeit_zaehlzeit_tag" => "01",
];
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
self::assertEquals($output["de"], "01.05.20 v. Chr.");
}
/**
* Test to check whether the HTML page is correctly generated.
*
@ -167,6 +211,28 @@ final class NodaTimeAutotranslaterTest extends TestCase {
}
/**
* Test to check whether the HTML page is correctly generated.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
* @group ValidOutput
*
* @return void
*/
public function testTranslateDecadeBeforeCommonEraAsTimespan4Digits():void {
$timeInfo = [
"zeit_beginn" => "-1910",
"zeit_ende" => "-1901",
"zeit_zaehlzeit_jahr" => "0005",
"zeit_zaehlzeit_monat" => "00",
"zeit_zaehlzeit_tag" => "00",
];
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
self::assertEquals($output["de"], "1910-1901 v. Chr.");
}
/**
* Test to check whether the HTML page is correctly generated.
*