Example #1
0
 public function testSetParameters()
 {
     $task = new SyncTask('invocable/Action', []);
     $this->assertEquals([], $task->getParameters());
     $task->setParameters(['foo', 'bar']);
     $this->assertEquals(['foo', 'bar'], $task->getParameters());
 }
Example #2
0
 /**
  * Create and run task
  * @param \oat\oatbox\action\Action|string $action action instance, classname or callback function
  * @param $parameters parameters to be passed to the action
  * @param boolean $recall Parameter which indicates that task has been created repeatedly after fail of previous.
  * For current implementation in means that the second call will not be executed to avoid loop.
  * @return SyncTask
  */
 public function createTask($action, $parameters, $recall = false)
 {
     if ($recall) {
         \common_Logger::w("Repeated call of action'; Execution canceled.");
         return false;
     }
     $task = new SyncTask($action, $parameters);
     $this->tasks[$task->getId()] = $task;
     $this->runTask($task);
     return $task;
 }