[limb-svn] r6074 - in 3.x/branches/2007.3/limb/tests_runner: . src

svn at limb-project.com svn at limb-project.com
Fri Jul 6 12:08:01 MSD 2007


Author: pachanga
Date: 2007-07-06 12:08:00 +0400 (Fri, 06 Jul 2007)
New Revision: 6074
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6074

Modified:
   3.x/branches/2007.3/limb/tests_runner/DESCRIPTION
   3.x/branches/2007.3/limb/tests_runner/src/lmbTestShellUI.class.php
Log:
-- better DESCRIPTION
-- -I/--include options support added, it allows you to override default file filter settings, e.g. -I "*.phpx;*.phps"

Modified: 3.x/branches/2007.3/limb/tests_runner/DESCRIPTION
===================================================================
--- 3.x/branches/2007.3/limb/tests_runner/DESCRIPTION	2007-07-05 15:02:05 UTC (rev 6073)
+++ 3.x/branches/2007.3/limb/tests_runner/DESCRIPTION	2007-07-06 08:08:00 UTC (rev 6074)
@@ -1,11 +1,37 @@
-This package is a SimpleTest test suite wrapper which
-allows to browse and run test cases located in the
-file system.
+This packages provides advanced tools for running SimpleTest(http://www.lastcraft.com/simple_test.php)
+based tests within the file system.
 
-Every directory is considered to be a test group and
-can contain its own test fixtures. There're 2 test
-runners present at the moment for CLI and WEB
-environments
+If you simply grabbed archive with this package without installing it via PEAR installer, most probably
+you want to setup convenient script for running tests(PEAR installer makes it for you).
 
-See further usage docs in examples directory.
+Here's how you can do that:
 
+unit bash script(*nix):
+
+  #/bin/bash
+  php /path/to/tests_runner/bin/limb_unit.php $@
+
+unit.bat(Windows)
+
+  @echo off
+  php /path/to/tests_runner/bin/limb_unit.php %*
+
+Try running in you shell:
+
+unit -h
+
+If everything installed properly you should see a help message.
+
+Some quick shell usage examples using this script:
+
+  $ unit my_test.php      #running all test cases defined in my_test.php
+  $ unit *_test.php       #running all test cases contained in *_test.php files
+  $ unit tests            #running recursively all tests from test directory
+  $ find -name tests -type d | xargs -i unit "{}" #running all tests from any directories called tests
+
+See more documentation on-line:
+
+http://wiki.limb-project.com/doku.php?id=limb3:en:packages:tests_runner:limb_unit
+
+There's also example on how you can use TESTS_RUNNER API to create your own runners. See examples
+directory.

Modified: 3.x/branches/2007.3/limb/tests_runner/src/lmbTestShellUI.class.php
===================================================================
--- 3.x/branches/2007.3/limb/tests_runner/src/lmbTestShellUI.class.php	2007-07-05 15:02:05 UTC (rev 6073)
+++ 3.x/branches/2007.3/limb/tests_runner/src/lmbTestShellUI.class.php	2007-07-06 08:08:00 UTC (rev 6074)
@@ -7,8 +7,6 @@
  * @license    LGPL http://www.gnu.org/copyleft/lesser.html
  */
 require_once(dirname(__FILE__) . '/lmbTestGetopt.class.php');
-require_once(dirname(__FILE__) . '/lmbTestRunner.class.php');
-require_once(dirname(__FILE__) . '/lmbTestTreeGlobNode.class.php');
 
 /**
  * class lmbTestShellUI.
@@ -100,12 +98,12 @@
 
   static function getShortOpts()
   {
-    return 'hvt:b:c:C:';
+    return 'hvI:c:C:';
   }
 
   static function getLongOpts()
   {
-    return array('help', 'version', 'config=', 'cover=', 'cover-report=', 'cover-exclude=');
+    return array('help', 'version', 'include=', 'config=', 'cover=', 'cover-report=', 'cover-exclude=');
   }
 
   function run()
@@ -142,7 +140,7 @@
 
     lmbTestGetopt :: defineConstants($this->argv);
 
-    $configured = false;
+    $config_file = null;
     $cover_include = '';
     $cover_exclude = '';
     $cover_report_dir = null;
@@ -161,10 +159,12 @@
           break;
         case 'c':
         case '--config':
-          if(!@include_once(realpath($option[1])))
-            $this->_error("Could not include configuration file '{$option[1]}'\n");
-          $configured = true;
+          $config_file = $option[1];
           break;
+        case 'I':
+        case '--include':
+          @define('LIMB_TESTS_RUNNER_FILE_FILTER', $option[1]);
+          break;
         case 'C':
         case '--cover':
           $cover_include = $option[1];
@@ -178,8 +178,16 @@
       }
     }
 
-    if(!$configured && $config = getenv('LIMB_TESTS_RUNNER_CONFIG'))
-      include_once($config);
+    if($config_file)
+    {
+      if(!@include_once(realpath($config_file)))
+        $this->_error("Could not include configuration file '$config_file'\n");
+    }
+    else if($config_file = getenv('LIMB_TESTS_RUNNER_CONFIG'))
+    {
+      if(!@include_once($config_file))
+        $this->_error("Could not include configuration file specified in LIMB_TESTS_RUNNER_CONFIG env. variable as '$config_file'\n");
+    }
 
     if(!is_array($options[1]) || !count($options[1]))
       $paths = array('.');
@@ -189,6 +197,7 @@
     if(!$cover_report_dir && defined('LIMB_TESTS_RUNNER_COVERAGE_REPORT_DIR'))
       $cover_report_dir = LIMB_TESTS_RUNNER_COVERAGE_REPORT_DIR;
 
+    require_once(dirname(__FILE__) . '/lmbTestRunner.class.php');
     $runner = new lmbTestRunner();
 
     if($this->reporter)
@@ -199,6 +208,7 @@
 
     try
     {
+      require_once(dirname(__FILE__) . '/lmbTestTreeGlobNode.class.php');
       $node = new lmbTestTreeGlobNode($paths);
       $res = $runner->run($node);
     }



More information about the limb-svn mailing list