コード例 #1
0
ファイル: WallTest.php プロジェクト: shinichi81/eep-php
 /** @test */
 public function clockShouldTockEachTime()
 {
     $clock = new Wall(1);
     $clock->init();
     $to = intval(microtime(true) * 1000);
     $this->assertFalse($clock->tick(), "Tick without time moving");
     $this->assertFalse($clock->tock($to), "Tock without time moving");
     usleep(2000);
     $clock->inc();
     $this->assertTrue($clock->tick(), "No tick, even though time inc'd");
     $to += 4;
     $this->assertFalse($clock->tock($to), "Tock without time moving");
     usleep(2000);
     $clock->inc();
     $this->assertTrue($clock->tock($to), "No tock!");
 }