Eric Hogue on February 12th, 2013

The subject of mocking a PDO object in PHPUnit has come around a few times lately. It cannot be done like normal classes because a PDO object cannot be serialized. $pdo = $this->getMockBuilder(‘PDO’) ->disableOriginalConstructor() ->getMock(); This will work on another class, but with PDO you will get this error: PDOException: You cannot serialize or unserialize […]

Continue reading about Mocking PDO in PHPUnit