Commit 850e3fae authored by Marco Pivetta's avatar Marco Pivetta

Avoiding mocking `PDOException` as of sebastianbergmann/phpunit-mock-objects#169

parent 5c72ea62
...@@ -25,7 +25,7 @@ class PDOExceptionTest extends DbalTestCase ...@@ -25,7 +25,7 @@ class PDOExceptionTest extends DbalTestCase
* *
* @var \PDOException|\PHPUnit_Framework_MockObject_MockObject * @var \PDOException|\PHPUnit_Framework_MockObject_MockObject
*/ */
private $wrappedExceptionMock; private $wrappedException;
protected function setUp() protected function setUp()
{ {
...@@ -35,13 +35,11 @@ class PDOExceptionTest extends DbalTestCase ...@@ -35,13 +35,11 @@ class PDOExceptionTest extends DbalTestCase
parent::setUp(); parent::setUp();
$this->wrappedExceptionMock = $this->getMockBuilder('\PDOException') $this->wrappedException = new \PDOException(self::MESSAGE, self::SQLSTATE);
->setConstructorArgs(array(self::MESSAGE, self::SQLSTATE))
->getMock();
$this->wrappedExceptionMock->errorInfo = array(self::SQLSTATE, self::ERROR_CODE); $this->wrappedException->errorInfo = array(self::SQLSTATE, self::ERROR_CODE);
$this->exception = new PDOException($this->wrappedExceptionMock); $this->exception = new PDOException($this->wrappedException);
} }
public function testReturnsCode() public function testReturnsCode()
...@@ -66,6 +64,6 @@ class PDOExceptionTest extends DbalTestCase ...@@ -66,6 +64,6 @@ class PDOExceptionTest extends DbalTestCase
public function testOriginalExceptionIsInChain() public function testOriginalExceptionIsInChain()
{ {
$this->assertSame($this->wrappedExceptionMock, $this->exception->getPrevious()); $this->assertSame($this->wrappedException, $this->exception->getPrevious());
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment