Fix edge case 200 b.c. in NodaSplitTime
This commit is contained in:
@ -5,13 +5,16 @@
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\Small;
|
||||
|
||||
/**
|
||||
* This script contains tests for the time name splitter.
|
||||
*
|
||||
* @covers \NodaTimeSplitter
|
||||
*/
|
||||
#[small]
|
||||
#[CoversClass(\NodaTimeSplitter::class)]
|
||||
final class NodaTimeSplitterTest extends TestCase {
|
||||
/**
|
||||
* Test to check whether the HTML page is correctly generated.
|
||||
@ -538,6 +541,19 @@ final class NodaTimeSplitterTest extends TestCase {
|
||||
*/
|
||||
public function testSplitSimpleDatesHungarian():void {
|
||||
|
||||
$output = NodaTimeSplitter::attempt_splitting("Kr. e. 2. század");
|
||||
self::assertNotEmpty($output);
|
||||
self::assertEquals($output->toOldFormat(), [
|
||||
0 => "-200",
|
||||
1 => "-101",
|
||||
2 => "00",
|
||||
3 => "00",
|
||||
4 => "-",
|
||||
5 => "",
|
||||
]);
|
||||
self::assertEquals($output->toTimeName(), "200-101 v. Chr.");
|
||||
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 150);
|
||||
|
||||
$output = NodaTimeSplitter::attempt_splitting("2020.01.02.");
|
||||
self::assertNotEmpty($output);
|
||||
self::assertEquals($output->toOldFormat(), [
|
||||
|
Reference in New Issue
Block a user