From eb371d4270acdaf89e86e07e5d09dcaa8d26e486 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Wed, 23 Oct 2024 18:02:23 +0200 Subject: [PATCH] Ensure times can be split despite spaces at random points in given name --- tests/NodaTimeSplitterTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/NodaTimeSplitterTest.php b/tests/NodaTimeSplitterTest.php index ec50ccf..7e3baad 100644 --- a/tests/NodaTimeSplitterTest.php +++ b/tests/NodaTimeSplitterTest.php @@ -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(), [