public function run()
  {
    $h = new lime_harness(new lime_output_color());
    $h->register(sfFinder::type('file')->name('*Test.php')->in(dirname(__FILE__).'/..'));

    exit($h->run() ? 0 : 1);
  }
Exemplo n.º 2
0
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     require_once sfConfig::get('sf_symfony_lib_dir') . '/vendor/lime/lime.php';
     $h = new lime_harness(new lime_output_color());
     $h->base_dir = sfConfig::get('sf_test_dir');
     // register all tests
     $finder = sfFinder::type('file')->follow_link()->name('*Test.php');
     $h->register($finder->in($h->base_dir));
     return $h->run() ? 0 : 1;
 }
Exemplo n.º 3
0
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $this->checkPluginExists($arguments['plugin']);
     if ($options['only'] && !in_array($options['only'], array('unit', 'functional'))) {
         throw new sfCommandException(sprintf('The --only option must be either "unit" or "functional" ("%s" given)', $options['only']));
     }
     require_once sfConfig::get('sf_symfony_lib_dir') . '/vendor/lime/lime.php';
     $h = new lime_harness(new lime_output_color());
     $h->base_dir = sfConfig::get('sf_plugins_dir') . '/' . $arguments['plugin'] . '/test/' . $options['only'];
     $finder = sfFinder::type('file')->follow_link()->name('*Test.php');
     $h->register($finder->in($h->base_dir));
     $h->run();
 }
Exemplo n.º 4
0
function run_test_unit($task, $args)
{
    if (isset($args[0])) {
        foreach ($args as $path) {
            $files = pakeFinder::type('file')->ignore_version_control()->follow_link()->name(basename($path) . 'Test.php')->in(sfConfig::get('sf_test_dir') . DIRECTORY_SEPARATOR . 'unit' . DIRECTORY_SEPARATOR . dirname($path));
            foreach ($files as $file) {
                include $file;
            }
        }
    } else {
        require_once sfConfig::get('sf_symfony_lib_dir') . '/vendor/lime/lime.php';
        $h = new lime_harness(new lime_output_color());
        $h->base_dir = sfConfig::get('sf_test_dir') . '/unit';
        // register unit tests
        $finder = pakeFinder::type('file')->ignore_version_control()->follow_link()->name('*Test.php');
        $h->register($finder->in($h->base_dir));
        $h->run();
    }
}
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     if (count($arguments['name'])) {
         foreach ($arguments['name'] as $name) {
             $files = sfFinder::type('file')->follow_link()->name(basename($name) . 'Test.php')->in(sfConfig::get('sf_test_dir') . DIRECTORY_SEPARATOR . 'unit' . DIRECTORY_SEPARATOR . dirname($name));
             foreach ($files as $file) {
                 include $file;
             }
         }
     } else {
         require_once sfConfig::get('sf_symfony_lib_dir') . '/vendor/lime/lime.php';
         $h = new lime_harness(new lime_output_color());
         $h->base_dir = sfConfig::get('sf_test_dir') . '/unit';
         // register unit tests
         $finder = sfFinder::type('file')->follow_link()->name('*Test.php');
         $h->register($finder->in($h->base_dir));
         $h->run();
     }
 }
Exemplo n.º 6
0
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $app = $arguments['application'];
     if (count($arguments['controller'])) {
         foreach ($arguments['controller'] as $controller) {
             $files = sfFinder::type('file')->follow_link()->name(basename($controller) . 'Test.php')->in(sfConfig::get('sf_test_dir') . DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . $app . DIRECTORY_SEPARATOR . dirname($controller));
             foreach ($files as $file) {
                 include $file;
             }
         }
     } else {
         require_once sfConfig::get('sf_symfony_lib_dir') . '/vendor/lime/lime.php';
         $h = new lime_harness(new lime_output_color());
         $h->base_dir = sfConfig::get('sf_test_dir') . '/functional/' . $app;
         // register functional tests
         $finder = sfFinder::type('file')->follow_link()->name('*Test.php');
         $h->register($finder->in($h->base_dir));
         return $h->run() ? 0 : 1;
     }
 }
Exemplo n.º 7
0
 protected function execute(array $arguments = array(), array $options = array())
 {
     $this->logLine('Unit testing bee');
     $files = array();
     $dirs = isset($options['dir']) ? $options['dir'] : array();
     if (!isset($options['exclude-project-folder'])) {
         $dirs[] = nbConfig::get('nb_test_dir', 'test/unit');
     }
     if (count($arguments['name'])) {
         foreach ($dirs as $dir) {
             foreach ($arguments['name'] as $name) {
                 $finder = nbFileFinder::create('file')->followLink()->add(basename($name) . 'Test.php');
                 $files = array_merge($files, $finder->in($dir . '/' . dirname($name)));
             }
         }
     } else {
         // filter and register unit tests
         $finder = nbFileFinder::create('file')->add('*Test.php');
         $files = $finder->in($dirs);
     }
     if (count($files) == 0) {
         $this->log('no tests found', nbLogger::ERROR);
         return false;
     }
     $h = new lime_harness();
     $h->register($files);
     $ret = $h->run(isset($options['showall']));
     // print output to file
     if (isset($options['output'])) {
         $fileName = $options['output'];
         $fh = fopen($fileName, 'w');
         if ($fh === false) {
             return $ret;
         }
         fwrite($fh, isset($options['xml']) ? $h->to_xml() : '');
         fclose($fh);
     }
     return $ret;
 }
