/** * @test * @expectedException Exception */ public function executeCallsLogExceptionOnCaughtExceptionAndRethrowsException() { $this->taskExecutor->expects($this->once())->method('execute')->will($this->throwException(new \Exception())); $this->task->_set('taskExecutor', $this->taskExecutor); $this->task->expects($this->once())->method('logException'); $this->task->execute(); }
/** * Function execute from the Scheduler * * @return boolean TRUE on successful execution, FALSE on error */ public function execute() { try { $this->taskExecutor->execute($this); return TRUE; } catch (\Exception $e) { $this->logException($e); return FALSE; } }
/** * Function execute from the Scheduler * * @return bool TRUE on successful execution * @throws \Exception If an error occurs */ public function execute() { try { $this->taskExecutor->execute($this); } catch (\Exception $e) { $this->logException($e); // Make sure the Scheduler gets exception details throw $e; } return TRUE; }