26 lines
786 B
PHP
26 lines
786 B
PHP
<?php
|
|
namespace nulib\php\time;
|
|
|
|
use nulib\tests\TestCase;
|
|
|
|
class HourTest extends TestCase {
|
|
function testFormat() {
|
|
self::assertSame("0h00", (new Hour(0))->format());
|
|
self::assertSame("0h56", (new Hour(56))->format());
|
|
self::assertSame("2h00", (new Hour(120))->format());
|
|
self::assertSame("23h59", (new Hour(1439))->format());
|
|
self::assertSame("24h00", (new Hour(1440))->format());
|
|
self::assertSame("0h01", (new Hour(1441))->format());
|
|
}
|
|
|
|
function testStep() {
|
|
$h = new class extends Hour {
|
|
const STEP = 5;
|
|
};
|
|
$h->newu(10); self::assertSame("0h10", strval($h));
|
|
$h->newu(12); self::assertSame("0h10", strval($h));
|
|
$h->newu(15); self::assertSame("0h15", strval($h));
|
|
$h->newu(17); self::assertSame("0h15", strval($h));
|
|
}
|
|
}
|