[limb-svn] r5977 - 3.x/trunk/limb/tests_runner/src

svn at limb-project.com svn at limb-project.com
Sat Jun 9 12:58:44 MSD 2007


Author: pachanga
Date: 2007-06-09 12:58:44 +0400 (Sat, 09 Jun 2007)
New Revision: 5977
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5977

Modified:
   3.x/trunk/limb/tests_runner/src/lmbTestShellUI.class.php
Log:
-- better error message if no tests were executed
-- minor internal refactoring

Modified: 3.x/trunk/limb/tests_runner/src/lmbTestShellUI.class.php
===================================================================
--- 3.x/trunk/limb/tests_runner/src/lmbTestShellUI.class.php	2007-06-09 08:14:13 UTC (rev 5976)
+++ 3.x/trunk/limb/tests_runner/src/lmbTestShellUI.class.php	2007-06-09 08:58:44 UTC (rev 5977)
@@ -1,20 +1,20 @@
 <?php
-/*
- * Limb PHP Framework
- *
- * @link http://limb-project.com 
- * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
- * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
+ * @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__) . '/lmbTestRunner.class.php');
+
 /**
  * class lmbTestShellUI.
  *
  * @package tests_runner
  * @version $Id$
- */
+ */
 class lmbTestShellUI
 {
   protected $test_path;
@@ -46,7 +46,12 @@
 
   function help($script = '')
   {
+    $version = $this->_getVersion();
+
     $usage = <<<EOD
+
+$version
+
 Usage:
   limb_unit OPTIONS <file|dir> [<file|dir>, <file|dir>, ...]
   Advanced SimpleTest unit tests runner. Finds and executes unit tests within filesystem.
@@ -63,24 +68,23 @@
 
   protected function _help($code = 0)
   {
-    echo "\n" . $this->_getVersion() . "\n\n";
     echo $this->help();
     exit($code);
   }
 
+  protected function _error($message, $code = 1)
+  {
+    echo "ERROR: $message";
+    echo $this->help();
+    exit($code);
+  }
+
   protected function _version()
   {
     echo $this->_getVersion();
     exit();
   }
 
-  protected function _error($message, $code = 1)
-  {
-    echo "ERROR: $message";
-    echo $this->_help();
-    exit($code);
-  }
-
   protected function _getVersion()
   {
     list(, $number, $status) = explode('-', trim(file_get_contents(dirname(__FILE__) . '/../VERSION')));
@@ -151,7 +155,7 @@
         case 'c':
         case '--config':
           if(!@include_once(realpath($option[1])))
-            $this->_error("Could not include configuration file '{$option[1]}'");
+            $this->_error("Could not include configuration file '{$option[1]}'\n");
           $configured = true;
           break;
         case '--cover':
@@ -184,7 +188,7 @@
     $res = $runner->run($found);
 
     if(!$found)
-      $this->_help(1);
+      $this->_error("No tests were found\n");
 
     echo $runner->getRuntime() . " sec.\n";
 



More information about the limb-svn mailing list