Ensure times can be split despite spaces at random points in given name

This commit is contained in:
Joshua Ramon Enslin 2024-10-23 18:02:23 +02:00
parent 16f36c0852
commit eb371d4270
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -476,6 +476,19 @@ final class NodaTimeSplitterTest extends TestCase {
self::assertEquals($output->toTimeName(), "Bis 1801 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1801);
$output = NodaTimeSplitter::attempt_splitting("15. 11. 1978");
self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1978",
1 => "1978",
2 => "11",
3 => "15",
4 => "+",
5 => "",
]);
self::assertEquals($output->toTimeName(), "15.11.1978");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1978);
$output = NodaTimeSplitter::attempt_splitting("6 November 1978");
self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [