本文整理匯總了PHP中GrumPHP\Configuration\GrumPHP::isBlockingTask方法的典型用法代碼示例。如果您正苦於以下問題:PHP GrumPHP::isBlockingTask方法的具體用法?PHP GrumPHP::isBlockingTask怎麽用?PHP GrumPHP::isBlockingTask使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GrumPHP\Configuration\GrumPHP
的用法示例。
在下文中一共展示了GrumPHP::isBlockingTask方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: runTask
/**
* @param TaskInterface $task
* @param ContextInterface $context
*
* @return TaskResultInterface
* @throws RuntimeException
*/
private function runTask(TaskInterface $task, ContextInterface $context)
{
try {
$this->eventDispatcher->dispatch(TaskEvents::TASK_RUN, new TaskEvent($task, $context));
$result = $task->run($context);
} catch (RuntimeException $e) {
$result = TaskResult::createFailed($task, $context, $e->getMessage());
}
if (!$result instanceof TaskResultInterface) {
throw RuntimeException::invalidTaskReturnType($task);
}
if (!$result->isPassed() && !$this->grumPHP->isBlockingTask($task->getName())) {
$result = TaskResult::createNonBlockingFailed($result->getTask(), $result->getContext(), $result->getMessage());
}
if (!$result->isPassed()) {
$e = new RuntimeException($result->getMessage());
$this->eventDispatcher->dispatch(TaskEvents::TASK_FAILED, new TaskFailedEvent($task, $context, $e));
return $result;
}
$this->eventDispatcher->dispatch(TaskEvents::TASK_COMPLETE, new TaskEvent($task, $context));
return $result;
}
示例2:
function it_does_not_stop_on_a_non_blocking_failed_task_if_stop_on_failure(GrumPHP $grumPHP, TaskInterface $task1, TaskInterface $task2, ContextInterface $context)
{
$grumPHP->stopOnFailure()->willReturn(true);
$grumPHP->isBlockingTask('task1')->willReturn(false);
$task1->run($context)->willReturn(TaskResult::createFailed($task1->getWrappedObject(), $context->getWrappedObject(), ''));
$task2->run($context)->shouldBeCalled();
$this->run($context)->shouldHaveCount(2);
}