Exemplo n.º 8
0
<?php

/*
 * This file is part of the symfony package.
 * (c) 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/lime.php';
$h = new lime_harness(array('force_colors' => isset($argv) && in_array('--color', $argv), 'verbose' => isset($argv) && in_array('--verbose', $argv)));
$h->base_dir = realpath(dirname(__FILE__) . '/..');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/../unit'), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
    if (preg_match('/Test\\.php$/', $file)) {
        $h->register($file->getRealPath());
    }
}
exit($h->run() ? 0 : 1);
Exemplo n.º 9
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.
 */
define('SYMFONY_LIB_DIR', realpath(dirname(__FILE__) . '/../../../..'));
require SYMFONY_LIB_DIR . '/vendor/lime/lime.php';
require SYMFONY_LIB_DIR . '/util/sfFinder.class.php';
$h = new lime_harness();
$h->base_dir = realpath(dirname(__FILE__) . '/..');
$h->register(sfFinder::type('file')->prune('fixtures')->name('*Test.php')->in(array($h->base_dir . '/unit', $h->base_dir . '/functional')));
exit($h->run() ? 0 : 1);
<?php

include dirname(__FILE__) . '/../bootstrap/bootstrap.php';
$h = new lime_harness(new lime_output_color());
$h->register(sfFinder::type('file')->name('*Test.php')->in(dirname(__FILE__) . '/..'));
exit($h->run() ? 0 : 1);
Exemplo n.º 11
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.
 */
$_src_path = __DIR__ . '/../../..';
require_once $_src_path . '/Bundle/Lime2Bundle/LimeAutoloader.php';
LimeAutoloader::enableLegacyMode();
LimeAutoloader::register();
require_once $_src_path . '/src/Symfony/src/Symfony/Foundation/UniversalClassLoader.php';
$loader = new Symfony\Foundation\UniversalClassLoader();
$loader->registerNamespace('Symfony', $_src_path . '/src/Symfony/src');
$loader->register();
$h = new lime_harness(new lime_output_color());
$h->base_dir = realpath(dirname(__FILE__));
$finder = new Symfony\Components\Finder\Finder();
$finder = $finder->files()->exclude('fixtures')->name('*Test.php')->in($h->base_dir . '/unit');
$files = array();
foreach ($finder as $file) {
    $files[] = $file->getPathname();
}
$h->register($files);
exit($h->run() ? 0 : 1);
Exemplo n.º 12
0
<?php

/*
 * This file is part of the sfLucenePlugin package
 * (c) 2007 - 2008 Carl Vondrick <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * @package sfLucenePlugin
 * @subpackage Test
 * @author Carl Vondrick
 * @version SVN: $Id$
 */
$_test_dir = realpath(dirname(__FILE__) . '/../../../..');
require dirname(__FILE__) . '/../bootstrap/unit.php';
$h = new lime_harness(new lime_output_color());
$h->base_dir = dirname(__FILE__) . '/../unit';
// register unit tests
$finder = sfFinder::type('file')->ignore_version_control()->follow_link()->name('*Test.php');
$h->register($finder->in($h->base_dir));
$h->run();
Exemplo n.º 13
0
<?php

error_reporting(E_ALL);
require_once dirname(__FILE__) . '/test/vendor/lime.php';
$h = new lime_harness();
$h->base_dir = realpath(dirname(__FILE__));
$h->register(glob(dirname(__FILE__) . '/test/*Test.php'));
exit($h->run() ? 0 : 1);
Exemplo n.º 14
0
<?php

/*
 * This file is part of the symfony package.
 * (c) 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__) . '/../test/bootstrap.php';
$h = new lime_harness(new lime_output_color());
$h->base_dir = realpath(dirname(__FILE__) . '/../test');
$h->register(sfFinder::type('file')->name('*Test.php')->in($h->base_dir));
$h->run();
Exemplo n.º 15
0
function run_test_unit($task, $args)
{
    $environment = isset($arg[1]) ? $arg[1] : G_TEST_ENV;
    printf("start test in %s environment\n", pakeColor::colorize($environment, 'INFO'));
    define('G_ENVIRONMENT', $environment);
    if (isset($args[0])) {
        foreach ($args as $path) {
            $pathUnit = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . dirname($path);
            $files = pakeFinder::type('file')->ignore_version_control()->follow_link()->name(basename($path) . 'Test.php')->in($pathUnit);
            foreach ($files as $file) {
                $fName = str_replace(PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP, '', $file);
                printf("\ntesting %s \n", pakeColor::colorize($fName, 'INFO'));
                include $file;
            }
        }
    } else {
        require_once PATH_THIRDPARTY . '/lime/lime.php';
        $h = new lime_harness(new lime_output_color());
        $h->base_dir = $pathUnit = PATH_CORE . 'test' . PATH_SEP . 'unit';
        //    $h->base_dir = $pathUnit = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . "processmaker";
        // register unit tests
        $finder = pakeFinder::type('file')->ignore_version_control()->follow_link()->name('*Test.php');
        $h->register($finder->in($h->base_dir));
        $h->run();
    }
}