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

22 lines
684 B
PHP
Raw Normal View History

2023-12-03 22:11:29 +04:00
<?php
namespace nur\b\date;
use nur\t\TestCase;
class DateTest extends TestCase {
function test() {
date_default_timezone_set("Indian/Reunion");
self::assertSame("Indian/Reunion", date_default_timezone_get());
$date = new Date(1634098974);
self::assertSame(1634068800, $date->getTime());
self::assertSame("13/10/2021", strval($date));
$date->wrapStart();
self::assertSame(1634068800, $date->getTime());
self::assertSame("13/10/2021 00:00:00", date("d/m/Y H:i:s", $date->getTime()));
$date->wrapEnd();
self::assertSame(1634155199, $date->getTime());
self::assertSame("13/10/2021 23:59:59", date("d/m/Y H:i:s", $date->getTime()));
}
}