-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCuckooClockTest.php
More file actions
32 lines (25 loc) · 837 Bytes
/
CuckooClockTest.php
File metadata and controls
32 lines (25 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* @copyright 2009-2020 Red Matter Ltd (UK)
*/
namespace RedMatter\Examples;
use DateInterval;
use DateTime;
use DateTimeZone;
use PHPUnit\Framework\TestCase;
use RedMatter\Chrono\Clock\Mock\CalendarClock as MockClock;
class CuckooClockTest extends TestCase
{
public function testCuckoo()
{
$now = DateTime::createFromFormat(DateTime::ATOM, '2003-11-12T01:01:00+00:00');
$twoHoursFromNow = clone $now;
$twoHoursFromNow->add(DateInterval::createFromDateString('2 hours'));
$clock = new MockClock();
$clock->setDateTime($now);
$cuckooClock = new CuckooClock($clock, new DateTimeZone('Asia/Kolkata'));
$cuckooClock->runUntil($twoHoursFromNow);
self::assertEquals(2, $cuckooClock->music);
self::assertEquals(21, $cuckooClock->cuckoo);
}
}