/**
  * @expectedException \Doctrine\DBAL\DBALException
  */
 public function testExecuteCallsLoggerStopQueryOnException()
 {
     $logger = $this->getMock('\\Doctrine\\DBAL\\Logging\\SQLLogger');
     $this->configuration->expects($this->once())->method('getSQLLogger')->will($this->returnValue($logger));
     // Needed to satisfy construction of DBALException
     $this->conn->expects($this->any())->method('resolveParams')->will($this->returnValue(array()));
     $logger->expects($this->once())->method('startQuery');
     $logger->expects($this->once())->method('stopQuery');
     $this->pdoStatement->expects($this->once())->method('execute')->will($this->throwException(new \Exception("Mock test exception")));
     $statement = new Statement("", $this->conn);
     $statement->execute();
 }
Beispiel #2
0
 public function testUnlockNoLock()
 {
     $this->mutex->expects($this->never())->method('getConnection')->will($this->returnValue($this->pdo));
     $this->pdo->expects($this->never())->method('prepare');
     // The stm should not be executed
     $this->stmtReleaseLock->expects($this->never())->method('execute');
     $result = $this->mutex->unlock();
     $this->assertEquals(false, $result);
 }