Continue refactoring tests for time splitter to run provider-based

This commit is contained in:
Joshua Ramon Enslin 2025-02-24 14:02:42 +01:00
parent dbfa0df17f
commit d9d9f7fcdc
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
2 changed files with 587 additions and 645 deletions

View File

@ -752,8 +752,15 @@ final class NodaTimeSplitter {
return new NodaSplitTime($year, $year); return new NodaSplitTime($year, $year);
} }
if (\preg_match("/^[0-9]{4}$/", \strtr($inpDateWoSpaces, ['-0' => '', '0-' => '', 'o' => '0']))) { // German Y-m if (str_starts_with($inpDateWoSpaces, '0-') || str_ends_with($inpDateWoSpaces, '-0') && \preg_match("/^[0-9]{4}$/", \strtr($inpDateWoSpaces, ['-0' => '', '0-' => '']))) {
$year = \strtr($inpDateWoSpaces, ['-0' => '', '0-' => '', 'o' => '0']); $year = \strtr($inpDateWoSpaces, ['-0' => '', '0-' => '']);
if (strlen($year) === 4) {
return new NodaSplitTime($year, $year);
}
}
if (\preg_match("/^[0-9]{4}$/", \strtr($inpDateWoSpaces, ['o' => '0']))) { // German Y-m
$year = \strtr($inpDateWoSpaces, ['o' => '0']);
return new NodaSplitTime($year, $year); return new NodaSplitTime($year, $year);
} }
@ -870,7 +877,7 @@ final class NodaTimeSplitter {
$output->counting_time_indicator, NodaTimeBeforeAfterIndicator::until, '?', $output->end_date); $output->counting_time_indicator, NodaTimeBeforeAfterIndicator::until, '?', $output->end_date);
} }
} }
if (str_ends_with($datum, '-as évekig') || str_ends_with($datum, '-es évekig')) { if (str_ends_with($datum, ' as évekig') || str_ends_with($datum, ' es évekig') || str_ends_with($datum, '-as évekig') || str_ends_with($datum, '-es évekig')) {
if ($output = self::attempt_splitting(\substr($datum, 0, -2))) { if ($output = self::attempt_splitting(\substr($datum, 0, -2))) {
return new NodaSplitTime('?', $output->end_year, $output->counting_time_month, $output->counting_time_day, return new NodaSplitTime('?', $output->end_year, $output->counting_time_month, $output->counting_time_day,
$output->counting_time_indicator, NodaTimeBeforeAfterIndicator::until, '?', $output->end_date); $output->counting_time_indicator, NodaTimeBeforeAfterIndicator::until, '?', $output->end_date);

File diff suppressed because it is too large Load Diff