Do you ever get the following confusing message when you run your PHPUnit tests?
PDOException: You cannot serialize or unserialize PDO instances
You can fix this by adding the following comment block to the top of your unit test class:
/** * @backupGlobals disabled * @backupStaticAttributes disabled */
If you’re interested in what’s happening: by default PHPUnit tries to keep all global and superglobal variables in your test contained to prevent them spreading into other tests. It does this using serialize() and unserialize().
In the case of the limonade microframework, anything using option() is stored in the $GLOBALS array. That includes the PDO object, which is generally stored in $GLOBALS because it can be used all over the place.
Unfortunately, and as the error message makes clear, PDO objects can’t be serialized or unserialized…