Enable automatic translations of times "before" a given date

This commit is contained in:
2020-10-04 19:34:17 +02:00
committed by Stefan Rohde-Enslin
parent 1685d78f65
commit 1f4d692fb5
2 changed files with 102 additions and 0 deletions

View File

@ -575,4 +575,73 @@ 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 testCanTranslateBeforeSingleYear():void {
$timeInfo = [
"zeit_name" => "Vor 1919",
"zeit_beginn" => "?",
"zeit_ende" => "1918",
"zeit_zaehlzeit_jahr" => "1919",
"zeit_zaehlzeit_monat" => "00",
"zeit_zaehlzeit_tag" => "00",
];
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
self::assertEquals($output["de"], "Vor 1919");
}
/**
* Test to check whether the HTML page is correctly generated.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
* @group ValidOutput
*
* @return void
*/
public function testCanTranslateBeforeSingleMonth():void {
$timeInfo = [
"zeit_name" => "Vor Mai 1920",
"zeit_beginn" => "?",
"zeit_ende" => "1920",
"zeit_zaehlzeit_jahr" => "1920",
"zeit_zaehlzeit_monat" => "05",
"zeit_zaehlzeit_tag" => "00",
];
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
self::assertEquals($output["de"], "Vor Mai 1920");
}
/**
* Test to check whether the HTML page is correctly generated.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
* @group ValidOutput
*
* @return void
*/
public function testCanTranslateBeforeSingleDay():void {
$timeInfo = [
"zeit_name" => "Vor 01.12.1919",
"zeit_beginn" => "?",
"zeit_ende" => "1919",
"zeit_zaehlzeit_jahr" => "1919",
"zeit_zaehlzeit_monat" => "12",
"zeit_zaehlzeit_tag" => "01",
];
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
self::assertEquals($output["de"], "Vor 01.12.1919");
}
}