Exemple #1
0
 public function testSetInterval()
 {
     $et = new ET();
     $output = [];
     $interval = $et->setInterval(function ($e) use(&$output) {
         $output[] = 'one';
     }, 0.01);
     for ($i = 0; $i < 10; $i++) {
         usleep(10000);
         $et->tick();
     }
     $this->assertSame($output, array_fill(0, 10, 'one'));
     // remove the interval - nothing should happen
     $et->removeInterval($interval);
     for ($i = 0; $i < 10; $i++) {
         usleep(10000);
         $et->tick();
     }
     $this->assertSame($output, array_fill(0, 10, 'one'));
 }