This methods specifies if a task can run in a specific context.
public canRunInContext ( GrumPHP\Task\Context\ContextInterface $context ) : boolean | ||
$context | GrumPHP\Task\Context\ContextInterface | |
return | boolean |
public function let(TaskInterface $task1, TaskInterface $task2, ContextInterface $context) { $task1->canRunInContext($context)->willReturn(true); $task2->canRunInContext($context)->willReturn(true); $this->addTask($task1); $this->addTask($task2); }
public function let(EventDispatcherInterface $eventDispatcher, TaskInterface $task1, TaskInterface $task2, ContextInterface $context) { $this->beConstructedWith($eventDispatcher); $task1->canRunInContext($context)->willReturn(true); $task2->canRunInContext($context)->willReturn(true); $this->addTask($task1); $this->addTask($task2); }
function it_should_filter_by_context(TaskInterface $task1, TaskInterface $task2, ContextInterface $context) { $task1->canRunInContext($context)->willReturn(true); $task2->canRunInContext($context)->willReturn(false); $result = $this->filterByContext($context); $result->shouldBeAnInstanceOf('GrumPHP\\Collection\\TasksCollection'); $result->count()->shouldBe(1); $tasks = $result->toArray(); $tasks[0]->shouldBe($task1); }
public function let(GrumPHP $grumPHP, EventDispatcherInterface $eventDispatcher, TaskInterface $task1, TaskInterface $task2, ContextInterface $context) { $this->beConstructedWith($grumPHP, $eventDispatcher); $task1->getName()->willReturn('task1'); $task1->canRunInContext($context)->willReturn(true); $task2->getName()->willReturn('task2'); $task2->canRunInContext($context)->willReturn(true); $grumPHP->stopOnFailure()->willReturn(false); $grumPHP->getTaskMetadata('task1')->willReturn(array('priority' => 0)); $grumPHP->getTaskMetadata('task2')->willReturn(array('priority' => 0)); $this->addTask($task1); $this->addTask($task2); }
public function let(GrumPHP $grumPHP, EventDispatcherInterface $eventDispatcher, TaskInterface $task1, TaskInterface $task2, ContextInterface $context) { $this->beConstructedWith($grumPHP, $eventDispatcher); $task1->getName()->willReturn('task1'); $task1->canRunInContext($context)->willReturn(true); $task1->run($context)->willReturn(TaskResult::createPassed($task1->getWrappedObject(), $context->getWrappedObject())); $task2->getName()->willReturn('task2'); $task2->canRunInContext($context)->willReturn(true); $task2->run($context)->willReturn(TaskResult::createPassed($task2->getWrappedObject(), $context->getWrappedObject())); $grumPHP->stopOnFailure()->willReturn(false); $grumPHP->getTaskMetadata('task1')->willReturn(array('priority' => 0)); $grumPHP->getTaskMetadata('task2')->willReturn(array('priority' => 0)); $grumPHP->isBlockingTask('task1')->willReturn(true); $grumPHP->isBlockingTask('task2')->willReturn(true); $this->addTask($task1); $this->addTask($task2); }