public function testLogLoggerCallsWithException() { $loggerStrategy = $this->getMock('cfhCompile_Runtime_ClassLogger_Strategy_Interface'); $loggerStrategy->expects($this->once())->method('begin'); $loggerStrategy->expects($this->atLeastOnce())->method('log')->with($this->isInstanceOf('cfhCompile_Class_Interface'))->will($this->throwException(new Exception())); $loggerStrategy->expects($this->never())->method('commit'); $loggerStrategy->expects($this->once())->method('rollback'); $logger = new cfhCompile_Runtime_ClassLogger(); $logger->setStrategy($loggerStrategy); $this->assertSame($loggerStrategy, $logger->getStrategy()); try { $logger->log(); } catch (Exception $e) { return; } $this->fail('Expecting to catch an exception.'); }