/** * @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(); }