/**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     require_once dirname(__FILE__) . '/../../vendor/lime/lime.php';
     require_once dirname(__FILE__) . '/lime_symfony.php';
     // cleanup
     require_once dirname(__FILE__) . '/../../util/sfToolkit.class.php';
     if ($files = glob(sys_get_temp_dir() . DIRECTORY_SEPARATOR . '/sf_autoload_unit_*')) {
         foreach ($files as $file) {
             unlink($file);
         }
     }
     // update sfCoreAutoload
     if ($options['update-autoloader']) {
         require_once dirname(__FILE__) . '/../../autoload/sfCoreAutoload.class.php';
         sfCoreAutoload::make();
     }
     $status = false;
     $statusFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . sprintf('/.test_symfony_%s_status', md5(dirname(__FILE__)));
     if ($options['only-failed']) {
         if (file_exists($statusFile)) {
             $status = unserialize(file_get_contents($statusFile));
         }
     }
     $h = new lime_symfony(array('force_colors' => $options['color'], 'verbose' => $options['trace']));
     $h->base_dir = realpath(dirname(__FILE__) . '/../../../test');
     // remove generated files
     if ($options['rebuild-all']) {
         $finder = sfFinder::type('dir')->name(array('base', 'om', 'map'));
         foreach ($finder->in(glob($h->base_dir . '/../lib/plugins/*/test/functional/fixtures/lib')) as $dir) {
             sfToolkit::clearDirectory($dir);
         }
     }
     if ($status) {
         foreach ($status as $file) {
             $h->register($file);
         }
     } else {
         $h->register(sfFinder::type('file')->prune('fixtures')->name('*Test.php')->in(array_merge(array($h->base_dir . '/unit'), glob($h->base_dir . '/../lib/plugins/*/test/unit'), array($h->base_dir . '/functional'), glob($h->base_dir . '/../lib/plugins/*/test/functional'), array($h->base_dir . '/other'))));
     }
     $ret = $h->run() ? 0 : 1;
     file_put_contents($statusFile, serialize($h->get_failed_files()));
     if ($options['xml']) {
         file_put_contents($options['xml'], $h->to_xml());
     }
     return $ret;
 }
Beispiel #2
0
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../lib/vendor/lime/lime.php';
class lime_symfony extends lime_harness
{
    protected function get_relative_file($file)
    {
        $file = str_replace(DIRECTORY_SEPARATOR, '/', str_replace(array(realpath($this->base_dir) . DIRECTORY_SEPARATOR, realpath($this->base_dir . '/../lib/plugins') . DIRECTORY_SEPARATOR, $this->extension), '', $file));
        return preg_replace('#^(.*?)Plugin/test/(unit|functional)/#', '[$1] $2/', $file);
    }
}
require_once dirname(__FILE__) . '/../../lib/util/sfToolkit.class.php';
if ($files = glob(sfToolkit::getTmpDir() . DIRECTORY_SEPARATOR . '/sf_autoload_unit_*')) {
    foreach ($files as $file) {
        unlink($file);
    }
}
// update sfCoreAutoload
require_once dirname(__FILE__) . '/../../lib/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::make();
$h = new lime_symfony(new lime_output_color());
$h->base_dir = realpath(dirname(__FILE__) . '/..');
$h->register(sfFinder::type('file')->prune('fixtures')->name('*Test.php')->in(array_merge(array($h->base_dir . '/unit'), glob($h->base_dir . '/../lib/plugins/*/test/unit'), array($h->base_dir . '/functional'), glob($h->base_dir . '/../lib/plugins/*/test/functional'), array($h->base_dir . '/other'))));
exit($h->run() ? 0 : 1);