Ejemplo n.º 1
0
 public function testRun()
 {
     $counter = array('foo' => 0, 'bar' => 0);
     $event = new CM_Clockwork_Event('event', '1 second');
     $event->registerCallback(function () use(&$counter) {
         $counter['foo']++;
     });
     $event->run();
     $event->registerCallback(function () use(&$counter) {
         $counter['bar']++;
     });
     $event->run();
     $this->assertSame(array('foo' => 2, 'bar' => 1), $counter);
 }
Ejemplo n.º 2
0
 /**
  * @param CM_Clockwork_Event $event
  */
 protected function _runEvent(CM_Clockwork_Event $event)
 {
     $process = $this->_getProcess();
     $identifier = $process->fork(function () use($event) {
         $event->run();
     });
     $this->_markRunning($event, $identifier);
 }