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

@@ -24,6 +24,54 @@ final class NodaTimeSplitterTest extends TestCase {
*/
public function testSplitSimpleDatesGerman():void {
$output = NodaTimeSplitter::attempt_splitting("02.1.25 v. Chr");
self::assertEquals($output, [
0 => "-25",
1 => "-25",
2 => "01",
3 => "02",
4 => "-",
5 => "",
]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.25 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25);
$output = NodaTimeSplitter::attempt_splitting("2.01.25 v. Chr");
self::assertEquals($output, [
0 => "-25",
1 => "-25",
2 => "01",
3 => "02",
4 => "-",
5 => "",
]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.25 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25);
$output = NodaTimeSplitter::attempt_splitting("02.01.25 v. Chr");
self::assertEquals($output, [
0 => "-25",
1 => "-25",
2 => "01",
3 => "02",
4 => "-",
5 => "",
]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.25 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25);
$output = NodaTimeSplitter::attempt_splitting("2.1.25 v. Chr");
self::assertEquals($output, [
0 => "-25",
1 => "-25",
2 => "01",
3 => "02",
4 => "-",
5 => "",
]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.25 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25);
$output = NodaTimeSplitter::attempt_splitting("2.1.2020");
self::assertEquals($output, [
0 => "2020",