PHPUnit and PDOException + Solution
Nov 1, 2012 · 1 minute readCategory: php
I recently needed to run a test suite against a couple of classes that were making use of PDO.
When I tried to run the I got the following errors in the output for every test
PDOException: You cannot serialize or unserialize PDO instances
There is a quick way around this you just need to add the following lines to the class level doc block
/**
*
* @backupGlobals disabled
* @backupStaticAttributes disabled
*/
A full explanation of these, and other annotations can be found here