title: How can I in PHP re-create my Database (for Unit Testing for example)
body: <p>How can I from PHP, re-create my Database, maybe inserting default data. Currently, I am intending to use the behavior for Unit Tests. </p>
  
  <p>I am using Doctrine 2, Zend Framework 1.11, <code>Zend_Test</code> for unit tests</p>
  
  <p>I could use the CLI </p>
  
  <pre><code>doctrine orm:schema-tool:update --force
  </code></pre>
  
  <p>Or </p>
  
  <pre><code>doctrine orm:schema-tool:drop --force
  doctrine orm:schema-tool:create
  </code></pre>
  
  <p>I am  looking for a PHP replacement, so far found <a href="http://www.doctrine-project.org/docs/orm/2.0/en/reference/tools.html" rel="noreferrer">this</a></p>
  
  <p>but it will look something like </p>
  
  <pre><code>$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
  $classes = array(
    $em-&gt;getClassMetadata('Entities\User'),
    $em-&gt;getClassMetadata('Entities\Profile')
  );
  $tool-&gt;dropSchema($classes, \Doctrine\ORM\Tools\SchemaTool::DROP_DATABASE);
  $tool-&gt;createSchema($classes);
  </code></pre>
  
  <p>And I don't really want having to specify the model classes, esp in development when they can change. It should just read from the all classes specified in ... below ... just like with the CLI, you don't need to specify the classes you want?</p>
  
  <pre><code>$driverImpl = $config-&gt;newDefaultAnnotationDriver(array(realpath('../models')));
  $config-&gt;setMetadataDriverImpl($driverImpl);
  </code></pre>