1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-02-08 15:58:54 +01:00
connector-wordpress/tests/DateTimeWrapperTest.php
2024-04-05 23:26:11 +02:00

48 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
use MobilizonConnector\DateTimeWrapper;
use PHPUnit\Framework\TestCase;
final class DateTimeWrapperTest extends TestCase {
public function testCanGet24TimeForUsualTime(): void {
$d = new DateTimeWrapper('2020-12-24T16:45:00Z');
$this->assertSame('16:45', $d->get24Time());
}
public function testCanGetShortDateForUsualDate(): void {
$d = new DateTimeWrapper('2020-12-24T16:45:00Z');
$this->assertSame('24/12/2020', $d->getShortDate());
}
public function testCanGetShortDateForUsualDateWithLocaleWithUnderscore(): void {
$d = new DateTimeWrapper('2020-12-24T16:45:00Z');
$this->assertSame('24/12/2020', $d->getShortDate(), 'en_GB');
}
public function testCanGetShortDateForUsualDateWithTimezoneString(): void {
$d = new DateTimeWrapper('2020-12-24T16:45:00Z', 'en-GB', 'Europe/Rome');
$this->assertSame('24/12/2020', $d->getShortDate());
}
public function testCanGetShortDateForUsualDateWithNamedOffset(): void {
$d = new DateTimeWrapper('2020-12-24T16:45:00Z', 'en-GB', 'UTC');
$this->assertSame('24/12/2020', $d->getShortDate());
}
public function testCanGetShortDateForUsualDateWithOffset(): void {
$d = new DateTimeWrapper('2020-12-24T16:45:00Z', 'en-GB', '+02:00');
$this->assertSame('24/12/2020', $d->getShortDate());
}
public function testCanGetShortDateForUsualDateWithEmptyTimezone(): void {
$d = new DateTimeWrapper('2020-12-24T16:45:00Z', 'en-GB', '');
$this->assertSame('24/12/2020', $d->getShortDate());
}
public function testCanGetShortOffsetNameForUsualTime(): void {
$d = new DateTimeWrapper('2020-12-24T16:45:00Z');
$this->assertSame('UTC', $d->getTimeZoneName());
}
}