/** Restores all sfConfig values to their state before the current test was
  *   run.
  *
  * @return static
  */
 public function flushConfigs()
 {
     if (isset(self::$_configs)) {
         sfConfig::clear();
         sfConfig::add(self::$_configs);
     } else {
         self::$_configs = sfConfig::getAll();
     }
     return $this;
 }
 /**
  * @param array $args
  * @param array $opts
  *
  * @return void
  */
 public function execute($args = array(), $opts = array())
 {
     /* Validate incoming parameters. */
     if (!$this->_importParams($this->_consolidateInput($args, $opts))) {
         return;
     }
     $state = new Test_State($this->configuration);
     if ($this->_rebuild) {
         $state->flushDatabase();
         $this->logSection('rebuild', 'Database rebuilt.');
     }
     $loader = new Test_FixtureLoader($this->configuration);
     foreach ($this->_fixtures as $fixture) {
         $desc = sprintf('fixture "%s" from %s', $fixture['path'], $fixture['plugin'] ? "plugin {$fixture['plugin']}" : 'project');
         $this->logSection('fixture', sprintf('Loading %s...', $desc));
         $loader->loadFixture($fixture['path'], false, $fixture['plugin']);
         $this->logSection('fixture', sprintf('Loaded %s.', $desc));
     }
 }
 /** (Global) Init test environment.
  *
  * Note that test case subclasses should use _setUp().
  *
  * @return void
  */
 public final function setUp()
 {
     $this->_initContext();
     $this->_assertTestDatabaseConnection();
     $this->_assertTestUploadsDir();
     $configuration = $this->getApplicationConfiguration();
     $this->_fixtureLoader = new Test_FixtureLoader($configuration);
     $this->_state = new Test_State($configuration);
     /* Set custom sfConfig values here. */
     sfConfig::add(array('sf_fixture_dir' => $this->_fixtureLoader->getFixtureDir(false, $this->_plugin)));
     $this->_state->flushDatabase($this->_alwaysRebuildDB)->flushUploads()->flushConfigs();
     $this->_init();
     $this->_setUp();
 }