public function testTaskFailureCallbackIsInvokedByExitCodeNotZeroOrNull()
 {
     $mock = $this->getMock('AndreasWeber\\Runner\\Test\\Stub\\TaskInvokedStub');
     $mock->expects($this->once())->method('trigger')->willReturn(null);
     $task = new ExitCodeOneStub();
     $task->setFailOnError(true);
     $collection = new Collection();
     $collection->addTask($task);
     $this->runner->setTaskCollection($collection);
     $this->runner->on('runner.task.failure', array($mock, 'trigger'));
     try {
         $this->runner->run($this->payload);
     } catch (\Exception $e) {
         // we only want the event to occur
     }
 }
Example #2
0
 public function testWhenFailOnErrorFalseAndExitCodeNotEqualZeroRunIsSuccessful()
 {
     $task = new ExitCodeOneStub();
     $task->setFailOnError(false);
     $collection = new Collection();
     $collection->addTask($task);
     $this->runner->setTaskCollection($collection);
     $this->runner->run($this->payload);
 }