nur-sery/nur_tests/b/date/DatetimeTest.php

22 lines
689 B
PHP
Raw Permalink Normal View History

2023-12-03 22:11:29 +04:00
<?php
namespace nur\b\date;
use nur\t\TestCase;
class DatetimeTest extends TestCase {
function test() {
date_default_timezone_set("Indian/Reunion");
self::assertSame("Indian/Reunion", date_default_timezone_get());
$datetime = new Datetime(1634100479);
self::assertSame(1634100479, $datetime->getTime());
self::assertSame("13/10/2021 08:47:59", strval($datetime));
$datetime->wrapStart();
self::assertSame(1634068800, $datetime->getTime());
self::assertSame("13/10/2021 00:00:00", strval($datetime));
$datetime->wrapEnd();
self::assertSame(1634155199, $datetime->getTime());
self::assertSame("13/10/2021 23:59:59", strval($datetime));
}
}