title: Best way to create a test database and load fixtures on Symfony 2 WebTestCase?
body: <p>I have a WebTestCase that executes some basic routes in my application.</p>
  
  <p>I want to, on the <code>setUp</code> method of PHPUnit, create a test database identical to my main database, and load fixtures into it.</p>
  
  <p>I'm currently doing some workaround and executing some console commands, something like this:</p>
  
  <pre><code>class FixturesWebTestCase extends WebTestCase
  {
      protected static $application;
  
      protected function setUp()
      {
          self::runCommand('doctrine:database:create');
          self::runCommand('doctrine:schema:update --force');
          self::runCommand('doctrine:fixtures:load --purge-with-truncate');
      }
  
      protected static function runCommand($command)
      {
          $command = sprintf('%s --quiet', $command);
  
          return self::getApplication()-&gt;run(new StringInput($command));
      }
  
      protected static function getApplication()
      {
          if (null === self::$application) {
              $client = static::createClient();
  
              self::$application = new Application($client-&gt;getKernel());
              self::$application-&gt;setAutoExit(false);
          }
  
          return self::$application;
      }
  }
  </code></pre>
  
  <p>But I'm quite sure this is not the best approach, especially because the <code>doctrine:fixtures:load</code> expects the user to hit a <code>Y</code> char to confirm the action.</p>
  
  <p>How can I solve that?</p>