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);
  }
 /**
  * @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;
 }
 /**
  * @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();
 }
 /**
  * @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();
     }
 }
Exemple #5
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())
 {
     $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;
     }
 }
Exemple #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;
 }
Exemple #8
0
<?php

$cwd = dirname(__FILE__);
require_once $cwd . '/t.php';
$lime = new lime_harness(null);
$lime->register_glob(dirname(__FILE__) . '/lib/*.php');
$lime->register_glob(dirname(__FILE__) . '/lib/OrgModeSyntax/*.php');
$lime->run();
<?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);
Exemple #10
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();
Exemple #11
0
<?php

require_once dirname(__FILE__) . '/lime/lime.php';
$testSuite = new lime_harness();
$testSuite->register_dir(dirname(__FILE__) . '/base');
$testSuite->register_dir(dirname(__FILE__) . '/checks');
$testSuite->run();
Exemple #12
0
/*
 * This file is part of the sfDoctrine package.
 * (c) 2006 Olivier Verdier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * @package    symfony.plugins
 * @subpackage sfDoctrine
 * @author     Pavel Kunc
 * @author     Olivier Verdier <*****@*****.**>
 * @version    SVN: $Id: coverage.php 2690 2006-11-15 18:35:07Z chtito $
 */
$testsDir = realpath(dirname(__FILE__));
define('SF_ROOT_DIR', realpath($testsDir . '/../../../'));
// symfony directories
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
require_once $sf_symfony_lib_dir . '/vendor/lime/lime.php';
$h = new lime_harness(new lime_output_color());
$h->base_dir = dirname(__FILE__);
// unit tests
$h->register_glob($h->base_dir . '/unit/*/*Test.php');
// functional tests
$h->register_glob($h->base_dir . '/functional/*Test.php');
$c = new lime_coverage($h);
$c->extension = '.class.php';
$c->verbose = false;
$c->base_dir = realpath(dirname(__FILE__) . '/../lib');
$c->register_glob($c->base_dir . '/*/*.php');
$c->run();
Exemple #13
0
/*
 * 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.
 */
$name = '*';
$verbose = false;
if (isset($argv[1])) {
    $name = $argv[1];
    $verbose = true;
}
require_once dirname(__FILE__) . '/../../lib/vendor/lime/lime.php';
require_once dirname(__FILE__) . '/../../lib/util/sfFinder.class.php';
$h = new lime_harness();
$h->base_dir = realpath(dirname(__FILE__) . '/..');
// unit tests
$h->register_glob(sprintf('%s/unit/*/%sTest.php', $h->base_dir, $name));
$h->register_glob(sprintf('%s/unit/*/*/%sTest.php', $h->base_dir, $name));
$h->register_glob(sprintf('%s/../lib/plugins/*/unit/%sTest.php', $h->base_dir, $name));
$h->register_glob(sprintf('%s/../lib/plugins/*/unit/*/%sTest.php', $h->base_dir, $name));
// functional tests
$h->register_glob(sprintf('%s/functional/%sTest.php', $h->base_dir, $name));
$h->register_glob(sprintf('%s/functional/*/%sTest.php', $h->base_dir, $name));
$h->register_glob(sprintf('%s/../lib/plugins/*/functional/%sTest.php', $h->base_dir, $name));
$c = new lime_coverage($h);
$c->extension = '.class.php';
$c->verbose = $verbose;
$c->base_dir = realpath(dirname(__FILE__) . '/../../lib');
$finder = sfFinder::type('file')->name($name . '.class.php')->prune('vendor')->prune('test')->prune('data');
Exemple #14
0
<?php

include_once dirname(__FILE__) . '/t.php';
$h = new lime_harness(new lime_output());
$h->register_glob(dirname(__FILE__) . '/../*.php');
$h->run();
Exemple #15
0
<?php

include 'lime.php';
// Beware, lime.php was changed to accept a -c argument for this to work!
$harness = new lime_harness(array('php_cli' => $argv[1]));
$harness->register_glob('unit_tests_*.php');
//$harness->register('coord2d_tests.php');
//$harness->register('envelope_tests.php');
$harness->run();
<?php

/**
 * cli command to test plugin in a standalone environment.
 *
 * you can provide following options:
 * * --symfony : the symfony lib directory
 * * --xml : export results to this file
 */
// first parse options
$options = array_merge(array('symfony' => '/usr/share/php/symfony/', 'xml' => false), getopt("", array("symfony:", "xml:")));
// create the common include for lib path
$sf_lib_path_include = dirname(dirname(__FILE__)) . '/bootstrap/sf_test_lib.inc';
file_put_contents($sf_lib_path_include, sprintf('<?php if (!isset($_SERVER[\'SYMFONY\'])) {$_SERVER[\'SYMFONY\'] = "%s";}', $options['symfony']));
include dirname(__FILE__) . '/../bootstrap/unit.php';
$h = new lime_harness(new lime_output_color());
$h->register(sfFinder::type('file')->name('*Test.php')->in(dirname(__FILE__) . '/..'));
// run tests
$ret = $h->run() ? 1 : 0;
// export to xml ?
if ($options['xml']) {
    file_put_contents($options['xml'], $h->to_xml());
}
// remove the common include for lib path
unlink($sf_lib_path_include);
exit($ret);
Exemple #17
0
<?php

