/**
   * @see sfTask
   */
  protected function execute($arguments = array(), $options = array())
  {
    $buildAllReload = new sfDoctrineBuildAllReloadTask($this->dispatcher, $this->formatter);
    $buildAllReload->setCommandApplication($this->commandApplication);
    $buildAllReload->setConfiguration($this->configuration);
    $ret = $buildAllReload->run(array(), array(
      'dir'             => $options['dir'],
      'append'          => $options['append'],
      'skip-forms'      => $options['skip-forms'],
      'no-confirmation' => $options['no-confirmation'],
      'migrate'         => $options['migrate'],
    ));

    if ($ret)
    {
      return $ret;
    }

    $this->logSection('doctrine', 'running test suite');

    $testAll = new sfTestAllTask($this->dispatcher, $this->formatter);
    $testAll->setCommandApplication($this->commandApplication);
    $testAll->setConfiguration($this->configuration);
    $testAll->run();
  }
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $buildAllReload = new sfDoctrineBuildAllReloadTask($this->dispatcher, $this->formatter);
     $buildAllReload->setCommandApplication($this->commandApplication);
     $buildAllReloadOptions = array();
     if (!empty($options['application'])) {
         $buildAllReloadOptions[] = '--application=' . $options['application'];
     }
     $buildAllReloadOptions[] = '--env=' . $options['env'];
     if (!empty($options['dir'])) {
         $buildAllReloadOptions[] = '--dir=' . implode(' --dir=', $options['dir']);
     }
     if (isset($options['append']) && $options['append']) {
         $buildAllReloadOptions[] = '--append';
     }
     if (isset($options['no-confirmation']) && $options['no-confirmation']) {
         $buildAllReloadOptions[] = '--no-confirmation';
     }
     $ret = $buildAllReload->run(array(), $buildAllReloadOptions);
     if ($ret) {
         return $ret;
     }
     $this->logSection('doctrine', 'running test suite');
     $testAll = new sfTestAllTask($this->dispatcher, $this->formatter);
     $testAll->setCommandApplication($this->commandApplication);
     $testAll->run();
 }
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $buildAllReload = new sfDoctrineBuildAllReloadTask($this->dispatcher, $this->formatter);
     $buildAllReload->setCommandApplication($this->commandApplication);
     $buildAllReloadOptions = array();
     $buildAllReloadOptions[] = '--env=' . $options['env'];
     if (!empty($options['dir'])) {
         $buildAllReloadOptions[] = '--dir=' . implode(' --dir=', $options['dir']);
     }
     if (isset($options['append']) && $options['append']) {
         $buildAllReloadOptions[] = '--append';
     }
     if (isset($options['force']) && $options['force']) {
         $buildAllReloadOptions[] = '--force';
     }
     $buildAllReload->run(array('application' => $arguments['application']), $buildAllReloadOptions);
     $testAll = new sfTestAllTask($this->dispatcher, $this->formatter);
     $testAll->setCommandApplication($this->commandApplication);
     $testAll->run();
 }
 protected function buildDb()
 {
     $tmpdir = sfConfig::get('sf_data_dir') . '/fixtures_tmp';
     $this->getFilesystem()->mkdirs($tmpdir);
     $this->getFilesystem()->remove(sfFinder::type('file')->in(array($tmpdir)));
     $pluginDirs = sfFinder::type('dir')->name('data')->in(sfFinder::type('dir')->name('op*Plugin')->maxdepth(1)->in(sfConfig::get('sf_plugins_dir')));
     $fixturesDirs = sfFinder::type('dir')->name('fixtures')->prune('migrations')->in(array_merge(array(sfConfig::get('sf_data_dir')), $this->configuration->getPluginSubPaths('/data'), $pluginDirs));
     $i = 0;
     foreach ($fixturesDirs as $fixturesDir) {
         $files = sfFinder::type('file')->name('*.yml')->sort_by_name()->in(array($fixturesDir));
         foreach ($files as $file) {
             $this->getFilesystem()->copy($file, $tmpdir . '/' . sprintf('%03d_%s_%s.yml', $i, basename($file, '.yml'), md5(uniqid(rand(), true))));
         }
         $i++;
     }
     $buildAllLoad = new sfDoctrineBuildAllReloadTask($this->dispatcher, $this->formatter);
     $buildAllLoad->run(array(), array('--no-confirmation', '--dir=' . $tmpdir));
     $this->getFilesystem()->remove(sfFinder::type('file')->in(array($tmpdir)));
     $this->getFilesystem()->remove($tmpdir);
 }
Beispiel #5
0
<?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */
// guess current application
if (!isset($app)) {
    $traces = debug_backtrace();
    $caller = $traces[0];
    $dirPieces = explode(DIRECTORY_SEPARATOR, dirname($caller['file']));
    $app = array_pop($dirPieces);
}
$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', true);
new sfDatabaseManager($configuration);
$task = new sfDoctrineBuildAllReloadTask($configuration->getEventDispatcher(), new sfFormatter());
$task->run(array('--no-confirmation', '--dir=' . sfConfig::get('sf_root_dir') . '/data/fixtures', '--skip-forms'));
$loadData = new sfDoctrineLoadDataTask($configuration->getEventDispatcher(), new sfFormatter());
$loadData->run(array('--dir=' . dirname(__FILE__) . '/../fixtures'));
Beispiel #6
0
<?php

$configuration = ProjectConfiguration::getApplicationConfiguration('pc_frontend', 'test', true);
new sfDatabaseManager($configuration);
$task = new sfDoctrineBuildAllReloadTask($configuration->getEventDispatcher(), new sfFormatter());
$task->run(array('--no-confirmation', '--dir=' . dirname(__FILE__) . '/../fixtures', '--skip-forms'));