protected function setUp() { $this->container = (include './config/container.php'); $this->log = $this->container->get('tick_log_datastore'); $this->log->deleteAll(); $this->initCallback(); }
public function setUp() { $this->container = (include './config/container.php'); // $this->filterDs = $this->container->get('test_scheduler_filters_datastore'); $this->filterDs = $this->container->get('filters_datastore'); $this->log = $this->container->get('tick_log_datastore'); $this->log->deleteAll(); // $this->setFilters(); }
public function test_tickerWithBigStep() { $this->tickLog->deleteAll(); $this->hopLog->deleteAll(); $totalTime = 10; $this->setTicker(['total_time' => $totalTime, 'step' => 5]); $this->ticker->start(); sleep($totalTime); $this->assertEquals(2, $this->tickLog->count()); $this->assertEquals(1, $this->hopLog->count()); }
public function test_scriptProxy() { // Clear log before testing $this->log->deleteAll(); $callbackManager = $this->container->get('callback_manager'); /** @var \zaboy\scheduler\Callback\Script $scriptCallback */ $scriptProxyCallback = $callbackManager->get('test_scriptproxy_callback'); $options = ['param1' => 'value1', 'param2' => ['value21', 'value22']]; $scriptProxyCallback->call($options); // Expected that in the log will be one entry $item = $this->log->read(1); $this->assertEquals(print_r($options, 1), $item['step']); // Clear log again $this->log->deleteAll(); }
public function test_runScriptWithDelayLessThanHere() { // Clear log before testing $this->dataStore->deleteAll(); if ('Windows' == substr(php_uname(), 0, 7)) { $this->setExpectedExceptionRegExp('Zend\\ServiceManager\\Exception\\ServiceNotCreatedException'); } /** @var Worker $worker */ $worker = $this->container->get($this->workerServiceName); $pId = $worker->call(['delay' => 3]); $this->assertTrue($worker->isProcessWorking($pId)); sleep(5); $this->assertFalse($worker->isProcessWorking($pId)); // Two records in the log $this->assertEquals(2, $this->dataStore->count()); }
/** * Translates the "deleteAll" call to DataStore * * @see \zaboy\scheduler\Callback\Factory\DataStoreAbstractFactory * @see \zaboy\rest\DataStore\Interfaces\DataStoresInterface * @param array $options * @return int|null */ private function deleteall(array $options = []) { return $this->dataStore->deleteAll(); }
protected function tearDown() { $this->log->deleteAll(); }