Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Aug 6, 2024
1 parent 4f4b066 commit ac1d390
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/filters/localDate.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

/**
* Test: Latte\Essential\Filters::localDate()
* @phpVersion 8.1
*/

declare(strict_types=1);
Expand Down Expand Up @@ -44,14 +43,16 @@ test('timestamp & zone', function () {
Assert::same('7:09', $filters->localDate(1_408_284_571, 'jm'));
});

test('skeleton pattern', function () {
$filters = new Filters;
$filters->locale = 'cs_CZ';
if (PHP_VERSION_ID >= 80100) {
test('skeleton pattern', function () {
$filters = new Filters;
$filters->locale = 'cs_CZ';

Assert::same('květen', $filters->localDate('1978-05-05', 'MMMM'));
Assert::same('5. května', $filters->localDate('1978-05-05', 'd MMMM'));
Assert::same('květen 78', $filters->localDate('1978-05-05', 'MMMM yy'));
});
Assert::same('květen', $filters->localDate('1978-05-05', 'MMMM'));
Assert::same('5. května', $filters->localDate('1978-05-05', 'd MMMM'));
Assert::same('květen 78', $filters->localDate('1978-05-05', 'MMMM yy'));
});
}

test('full/long/medium/short', function () {
$filters = new Filters;
Expand All @@ -67,7 +68,7 @@ test('full/long/medium/short', function () {
Assert::same('12:13', $filters->localDate('12:13:14', time: 'short'));
Assert::same('12:13:14', $filters->localDate('12:13:14', time: 'medium'));
Assert::same('12:13:14 PDT', $filters->localDate('12:13:14', time: 'long'));
Assert::same('12:13:14, severoamerický pacifický letní čas', $filters->localDate('12:13:14', time: 'full'));
Assert::match('12:13:14%a%', $filters->localDate('12:13:14', time: 'full'));

// combined
Assert::same('05.05.78 12:13', $filters->localDate('1978-05-05 12:13:14', date: 'short', time: 'short'));
Expand Down

0 comments on commit ac1d390

Please sign in to comment.