2020-09-26 13:20:22 +02:00
|
|
|
<?PHP
|
|
|
|
/**
|
|
|
|
* This script contains tests for the home page.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
*/
|
|
|
|
declare(strict_types = 1);
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
require __DIR__ . "/../src/NodaTimeAutotranslater.php";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests for home page.
|
|
|
|
*/
|
|
|
|
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 testCanTranslateSingleDay():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_beginn" => "1920",
|
|
|
|
"zeit_ende" => "1920",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1920",
|
|
|
|
"zeit_zaehlzeit_monat" => "05",
|
|
|
|
"zeit_zaehlzeit_tag" => "01",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "01.05.1920");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-26 16:02:18 +02:00
|
|
|
/**
|
|
|
|
* 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);
|
2020-09-26 16:10:26 +02:00
|
|
|
self::assertEquals($output["de"], "01.05.20 n. Chr.");
|
2020-09-26 16:02:18 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-26 13:20:22 +02:00
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateSingleDayBeforeCommonEra():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_beginn" => "-1920",
|
|
|
|
"zeit_ende" => "-1920",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1920",
|
|
|
|
"zeit_zaehlzeit_monat" => "05",
|
|
|
|
"zeit_zaehlzeit_tag" => "01",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "01.05.1920 v. Chr.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateSingleMonth():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_beginn" => "1920",
|
|
|
|
"zeit_ende" => "1920",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1920",
|
|
|
|
"zeit_zaehlzeit_monat" => "02",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "Februar 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 testCanTranslateSingleMonthBeforeCommonEra():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_beginn" => "-1920",
|
|
|
|
"zeit_ende" => "-1920",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1920",
|
|
|
|
"zeit_zaehlzeit_monat" => "02",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "Februar 1920 v. Chr.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-26 15:30:30 +02:00
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateDecade():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_beginn" => "1920",
|
|
|
|
"zeit_ende" => "1929",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1925",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "1920er Jahre");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-26 13:20:22 +02:00
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateDecades():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_beginn" => "1920",
|
|
|
|
"zeit_ende" => "1939",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1930",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "1920-1930er Jahre");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-26 15:30:30 +02:00
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testTranslateDecadeBeforeCommonEraAsTimespan():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_beginn" => "-10",
|
|
|
|
"zeit_ende" => "-1",
|
|
|
|
"zeit_zaehlzeit_jahr" => "0005",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "10-1 v. Chr.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-26 16:02:18 +02:00
|
|
|
/**
|
|
|
|
* 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.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-26 13:20:22 +02:00
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateCentury():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_beginn" => "1901",
|
|
|
|
"zeit_ende" => "2000",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1950",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "20. Jahrhundert");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateCenturies():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_beginn" => "1801",
|
|
|
|
"zeit_ende" => "2000",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1900",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "19.-20. Jahrhundert");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateCenturyBeforeCommonEra():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_beginn" => "-2000",
|
|
|
|
"zeit_ende" => "-1901",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1950",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "20. Jahrhundert v. Chr.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateCenturiesBeforeCommonEra():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
2020-10-04 18:21:33 +02:00
|
|
|
"zeit_name" => "20.-19. Jahrhundert v. Chr.",
|
2020-09-26 13:20:22 +02:00
|
|
|
"zeit_beginn" => "-2000",
|
|
|
|
"zeit_ende" => "-1801",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1900",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "20.-19. Jahrhundert v. Chr.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateYYYYUntilYYYY():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
2020-10-04 18:21:33 +02:00
|
|
|
"zeit_name" => "1000-1150",
|
2020-09-26 13:20:22 +02:00
|
|
|
"zeit_beginn" => "1000",
|
|
|
|
"zeit_ende" => "1150",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1075",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "1000-1150");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateSingleYear():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
2020-10-04 18:21:33 +02:00
|
|
|
"zeit_name" => "1000",
|
2020-09-26 13:20:22 +02:00
|
|
|
"zeit_beginn" => "1000",
|
|
|
|
"zeit_ende" => "1000",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1000",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "1000");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-26 15:10:06 +02:00
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateSingleThreeDigitYearBeforeCommonEra():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
2020-10-04 18:21:33 +02:00
|
|
|
"zeit_name" => "100 v. Chr.",
|
2020-09-26 15:10:06 +02:00
|
|
|
"zeit_beginn" => "-100",
|
|
|
|
"zeit_ende" => "-100",
|
|
|
|
"zeit_zaehlzeit_jahr" => "100",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "100 v. Chr.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-26 13:20:22 +02:00
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateSingleYearBeforeCommonEra():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
2020-10-04 18:21:33 +02:00
|
|
|
"zeit_name" => "1000 v. Chr.",
|
2020-09-26 13:20:22 +02:00
|
|
|
"zeit_beginn" => "-1000",
|
|
|
|
"zeit_ende" => "-1000",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1000",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "1000 v. Chr.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateYYYYUntilYYYYBefore1000():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
2020-10-04 18:21:33 +02:00
|
|
|
"zeit_name" => "800-850 n. Chr.",
|
2020-09-26 13:20:22 +02:00
|
|
|
"zeit_beginn" => "800",
|
|
|
|
"zeit_ende" => "850",
|
|
|
|
"zeit_zaehlzeit_jahr" => "0825",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "800-850 n. Chr.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateYYYYUntilYYYYBeforeCommonEra():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
2020-10-04 18:21:33 +02:00
|
|
|
"zeit_name" => "1156-1102 v. Chr.",
|
2020-09-26 13:20:22 +02:00
|
|
|
"zeit_beginn" => "-1156",
|
|
|
|
"zeit_ende" => "-1102",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1075",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "1156-1102 v. Chr.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateSinceSingleDay():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
2020-10-04 18:21:33 +02:00
|
|
|
"zeit_name" => "Seit 01.05.1920",
|
2020-09-26 13:20:22 +02:00
|
|
|
"zeit_beginn" => "1920",
|
|
|
|
"zeit_ende" => "?",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1920",
|
|
|
|
"zeit_zaehlzeit_monat" => "05",
|
|
|
|
"zeit_zaehlzeit_tag" => "01",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "Seit 01.05.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 testCanTranslateSinceSingleMonth():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
2020-10-04 18:21:33 +02:00
|
|
|
"zeit_name" => "Seit Mai 1920",
|
2020-09-26 13:20:22 +02:00
|
|
|
"zeit_beginn" => "1920",
|
|
|
|
"zeit_ende" => "?",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1920",
|
|
|
|
"zeit_zaehlzeit_monat" => "05",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "Seit Mai 1920");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-10-04 18:21:33 +02:00
|
|
|
/**
|
|
|
|
* Test to check whether the HTML page is correctly generated.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
* @group ValidOutput
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testCanTranslateAfterSingleYear():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_name" => "Nach 1919",
|
|
|
|
"zeit_beginn" => "1920",
|
|
|
|
"zeit_ende" => "?",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1919",
|
|
|
|
"zeit_zaehlzeit_monat" => "00",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "Nach 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 testCanTranslateAfterSingleMonth():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_name" => "Nach April 1920",
|
|
|
|
"zeit_beginn" => "1920",
|
|
|
|
"zeit_ende" => "?",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1920",
|
|
|
|
"zeit_zaehlzeit_monat" => "05",
|
|
|
|
"zeit_zaehlzeit_tag" => "00",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "Nach April 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 testCanTranslateAfterSingleDay():void {
|
|
|
|
|
|
|
|
$timeInfo = [
|
|
|
|
"zeit_name" => "Nach 01.12.1919",
|
|
|
|
"zeit_beginn" => "1919",
|
|
|
|
"zeit_ende" => "?",
|
|
|
|
"zeit_zaehlzeit_jahr" => "1919",
|
|
|
|
"zeit_zaehlzeit_monat" => "12",
|
|
|
|
"zeit_zaehlzeit_tag" => "02",
|
|
|
|
];
|
|
|
|
$output = NodaTimeAutotranslater::getTranslations($timeInfo);
|
|
|
|
self::assertEquals($output["de"], "Nach 01.12.1919");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-26 13:20:22 +02:00
|
|
|
}
|