title: PHPUnit setup before running first test and tear down after running last test
body: <p>I am trying to implement a Django like test utility for a php application using PHPUnit. By Django like, I mean a separate test db is created from the main database before running the first test and it's dropped after running the last test. The test db needs to be created only once even if many test cases are run at a time. </p>
  
  <p>For this, I took the following approach - </p>
  
  <p>I defined a custom test suite class so that I can write the code for creating and dropping the db in it's setup and teardown methods and then use this class to run the tests as follows </p>
  
  <pre><code>$ phpunit MyTestSuite
  </code></pre>
  
  <p>MyTestSuite defines a static method named <code>suite</code> where I just use <code>glob</code> and add tests to the testsuite as follows </p>
  
  <pre><code>public static function suite() {
      $suite = new MyTestSuite();
  
      foreach (glob('./tests/*Test.php') as $tc) {
          require_once $tc;
          $suite-&gt;addTestSuite(basename($tc, '.php'));
      }
  
      return $suite;
  }
  </code></pre>
  
  <p>All Test Case classes extend from a subclass of <code>PHPUnit_Framework_TestCase</code> and the setup and teardown methods of this class take care of loading and clearing initial data from json fixture files.  </p>
  
  <p>Now as the no. of tests are increasing, I need to run only a selected tests at a time. But since I am already loading tests using a test suite, the --filter option cannot be used. 
  This makes me feel that this approach may not have been the correct one. </p>
  
  <p>So my question is, what is the correct approach to do something before running the first test and after running the last test irrespective of how PHPUnit finds them ? </p>
  
  <p>PS: I am not using PHPUnit_Extensions_Database_TestCase but my own implementation of creating, populating and dropping the db. </p>