/*
 * This file is part of the sfDoctrine package.
 * (c) 2006 Olivier Verdier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * @package    symfony.plugins
 * @subpackage sfDoctrine
 * @author     Pavel Kunc
 * @author     Olivier Verdier <*****@*****.**>
 * @version    SVN: $Id: prove.php 2874 2006-11-29 16:48:01Z chtito $
 */
$testsDir = realpath(dirname(__FILE__));
require_once $testsDir . '/bootstrap/unit.php';
$h = new lime_harness(new lime_output_color());
$h->base_dir = $testsDir;
// cache autoload files
testAutoloader::initialize(true);
// unit tests
$h->register_glob($h->base_dir . '/unit/*/*Test.php');
// functional tests
//$h->register_glob($h->base_dir.'/functional/*Test.php');
//$h->register_glob($h->base_dir.'/functional/*/*Test.php');
// other tests
//$h->register_glob($h->base_dir.'/other/*Test.php');
$h->run();
testAutoloader::removeCache();
 public function __construct($output_instance, $php_cli = null, $process = 3)
 {
     parent::__construct($output_instance, $php_cli);
     $this->fork_limit = $process;
 }
Exemple #19
0
<?php

include_once dirname(__FILE__) . '/t.php';
$lime = new lime_harness(null);
$lime->register_glob(dirname(__FILE__) . '/lib/*.php');
$lime->register_glob(dirname(__FILE__) . '/lib/HatenaSyntax/*.php');
$lime->run();
Exemple #20
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';
require_once dirname(__FILE__) . '/../../lib/util/sfFinder.class.php';
$h = new lime_harness(new lime_output_color());
$h->base_dir = realpath(dirname(__FILE__) . '/..');
// unit tests
$h->register_glob($h->base_dir . '/unit/*/*Test.php');
$h->register_glob($h->base_dir . '/unit/*/*/*Test.php');
$h->register_glob($h->base_dir . '/../lib/plugins/*/unit/*Test.php');
$h->register_glob($h->base_dir . '/../lib/plugins/*/unit/*/*Test.php');
// functional tests
$h->register_glob($h->base_dir . '/functional/*Test.php');
$h->register_glob($h->base_dir . '/functional/*/*Test.php');
$h->register_glob($h->base_dir . '/../lib/plugins/*/functional/*Test.php');
$c = new lime_coverage($h);
$c->extension = '.class.php';
$c->verbose = false;
$c->base_dir = realpath(dirname(__FILE__) . '/../../lib');
$finder = sfFinder::type('file')->name('*.php')->prune('vendor')->prune('test')->prune('data');
$c->register($finder->in($c->base_dir));
$c->run();
Exemple #21
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('SF_DIR', dirname(__FILE__) . '/../../../../lib/vendor/symfony/');
require_once SF_DIR . 'lib/vendor/lime/lime.php';
require_once SF_DIR . 'lib/util/sfToolkit.class.php';
require_once SF_DIR . 'lib/util/sfFinder.class.php';
if ($files = glob(sys_get_temp_dir() . DIRECTORY_SEPARATOR . '/sf_autoload_unit_*')) {
    foreach ($files as $file) {
        unlink($file);
    }
}
$h = new lime_harness(new lime_output_color());
$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')));
$code = $h->run();
file_put_contents('junit.xml', $h->to_xml());
exit($code ? 0 : 1);
Exemple #22
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);
Exemple #23
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();
    }
}
Exemple #24
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);
Exemple #25
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();
Exemple #26
0
<?php

include dirname(__FILE__) . '/../bootstrap/unit.php';
$h = new lime_harness();
$h->register(sfFinder::type('file')->name('*Test.php')->in(dirname(__FILE__) . '/..'));
$ret = $h->run() ? 0 : 1;
if (isset($argv[1]) && strpos($argv[1], '--xml=') === 0) {
    $file = str_replace('--xml=', '', $argv[1]);
    file_put_contents($file, $h->to_xml());
}
exit($ret);
<?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);
<?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';
$h = new lime_harness(new lime_output_color());
$h->base_dir = realpath(dirname(__FILE__) . '/..');
// cache autoload files
require_once $h->base_dir . '/bootstrap/unit.php';
testAutoloader::initialize(true);
// unit tests
$h->register_glob($h->base_dir . '/unit/*/*Test.php');
// functional tests
$h->register_glob($h->base_dir . '/functional/*Test.php');
$h->register_glob($h->base_dir . '/functional/*/*Test.php');
// other tests
$h->register_glob($h->base_dir . '/other/*Test.php');
$ret = $h->run();
testAutoloader::removeCache();
exit($ret ? 0 : 1);
Exemple #29
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);
Exemple #30
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/lime.php';
$h = new lime_harness(new lime_output(isset($argv) && in_array('--color', $argv)));
$h->base_dir = realpath(dirname(__FILE__) . '/..');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/..'), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
    if (preg_match('/Test\\.php$/', $file)) {
        $h->register($file->getRealPath());
    }
}
$c = new lime_coverage($h);
$c->extension = '.php';
$c->verbose = true;
$c->base_dir = realpath(dirname(__FILE__) . '/../../lib');
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/../../lib'), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
    if (preg_match('/\\.php$/', $file)) {
        $c->register($file->getRealPath());
    }
}
$c->run();