22 lines
684 B
PHP
22 lines
684 B
PHP
|
<?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()));
|
||
|
}
|
||
|
}
|