PDOException: You cannot serialize or unserialize PDO instances


The Mocken objects with PHPunit can cause the error message:

PDOException: You cannot serialize or unserialize PDO instances

come, whenever, If in the constructor of a PDO instance will inject. This can be prevented by:

class PDOMock extends PDO{
    public function __construct(){}
}