本文整理汇总了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);
}