title: Keep getting "You cannot serialize or unserialize PDO instances" in PHPUnit using PHPStorm
body: <p>I've recently set up PHPUnit in PHPStorm via Composer.</p>
  
  <p>I'm trying to test some functionality that requires me to bootstrap Processwire (a CMS).</p>
  
  <p>I keep constantly getting the message "You cannot serialize or unserialize PDO instances" despite applying the conditions below which I researched to be the correct way of fixing this issue.</p>
  
  <pre><code> * @backupGlobals disabled
   * @backupStaticAttributes disabled
   * @runTestsInSeparateProcesses
   * @runInSeparateProcess
   * @preserveGlobalState disabled
  </code></pre>
  
  <p>Is there anything else I have missed or need to do to get this working?</p>
  
  <p>These are the resources I have referenced so far.</p>
  
  <p><a href="https://phpunit.de/manual/current/en/phpunit-book.html#appendixes.annotations.preserveGlobalState" rel="nofollow noreferrer">https://phpunit.de/manual/current/en/phpunit-book.html#appendixes.annotations.preserveGlobalState</a></p>
  
  <p><a href="http://edmondscommerce.github.io/php/phpunit-and-pdoexception-solution.html" rel="nofollow noreferrer">http://edmondscommerce.github.io/php/phpunit-and-pdoexception-solution.html</a> </p>
  
  <p>I've seen this article that flagged my article as a duplicate but I don't believe it to be the same :
  <a href="https://stackoverflow.com/questions/8700702/pdoexception-you-cannot-serialize-or-unserialize-pdo-instances">PDOException: You cannot serialize or unserialize PDO instances</a></p>
  
  <p>The test in that article has direct references to the PDO object whereas I'm just trying to get my tests to run with a bootstrap reference to Processwire.
  This is my test I'm trying to run :</p>
  
  <pre><code>namespace Test;
  
  include_once(__DIR__."/../../../../index.php");     //Bootstrap to Processwire CMS
  
  class ImageTest extends \PHPUnit_Framework_TestCase {
  
      /**
       * @backupGlobals disabled
       * @backupStaticAttributes disabled
       * @runTestsInSeparateProcesses
       * @runInSeparateProcess
       * @preserveGlobalState disabled
       */
  
  
      protected function setUp()
      {
          //$this-&gt;testpages = wire(pages)-&gt;find("template=fingergames|template=songs|template=poems");
      }
  
      public function testImageEmptyLinks()
      {
          //$testpages = wire(pages)-&gt;find("template=fingergames|template=songs|template=poems");
  
          $blanks = wire(pages)-&gt;find("image=''");
          $this-&gt;assertEquals($blanks-&gt;count(),0);
      }
  
      public function testImageMismatchedLinks()
      {
          //$this-&gt;assertTrue(true);
          $this-&gt;assertEquals(0,0);
      }
  
      public function testImageMissingSiblings()
      {
          $this-&gt;assertEquals(0,0);
      }
  
      protected function tearDown()
      {
  
      }
  }
  </code></pre>