Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 0.93 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. require_once(__DIR__ . "/../../../../app/AppKernel.php");
  4.  
  5. class ModelTestCase extends \PHPUnit_Framework_TestCase
  6. {
  7.   protected $_application;
  8.  
  9.   public function setUp()
  10.   {
  11.     $kernel = new \AppKernel("test", true);
  12.     $kernel->boot();
  13.     $this->_application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel);
  14.     $this->_application->setAutoExit(false);
  15.     $this->runConsole("doctrine:schema:drop", array("--force" => true));
  16.     $this->runConsole("doctrine:schema:create");
  17.     $this->runConsole("cache:warmup");
  18.     $this->runConsole("doctrine:fixtures:load", array("--fixtures" => __DIR__ . "/../DataFixtures"));
  19.   }
  20.  
  21.   protected function runConsole($command, Array $options = array())
  22.   {
  23.     $options["-e"] = "test";
  24.     $options["-q"] = null;
  25.     $options = array_merge($options, array('command' => $command));
  26.     return $this->_application->run(new \Symfony\Component\Console\Input\ArrayInput($options));
  27.   }
  28. }