[limb-svn] r5869 - in 3.x/trunk/limb/tests_runner: src tests tests/cases
svn at limb-project.com
svn at limb-project.com
Sat May 12 00:54:07 MSD 2007
Author: pachanga
Date: 2007-05-12 00:54:07 +0400 (Sat, 12 May 2007)
New Revision: 5869
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5869
Modified:
3.x/trunk/limb/tests_runner/src/lmbTestRunner.class.php
3.x/trunk/limb/tests_runner/src/lmbTestShellUI.class.php
3.x/trunk/limb/tests_runner/tests/cases/lmbTestShellUITest.class.php
3.x/trunk/limb/tests_runner/tests/common.inc.php
Log:
-- lmbTestRunner may accept multiple paths in constructor: limb_unit now can accept multiple file paths(TR-9)
Modified: 3.x/trunk/limb/tests_runner/src/lmbTestRunner.class.php
===================================================================
--- 3.x/trunk/limb/tests_runner/src/lmbTestRunner.class.php 2007-05-11 14:52:12 UTC (rev 5868)
+++ 3.x/trunk/limb/tests_runner/src/lmbTestRunner.class.php 2007-05-11 20:54:07 UTC (rev 5869)
@@ -12,7 +12,7 @@
class lmbTestRunner
{
- protected $test_path;
+ protected $test_paths = array();
protected $test_reporter;
protected $coverage;
protected $coverage_reporter;
@@ -22,7 +22,10 @@
function __construct($test_path)
{
- $this->test_path = $test_path;
+ if(!is_array($test_path))
+ $this->test_paths[] = $test_path;
+ else
+ $this->test_paths = $test_path;
}
function setTestReporter($reporter)
@@ -50,13 +53,17 @@
require_once(dirname(__FILE__) . '/../simpletest.inc.php');
$res = true;
- foreach(glob($this->_normalizePath($this->test_path)) as $file)
+ foreach($this->test_paths as $test_path)
{
- $tests_found = true;
- $root_dir = $this->_getRootDir($file);
- $node = $this->_mapFileToNode($root_dir, $file);
- $tree = $this->_initTree($root_dir);
- $res = $res & $tree->perform($node, $this->_getReporter());
+ foreach(glob($this->_normalizePath($test_path)) as $file)
+ {
+ $tests_found = true;
+ $root_dir = $this->_getRootDir($file);
+ $node = $this->_mapFileToNode($root_dir, $file);
+ $tree = $this->_initTree($root_dir);
+ //we need fresh reporter every time
+ $res = $res & $tree->perform($node, clone($this->_getReporter()));
+ }
}
return $res;
}
Modified: 3.x/trunk/limb/tests_runner/src/lmbTestShellUI.class.php
===================================================================
--- 3.x/trunk/limb/tests_runner/src/lmbTestShellUI.class.php 2007-05-11 14:52:12 UTC (rev 5868)
+++ 3.x/trunk/limb/tests_runner/src/lmbTestShellUI.class.php 2007-05-11 20:54:07 UTC (rev 5869)
@@ -150,13 +150,13 @@
if(!$configured && $config = getenv('LIMB_TESTS_RUNNER_CONFIG'))
include_once($config);
- if(!isset($options[1][0]))
+ if(!is_array($options[1]))
$this->_help(1);
-
+
if(!$cover_report_dir && defined('LIMB_TESTS_RUNNER_COVERAGE_REPORT_DIR'))
$cover_report_dir = LIMB_TESTS_RUNNER_COVERAGE_REPORT_DIR;
- $runner = new lmbTestRunner($options[1][0]);
+ $runner = new lmbTestRunner($options[1]);
if($cover_include)
$runner->useCoverage($cover_include, $cover_exclude, $cover_report_dir);
Modified: 3.x/trunk/limb/tests_runner/tests/cases/lmbTestShellUITest.class.php
===================================================================
--- 3.x/trunk/limb/tests_runner/tests/cases/lmbTestShellUITest.class.php 2007-05-11 14:52:12 UTC (rev 5868)
+++ 3.x/trunk/limb/tests_runner/tests/cases/lmbTestShellUITest.class.php 2007-05-11 20:54:07 UTC (rev 5869)
@@ -82,6 +82,23 @@
$this->assertPattern('~OK~i', $screen);
$this->assertNoPattern('~Error~i', $screen);
}
+
+ function testPerformMultipleArgs()
+ {
+ $foo = $this->_createTestCase($f1 = LIMB_VAR_DIR . '/cases/foo_test.php');
+ $bar = $this->_createTestCase($f2 = LIMB_VAR_DIR . '/cases/a/bar_test.php');
+ $zoo = $this->_createTestCase($f3 = LIMB_VAR_DIR . '/cases/a/z/zoo_test.php');
+
+ $ret = $this->_execScript("$f2 $f1 $f3", $screen);
+ if(!$this->assertEqual($ret, 0))
+ echo $screen;
+
+ $this->assertPattern('~1\s+of\s+1\s+done\(' . $foo->getClass() . '\)~', $screen);
+ $this->assertPattern('~1\s+of\s+1\s+done\(' . $bar->getClass() . '\)~', $screen);
+ $this->assertPattern('~1\s+of\s+1\s+done\(' . $zoo->getClass() . '\)~', $screen);
+ $this->assertPattern('~(.*OK\nTest cases run: 1\/1.*){3}~si', $screen);
+ $this->assertNoPattern('~Error~i', $screen);
+ }
function _createRunScript()
{
Modified: 3.x/trunk/limb/tests_runner/tests/common.inc.php
===================================================================
--- 3.x/trunk/limb/tests_runner/tests/common.inc.php 2007-05-11 14:52:12 UTC (rev 5868)
+++ 3.x/trunk/limb/tests_runner/tests/common.inc.php 2007-05-11 20:54:07 UTC (rev 5869)
@@ -29,7 +29,7 @@
$code = '';
$code .= $add_php ? "<?php\n" : '';
$code .= "class {$this->class_name} extends UnitTestCase {
- function testMe() {echo '{$this->class_name}';}
+ function testMe() {echo \"{$this->class_name}\";}
}";
$code .= $add_php ? "\n?>" : '';
More information about the limb-svn
mailing list