Пример #1
0
 /**
  * Cleans up the environment after running a test.
  */
 protected function tearDown()
 {
     Edo_Event_Engine::setDefaultEngine(null);
     FileEngineHelper::revertSystem($this->engine);
     $this->engine = null;
     $this->test_config = array();
     parent::tearDown();
 }
Пример #2
0
 public function testsetGet()
 {
     $e = Edo_Event_Engine::getDefaultEngine();
     $this->assertSame($e, null);
     Edo_Event_Engine::setDefaultEngine($this->engine);
     $e = Edo_Event_Engine::getDefaultEngine();
     $this->assertSame($e, $this->engine);
     Edo_Event_Engine::setDefaultEngine(null);
 }
Пример #3
0
    if (is_file($fullLockPath)) {
        $lock_time = file_get_contents($fullLockPath);
        $currentLockTime = time() - $lock_time;
        if ($currentLockTime > $fullLockWarningTime) {
            echo "Full lock of worker {$worker_name} is not released for {$currentLockTime} seconds while the warning time is {$fullLockWarningTime} seconds. Might wanna have a look wassup." . PHP_EOL;
        }
        exit;
        //file is locked....some other worker of this name already working
    } else {
        //ackuire full lock
        file_put_contents($fullLockPath, time());
    }
}
//creating engine
$engine = Edo_Event_Engine_Factory::build($config['engine']);
Edo_Event_Engine::setDefaultEngine($engine);
//start timer
$start_time = time();
$elapsed_time = 0;
do {
    try {
        $failed = false;
        //check elapsed time
        $elapsed_time = time() - $start_time;
        if ($elapsed_time > $limit_time) {
            break;
        }
        $event = $engine->getFreeEvent($pool);
        if (!$event) {
            break;
            //no event to preocess...over
Пример #4
0
 public function testWrongInputCreatesExceptionCreatesDefaultEngine()
 {
     $this->setExpectedException('Edo_Event_Engine_Exception');
     Edo_Event_Engine::setDefaultEngine(null);
     $id = Edo_Event_Factory::create('moooo', 'manager', $this->engine, true);
 }