title: Symfony2 unit testing: PDOException: SQLSTATE[00000] [1040] Too many connections
body: <p>when I run unit tests for my application, first tests are successful, then around 100, tests start to fail, due to PDOException (Too many connections). I have already searched about this problem, but was not able to solve it.</p>
  
  <p>My config is as follows:</p>
  
  <pre><code>&lt;phpunit
          backupGlobals               = "false"
          backupStaticAttributes      = "false"
          colors                      = "true"
          convertErrorsToExceptions   = "true"
          convertNoticesToExceptions  = "true"
          convertWarningsToExceptions = "true"
          processIsolation            = "false"
          stopOnFailure               = "false"
          syntaxCheck                 = "false"
          bootstrap                   = "bootstrap.php.cache" &gt;
  </code></pre>
  
  <p>If I change processIsolation to "true", all tests generate an error (E):</p>
  
  <pre><code>Caused by ErrorException: unserialize(): Error at offset 0 of 79 bytes
  </code></pre>
  
  <p>For that I tried setting "detect_unicode = Off" inside php.ini file.</p>
  
  <p>If I run tests in smaller batches, like with "--group something", all tests are successful.</p>
  
  <p>Can someone help me solve the issue when running all the tests at once? I really want to get rid of the PDOException.</p>
  
  <p>Thanks in advance!</p>