Ejemplo n.º 1
0
 /**
  * Get class of the task, run it's default method or method specified in
  * task data [method]
  *
  * @param Task $task
  */
 protected function _runTask(Task $task)
 {
     $taskClassName = $task->getClassName();
     if (!class_exists($taskClassName)) {
         throw new \InvalidArgumentException(sprintf('Task class "%s" not found', $taskClassName));
     }
     $taskObject = new $taskClassName();
     if ($taskObject instanceof TaskInterface) {
         $taskObject->setData($task->getData());
         $taskObject->run();
         return $taskObject;
     } else {
         $methodName = $task->getMethodName();
         $taskObject->{$methodName}($task->getData());
     }
 }
Ejemplo n.º 2
0
 /**
  * @expectedException \Qutee\Exception
  * @covers \Qutee\Task::getClassName
  */
 public function testExceptionThrownIfRequestingClassNameWithoutName()
 {
     $this->object->getClassName();
 }