Exemple #1
0
 public function testFailedAttemptThenSucceeds()
 {
     $this->factory->expects($this->any())->method('create')->will($this->returnValue($this->pdo));
     $pdoStatement = $this->getMock(\PDOStatement::class);
     $pdoStatement->expects($this->any())->method('execute')->will($this->onConsecutiveCalls($this->throwException(new \PDOException()), $this->returnValue(true)));
     $this->pdo->expects($this->any())->method('prepare')->will($this->returnValue($pdoStatement));
     $this->config->expects($this->any())->method('getMaximumAttempts')->will($this->returnValue(2));
     $this->assertSame($this->pdo, $this->factory->__invoke($this->config));
 }