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(); }
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(); } }
/** * @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; } }
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; }
<?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);
<?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 /* * 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);
<?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);
<?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();
<?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);
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(); } }
<?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();
<?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);
<?php /** * cli command to test plugin in a standalone environment. * * See the test/bootstrap/options.php file to see the available options */ include_once dirname(__FILE__) . '/../bootstrap/options.php'; 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__) . '/..')); $old_dir = getcwd(); chdir(dirname(__FILE__) . '/../fixtures/project'); // run tests $ret = !$h->run() ? 1 : 0; chdir($old_dir); // export to xml ? if ($options['xml']) { file_put_contents($options['xml'], $h->to_xml()); } exit($ret);