[Fusionforge-commits] r9173 - in trunk/tests: . build/documentation build/packages code/deprecations code/syntax unit unit/config unit/utils

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Sat Mar 20 15:29:16 CET 2010


Author: aljeux
Date: 2010-03-20 15:29:16 +0100 (Sat, 20 Mar 2010)
New Revision: 9173

Added:
   trunk/tests/build/documentation/DocumentationTest.php
   trunk/tests/build/packages/BuildTest.php
   trunk/tests/code/deprecations/DeprecationsTest.php
   trunk/tests/code/syntax/SyntaxTest.php
   trunk/tests/unit/config/ConfigTest.php
   trunk/tests/unit/utils/DbUtilsTest.php
   trunk/tests/unit/utils/TextSanitizerTest.php
   trunk/tests/unit/utils/UtilsTest.php
Removed:
   trunk/tests/build/documentation/AllTests.php
   trunk/tests/build/documentation/DocumentationTests.php
   trunk/tests/build/packages/AllTests.php
   trunk/tests/build/packages/BuildTests.php
   trunk/tests/code/deprecations/AllTests.php
   trunk/tests/code/deprecations/DeprecationsTests.php
   trunk/tests/code/syntax/AllTests.php
   trunk/tests/code/syntax/SyntaxTests.php
   trunk/tests/unit/AllTests.php
   trunk/tests/unit/config/AllTests.php
   trunk/tests/unit/config/ConfigTests.php
   trunk/tests/unit/utils/AllTests.php
   trunk/tests/unit/utils/DbUtilsTests.php
   trunk/tests/unit/utils/TextSanitizerTests.php
   trunk/tests/unit/utils/UtilsTests.php
Modified:
   trunk/tests/AllFullTests.php
   trunk/tests/AllTests.php
Log:
Use new filesystem based layout to simplify test suite (done for build, code and unit)

Modified: trunk/tests/AllFullTests.php
===================================================================
--- trunk/tests/AllFullTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/AllFullTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -6,35 +6,6 @@
 require_once 'PHPUnit/Framework.php';
 require_once 'PHPUnit/TextUI/TestRunner.php';
 
-// Unit tests
-require_once 'unit/utils/AllTests.php';
-require_once 'unit/config/AllTests.php';
-//require_once 'ACL/AllTests.php';
-
-
-// Code tests
-require_once 'code/syntax/AllTests.php';
-require_once 'code/deprecations/AllTests.php';
-
-// Build tests
-require_once 'build/packages/AllTests.php';
-require_once 'build/documentation/AllTests.php';
-
-// Remote tests
-//require_once 'remote/tarball/AllTests.php';
-
-// Selenium based tests
-//require_once 'func/Site/AllTests.php';
-//require_once 'func/Trackers/AllTests.php';
-//require_once 'func/Tasks/AllTests.php';
-//require_once 'func/Forums/AllTests.php';
-//require_once 'func/PluginsWiki/AllTests.php';
-//require_once 'func/PluginsWebSvn/AllTests.php';
-//require_once 'func/News/AllTests.php';
-//require_once 'func/scm/AllTests.php';
-//require_once 'func/docs/AllTests.php';
-
-
 class AllTests
 {
 	public static function main()
@@ -47,31 +18,13 @@
 		$suite = new PHPUnit_Framework_TestSuite('PHPUnit');
 
 		// Unit tests
-		$suite->addTest(Utils_AllTests::suite());
-		$suite->addTest(Config_AllTests::suite());
-//		$suite->addTest(ACL_AllTests::suite());
+		$suite->addTestFiles(glob("unit/*/*Test.php"));
 
 		// Code tests
-		$suite->addTest(Syntax_AllTests::suite());
-		$suite->addTest(Deprecations_AllTests::suite());
+		$suite->addTestFiles(glob("code/*/*Test.php"));
 
 		// Building packages and documentation tests
-		$suite->addTest(Packages_AllTests::suite());
-		$suite->addTest(Documentation_AllTests::suite());
-		
-		// Remote tests
-//		$suite->addTest(Remote_AllTests::suite());
-		
-		// Integration tests (Selenium).
-//		$suite->addTest(Site_AllTests::suite());
-//		$suite->addTest(Trackers_AllTests::suite());
-//		$suite->addTest(Tasks_AllTests::suite());
-//		$suite->addTest(Forums_AllTests::suite());
-//		$suite->addTest(News_AllTests::suite());
-//		$suite->addTest(PluginsWiki_AllTests::suite());
-//		$suite->addTest(PluginsWebSvn_AllTests::suite());
-//		$suite->addTest(Scm_AllTests::suite());
-//		$suite->addTest(Docs_AllTests::suite());
+		$suite->addTestFiles(glob("build/*/*Test.php"));
 
 		return $suite;
 	}

Modified: trunk/tests/AllTests.php
===================================================================
--- trunk/tests/AllTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/AllTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -6,27 +6,6 @@
 require_once 'PHPUnit/Framework.php';
 require_once 'PHPUnit/TextUI/TestRunner.php';
 
-// Unit tests
-require_once 'unit/utils/AllTests.php';
-require_once 'unit/config/AllTests.php';
-//require_once 'ACL/AllTests.php';
-
-// Code tests
-require_once 'code/syntax/AllTests.php';
-require_once 'code/deprecations/AllTests.php';
-
-// Selenium based tests
-//require_once 'func/Site/AllTests.php';
-//require_once 'func/Trackers/AllTests.php';
-//require_once 'func/Tasks/AllTests.php';
-//require_once 'func/Forums/AllTests.php';
-//require_once 'func/PluginsWiki/AllTests.php';
-//require_once 'func/PluginsWebSvn/AllTests.php';
-//require_once 'func/News/AllTests.php';
-//require_once 'func/scm/AllTests.php';
-//require_once 'func/docs/AllTests.php';
-
-
 class AllTests
 {
 	public static function main()
@@ -39,25 +18,11 @@
 		$suite = new PHPUnit_Framework_TestSuite('PHPUnit');
 
 		// Unit tests
-		$suite->addTest(Utils_AllTests::suite());
-		$suite->addTest(Config_AllTests::suite());
-//		$suite->addTest(ACL_AllTests::suite());
+		$suite->addTestFiles(glob("unit/*/*Test.php"));
 
 		// Code tests
-		$suite->addTest(Syntax_AllTests::suite());
-		$suite->addTest(Deprecations_AllTests::suite());
+		$suite->addTestFiles(glob("code/*/*Test.php"));
 		
-		// Integration tests (Selenium).
-//		$suite->addTest(Site_AllTests::suite());
-//		$suite->addTest(Trackers_AllTests::suite());
-//		$suite->addTest(Tasks_AllTests::suite());
-//		$suite->addTest(Forums_AllTests::suite());
-//		$suite->addTest(News_AllTests::suite());
-//		$suite->addTest(PluginsWiki_AllTests::suite());
-//		$suite->addTest(PluginsWebSvn_AllTests::suite());
-//		$suite->addTest(Scm_AllTests::suite());
-//		$suite->addTest(Docs_AllTests::suite());
-		
 		return $suite;
 	}
 }

Deleted: trunk/tests/build/documentation/AllTests.php
===================================================================
--- trunk/tests/build/documentation/AllTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/build/documentation/AllTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,17 +0,0 @@
-<?php
-require_once 'PHPUnit/Framework.php';
- 
-require_once dirname(__FILE__).'/DocumentationTests.php';
-
-class Documentation_AllTests
-{
-    public static function suite()
-    {
-        $suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework');
- 
-        $suite->addTestSuite('Documentation_Tests');
- 
-        return $suite;
-    }
-}
-?>

Copied: trunk/tests/build/documentation/DocumentationTest.php (from rev 9172, trunk/tests/build/documentation/DocumentationTests.php)
===================================================================
--- trunk/tests/build/documentation/DocumentationTest.php	                        (rev 0)
+++ trunk/tests/build/documentation/DocumentationTest.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -0,0 +1,36 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php';
+
+/**
+ * Documentation tests (html, pdf).
+ *
+ * @package   DocumentationTests
+ * @author    Alain Peyrat <aljeux at free.fr>
+ * @copyright 2009 Alain Peyrat. All rights reserved.
+ * @license   http://www.opensource.org/licenses/gpl-license.php  GPL License
+ */
+class Documentation_Tests extends PHPUnit_Framework_TestCase
+{
+    /**
+     * Build HTML documentation from docbook
+     */
+    public function testBuildHTMLDocumentation()
+    {
+	    $tests = dirname( dirname( dirname( dirname (__FILE__)))); 
+	    $base = dirname( $tests );
+	    system("cd ../gforge/docs/docbook; make TARGET=$base/build/documentation/ html", $retval);
+	    $this->assertEquals(0, $retval);
+    }
+
+    /**
+     * Build PDF documentation from docbook
+     */
+    public function skiptestBuildPDFDocumentation()
+    {
+	    $tests = dirname( dirname( dirname( dirname (__FILE__)))); 
+	    $base = dirname( $tests );
+	    system("cd ../gforge/docs/docbook; make TARGET=$base/build/documentation/ pdf", $retval);
+	    $this->assertEquals(0, $retval);
+    }
+}

Deleted: trunk/tests/build/documentation/DocumentationTests.php
===================================================================
--- trunk/tests/build/documentation/DocumentationTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/build/documentation/DocumentationTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,36 +0,0 @@
-<?php
-
-require_once 'PHPUnit/Framework/TestCase.php';
-
-/**
- * Documentation tests (html, pdf).
- *
- * @package   DocumentationTests
- * @author    Alain Peyrat <aljeux at free.fr>
- * @copyright 2009 Alain Peyrat. All rights reserved.
- * @license   http://www.opensource.org/licenses/gpl-license.php  GPL License
- */
-class Documentation_Tests extends PHPUnit_Framework_TestCase
-{
-    /**
-     * Build HTML documentation from docbook
-     */
-    public function testBuildHTMLDocumentation()
-    {
-	    $tests = dirname( dirname( dirname( dirname (__FILE__)))); 
-	    $base = dirname( $tests );
-	    system("cd ../gforge/docs/docbook; make TARGET=$base/build/documentation/ html", $retval);
-	    $this->assertEquals(0, $retval);
-    }
-
-    /**
-     * Build PDF documentation from docbook
-     */
-    public function skiptestBuildPDFDocumentation()
-    {
-	    $tests = dirname( dirname( dirname( dirname (__FILE__)))); 
-	    $base = dirname( $tests );
-	    system("cd ../gforge/docs/docbook; make TARGET=$base/build/documentation/ pdf", $retval);
-	    $this->assertEquals(0, $retval);
-    }
-}

Deleted: trunk/tests/build/packages/AllTests.php
===================================================================
--- trunk/tests/build/packages/AllTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/build/packages/AllTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,17 +0,0 @@
-<?php
-require_once 'PHPUnit/Framework.php';
- 
-require_once dirname(__FILE__).'/BuildTests.php';
-
-class Packages_AllTests
-{
-    public static function suite()
-    {
-        $suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework');
- 
-        $suite->addTestSuite('Packages_Tests');
- 
-        return $suite;
-    }
-}
-?>

Copied: trunk/tests/build/packages/BuildTest.php (from rev 9172, trunk/tests/build/packages/BuildTests.php)
===================================================================
--- trunk/tests/build/packages/BuildTest.php	                        (rev 0)
+++ trunk/tests/build/packages/BuildTest.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -0,0 +1,41 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php';
+
+/**
+ * Packaging tests (tarball, debian, rpm).
+ *
+ * @package   PackagesTests
+ * @author    Alain Peyrat <aljeux at free.fr>
+ * @copyright 2009 Alain Peyrat. All rights reserved.
+ * @license   http://www.opensource.org/licenses/gpl-license.php  GPL License
+ */
+class Packages_Tests extends PHPUnit_Framework_TestCase
+{
+    /**
+     * Build tarballs 
+     */
+    public function testBuildTarball()
+    {
+	    $tests = dirname( dirname( dirname( dirname (__FILE__)))); 
+	    $base = dirname( $tests );
+	    system("cd ..; make BUILDRESULT=$base/build/packages buildtar", $retval);
+	    $this->assertEquals(0, $retval);
+    }
+    
+    public function testBuildDeb()
+    {
+	    $tests = dirname( dirname( dirname( dirname (__FILE__)))); 
+	    $base = dirname( $tests );
+	    system("cd ..; make -f Makefile.debian BUILDRESULT=$base/build/packages clean all", $retval);
+	    $this->assertEquals(0, $retval);
+    }
+
+    public function testBuildRPM()
+    {
+	    $tests = dirname( dirname( dirname( dirname (__FILE__)))); 
+	    $base = dirname( $tests );
+	    system("cd ..; make -f Makefile.rh BUILDRESULT=$base/build/packages all", $retval);
+	    $this->assertEquals(0, $retval);
+    }
+}

Deleted: trunk/tests/build/packages/BuildTests.php
===================================================================
--- trunk/tests/build/packages/BuildTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/build/packages/BuildTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,41 +0,0 @@
-<?php
-
-require_once 'PHPUnit/Framework/TestCase.php';
-
-/**
- * Packaging tests (tarball, debian, rpm).
- *
- * @package   PackagesTests
- * @author    Alain Peyrat <aljeux at free.fr>
- * @copyright 2009 Alain Peyrat. All rights reserved.
- * @license   http://www.opensource.org/licenses/gpl-license.php  GPL License
- */
-class Packages_Tests extends PHPUnit_Framework_TestCase
-{
-    /**
-     * Build tarballs 
-     */
-    public function testBuildTarball()
-    {
-	    $tests = dirname( dirname( dirname( dirname (__FILE__)))); 
-	    $base = dirname( $tests );
-	    system("cd ..; make BUILDRESULT=$base/build/packages buildtar", $retval);
-	    $this->assertEquals(0, $retval);
-    }
-    
-    public function testBuildDeb()
-    {
-	    $tests = dirname( dirname( dirname( dirname (__FILE__)))); 
-	    $base = dirname( $tests );
-	    system("cd ..; make -f Makefile.debian BUILDRESULT=$base/build/packages clean all", $retval);
-	    $this->assertEquals(0, $retval);
-    }
-
-    public function testBuildRPM()
-    {
-	    $tests = dirname( dirname( dirname( dirname (__FILE__)))); 
-	    $base = dirname( $tests );
-	    system("cd ..; make -f Makefile.rh BUILDRESULT=$base/build/packages all", $retval);
-	    $this->assertEquals(0, $retval);
-    }
-}

Deleted: trunk/tests/code/deprecations/AllTests.php
===================================================================
--- trunk/tests/code/deprecations/AllTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/code/deprecations/AllTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,18 +0,0 @@
-<?php
-require_once 'PHPUnit/Framework.php';
- 
-require_once dirname(__FILE__).'/DeprecationsTests.php';
-
-class Deprecations_AllTests
-{
-    public static function suite()
-    {
-        $suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework');
- 
-        $suite->addTestSuite('Deprecations_Tests');
-        // ...
- 
-        return $suite;
-    }
-}
-?>

Copied: trunk/tests/code/deprecations/DeprecationsTest.php (from rev 9172, trunk/tests/code/deprecations/DeprecationsTests.php)
===================================================================
--- trunk/tests/code/deprecations/DeprecationsTest.php	                        (rev 0)
+++ trunk/tests/code/deprecations/DeprecationsTest.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -0,0 +1,54 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php';
+
+/**
+ * Syntax test class.
+ *
+ * @package   DeprecationsTests
+ * @author    Roland Mas <lolando at debian.org>
+ * @copyright 2009 Roland Mas
+ * @license   http://www.opensource.org/licenses/gpl-license.php  GPL License
+ */
+class Deprecations_Tests extends PHPUnit_Framework_TestCase
+{
+	/**
+	 * Check that no code uses db_query()
+	 */
+	public function testdb_query()
+	{
+		$output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -l '\bdb_query\b' \
+					   | grep -v ^tests/code/deprecations/DeprecationsTests.php \
+					   | grep -v ^gforge/db/upgrade-db.php \
+					   | grep -v ^gforge/www/include/database-oci8.php \
+					   | grep -v ^gforge/common/include/database-pgsql.php \
+					   | grep -v ^gforge/common/include/database-mysql.php`;
+		$this->assertEquals('', $output);
+	}
+	
+	/**
+	 * Check that no code uses configuration items from global variables
+	 */
+	public function testconfig_vars()
+	{
+		$vars = array ('sys_name',
+			       'sys_user_reg_restricted') ;
+
+		$pattern = implode ('|', $vars) ;
+		
+		$output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -n '\\$($pattern)\b' \
+					   | grep -v ^gforge/www/include/pre.php`;
+		$this->assertEquals('', $output, "Found deprecated \$var for var in ($pattern):");
+
+		$output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -n '\\\$GLOBALS\\[.?($pattern).?\\]' \
+					   | grep -v ^gforge/www/include/pre.php`;
+		$this->assertEquals('', $output, "Found deprecated \$GLOBALS['\$var'] for var in ($pattern):");
+		
+	}
+	
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+}

Deleted: trunk/tests/code/deprecations/DeprecationsTests.php
===================================================================
--- trunk/tests/code/deprecations/DeprecationsTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/code/deprecations/DeprecationsTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,54 +0,0 @@
-<?php
-
-require_once 'PHPUnit/Framework/TestCase.php';
-
-/**
- * Syntax test class.
- *
- * @package   DeprecationsTests
- * @author    Roland Mas <lolando at debian.org>
- * @copyright 2009 Roland Mas
- * @license   http://www.opensource.org/licenses/gpl-license.php  GPL License
- */
-class Deprecations_Tests extends PHPUnit_Framework_TestCase
-{
-	/**
-	 * Check that no code uses db_query()
-	 */
-	public function testdb_query()
-	{
-		$output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -l '\bdb_query\b' \
-					   | grep -v ^tests/code/deprecations/DeprecationsTests.php \
-					   | grep -v ^gforge/db/upgrade-db.php \
-					   | grep -v ^gforge/www/include/database-oci8.php \
-					   | grep -v ^gforge/common/include/database-pgsql.php \
-					   | grep -v ^gforge/common/include/database-mysql.php`;
-		$this->assertEquals('', $output);
-	}
-	
-	/**
-	 * Check that no code uses configuration items from global variables
-	 */
-	public function testconfig_vars()
-	{
-		$vars = array ('sys_name',
-			       'sys_user_reg_restricted') ;
-
-		$pattern = implode ('|', $vars) ;
-		
-		$output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -n '\\$($pattern)\b' \
-					   | grep -v ^gforge/www/include/pre.php`;
-		$this->assertEquals('', $output, "Found deprecated \$var for var in ($pattern):");
-
-		$output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -n '\\\$GLOBALS\\[.?($pattern).?\\]' \
-					   | grep -v ^gforge/www/include/pre.php`;
-		$this->assertEquals('', $output, "Found deprecated \$GLOBALS['\$var'] for var in ($pattern):");
-		
-	}
-	
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
-
-}

Deleted: trunk/tests/code/syntax/AllTests.php
===================================================================
--- trunk/tests/code/syntax/AllTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/code/syntax/AllTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,18 +0,0 @@
-<?php
-require_once 'PHPUnit/Framework.php';
- 
-require_once dirname(__FILE__).'/SyntaxTests.php';
-
-class Syntax_AllTests
-{
-    public static function suite()
-    {
-        $suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework');
- 
-        $suite->addTestSuite('Syntax_Tests');
-        // ...
- 
-        return $suite;
-    }
-}
-?>

Copied: trunk/tests/code/syntax/SyntaxTest.php (from rev 9172, trunk/tests/code/syntax/SyntaxTests.php)
===================================================================
--- trunk/tests/code/syntax/SyntaxTest.php	                        (rev 0)
+++ trunk/tests/code/syntax/SyntaxTest.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -0,0 +1,54 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php';
+
+/**
+ * Syntax test class.
+ *
+ * @package   SyntaxTests
+ * @author    Alain Peyrat <aljeux at free.fr>
+ * @copyright 2009 Alain Peyrat. All rights reserved.
+ * @license   http://www.opensource.org/licenses/gpl-license.php  GPL License
+ */
+class Syntax_Tests extends PHPUnit_Framework_TestCase
+{
+    /**
+     * Validate all php code with php -l.
+     */
+    public function testPhpSyntax()
+    {
+	    $output = `cd .. ; find gforge tests -name '*.php' -type f  -exec php -l {} \; | grep -v '^No syntax errors detected'`;
+	    $this->assertEquals('', $output);
+    }
+
+    /**
+     * Validate all scripts with isutf8.
+     */
+    public function testUTF8Chars()
+    {
+	    // Skip the wiki part which is not UTF-8 encoded.
+	    $output = `cd .. ; find gforge tests -name '*.php' -not -path 'gforge/plugins/wiki/www/*' -type f | xargs isutf8`;
+	    $this->assertEquals('', $output);
+	    $output = `cd .. ; find gforge tests -name '*.sql' -type f | xargs isutf8`;
+	    $this->assertEquals('', $output);
+	    $output = `cd .. ; find gforge tests -name '*.sh' -type f | xargs isutf8`;
+	    $this->assertEquals('', $output);
+	    $output = `cd .. ; find gforge tests -name '*.pl' -type f | xargs isutf8`;
+	    $this->assertEquals('', $output);
+    }
+
+    /**
+     * Ensure all scripts use Unix-style line endings
+     */
+    public function testUnixLineEndings()
+    {
+	    $output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -l '\r$'`;
+	    $this->assertEquals('', $output);
+	    $output = `cd .. ; find gforge tests -name '*.sql' -type f | xargs pcregrep -l '\r$'`;
+	    $this->assertEquals('', $output);
+	    $output = `cd .. ; find gforge tests -name '*.sh' -type f | xargs pcregrep -l '\r$'`;
+	    $this->assertEquals('', $output);
+	    $output = `cd .. ; find gforge tests -name '*.pl' -type f | xargs pcregrep -l '\r$'`;
+	    $this->assertEquals('', $output);
+    }
+}

Deleted: trunk/tests/code/syntax/SyntaxTests.php
===================================================================
--- trunk/tests/code/syntax/SyntaxTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/code/syntax/SyntaxTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,54 +0,0 @@
-<?php
-
-require_once 'PHPUnit/Framework/TestCase.php';
-
-/**
- * Syntax test class.
- *
- * @package   SyntaxTests
- * @author    Alain Peyrat <aljeux at free.fr>
- * @copyright 2009 Alain Peyrat. All rights reserved.
- * @license   http://www.opensource.org/licenses/gpl-license.php  GPL License
- */
-class Syntax_Tests extends PHPUnit_Framework_TestCase
-{
-    /**
-     * Validate all php code with php -l.
-     */
-    public function testPhpSyntax()
-    {
-	    $output = `cd .. ; find gforge tests -name '*.php' -type f  -exec php -l {} \; | grep -v '^No syntax errors detected'`;
-	    $this->assertEquals('', $output);
-    }
-
-    /**
-     * Validate all scripts with isutf8.
-     */
-    public function testUTF8Chars()
-    {
-	    // Skip the wiki part which is not UTF-8 encoded.
-	    $output = `cd .. ; find gforge tests -name '*.php' -not -path 'gforge/plugins/wiki/www/*' -type f | xargs isutf8`;
-	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge tests -name '*.sql' -type f | xargs isutf8`;
-	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge tests -name '*.sh' -type f | xargs isutf8`;
-	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge tests -name '*.pl' -type f | xargs isutf8`;
-	    $this->assertEquals('', $output);
-    }
-
-    /**
-     * Ensure all scripts use Unix-style line endings
-     */
-    public function testUnixLineEndings()
-    {
-	    $output = `cd .. ; find gforge tests -name '*.php' -type f | xargs pcregrep -l '\r$'`;
-	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge tests -name '*.sql' -type f | xargs pcregrep -l '\r$'`;
-	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge tests -name '*.sh' -type f | xargs pcregrep -l '\r$'`;
-	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge tests -name '*.pl' -type f | xargs pcregrep -l '\r$'`;
-	    $this->assertEquals('', $output);
-    }
-}

Deleted: trunk/tests/unit/AllTests.php
===================================================================
--- trunk/tests/unit/AllTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/unit/AllTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,35 +0,0 @@
-<?php
-if (!defined('PHPUnit_MAIN_METHOD')) {
-	define('PHPUnit_MAIN_METHOD', 'AllTests::main');
-}
-
-require_once 'PHPUnit/Framework.php';
-require_once 'PHPUnit/TextUI/TestRunner.php';
-
-// Unit tests
-require_once 'utils/AllTests.php';
-require_once 'config/AllTests.php';
-
-class AllTests
-{
-	public static function main()
-	{
-		PHPUnit_TextUI_TestRunner::run(self::suite());
-	}
-
-	public static function suite()
-	{
-		$suite = new PHPUnit_Framework_TestSuite('PHPUnit');
-
-		// Unit tests
-		$suite->addTest(Utils_AllTests::suite());
-		$suite->addTest(Config_AllTests::suite());
-		
-		return $suite;
-	}
-}
-
-if (PHPUnit_MAIN_METHOD == 'AllTests::main') {
-	AllTests::main();
-}
-?>

Deleted: trunk/tests/unit/config/AllTests.php
===================================================================
--- trunk/tests/unit/config/AllTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/unit/config/AllTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,17 +0,0 @@
-<?php
-
-require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/ConfigTests.php';
- 
-class Config_AllTests
-{
-    public static function suite()
-    {
-        $suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework');
- 
-        $suite->addTestSuite('Config_Tests');
- 
-        return $suite;
-    }
-}
-?>

Copied: trunk/tests/unit/config/ConfigTest.php (from rev 9172, trunk/tests/unit/config/ConfigTests.php)
===================================================================
--- trunk/tests/unit/config/ConfigTest.php	                        (rev 0)
+++ trunk/tests/unit/config/ConfigTest.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -0,0 +1,84 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php';
+require_once dirname(__FILE__) . '/../../../gforge/common/include/config.php';
+
+/**
+ * Simple tests for the config library.
+ *
+ * @package   Tests
+ * @author    Roland Mas <lolando at debian.org>
+ * @copyright 2009 Roland Mas
+ * @license   GPL License
+ */
+class Config_Tests extends PHPUnit_Framework_TestCase
+{
+	/**
+	 * test basic config getting
+	 */
+	public function testBasicConfig()
+	{
+		forge_define_config_item ('forge_name', 'core', 'default') ;
+		forge_define_config_item ('user_registration_restricted', 'core', true) ;
+
+		$this->assertEquals('default', forge_get_config ('forge_name'));
+		$this->assertEquals('default', forge_get_config ('forge_name', 'core'));
+		$this->assertTrue(forge_get_config ('user_registration_restricted'));
+
+		forge_read_config_file (dirname(__FILE__) . '/../../../gforge/etc/config.ini') ;
+
+		$this->assertEquals('FusionForge', forge_get_config ('forge_name'));
+		$this->assertEquals('FusionForge', forge_get_config ('forge_name', 'core'));
+		$this->assertEquals('', forge_get_config ('user_registration_restricted'));
+
+		$arr = forge_get_config_array ('forge_name', array ('user_registration_restricted', 'core')) ;
+		$this->assertEquals('FusionForge', $arr[0]);
+		$this->assertFalse(!!$arr[1]);
+
+		forge_set_vars_from_config ('forge_name', array ('user_registration_restricted', 'core')) ;
+		global $forge_name, $core__user_registration_restricted ;
+		$this->assertEquals('FusionForge', $forge_name);
+		$this->assertFalse(!!$core__user_registration_restricted);
+
+	}
+
+	/**
+	 * test mock config system
+	 */
+	public function testMockConfig()
+	{
+		MockConfig::insinuate () ;
+		forge_define_config_item ('forge_name', 'core', 'default') ;
+
+		$this->assertEquals('core/forge_name', forge_get_config ('forge_name'));
+		$this->assertEquals('core/forge_name', forge_get_config ('forge_name', 'core'));
+
+		MockConfig::cleanup () ;
+		forge_define_config_item ('forge_name', 'core', 'default') ;
+
+		$this->assertEquals('default', forge_get_config ('forge_name'));
+	}
+
+}
+
+class MockConfig extends FusionForgeConfig {
+	public function insinuate () {
+		parent::$instance = NULL ;
+		self::get_instance () ;
+	}
+
+	public function cleanup () {
+		parent::$instance = NULL ;
+	}
+		
+	public function get_instance () {
+		if (parent::$instance == NULL) {
+			parent::$instance = new MockConfig () ;
+		}
+		return parent::$instance ;
+	}
+	
+	public function get_value ($section, $var) {
+		return "$section/$var" ;
+	}
+}
\ No newline at end of file

Deleted: trunk/tests/unit/config/ConfigTests.php
===================================================================
--- trunk/tests/unit/config/ConfigTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/unit/config/ConfigTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,84 +0,0 @@
-<?php
-
-require_once 'PHPUnit/Framework/TestCase.php';
-require_once dirname(__FILE__) . '/../../../gforge/common/include/config.php';
-
-/**
- * Simple tests for the config library.
- *
- * @package   Tests
- * @author    Roland Mas <lolando at debian.org>
- * @copyright 2009 Roland Mas
- * @license   GPL License
- */
-class Config_Tests extends PHPUnit_Framework_TestCase
-{
-	/**
-	 * test basic config getting
-	 */
-	public function testBasicConfig()
-	{
-		forge_define_config_item ('forge_name', 'core', 'default') ;
-		forge_define_config_item ('user_registration_restricted', 'core', true) ;
-
-		$this->assertEquals('default', forge_get_config ('forge_name'));
-		$this->assertEquals('default', forge_get_config ('forge_name', 'core'));
-		$this->assertTrue(forge_get_config ('user_registration_restricted'));
-
-		forge_read_config_file (dirname(__FILE__) . '/../../../gforge/etc/config.ini') ;
-
-		$this->assertEquals('FusionForge', forge_get_config ('forge_name'));
-		$this->assertEquals('FusionForge', forge_get_config ('forge_name', 'core'));
-		$this->assertEquals('', forge_get_config ('user_registration_restricted'));
-
-		$arr = forge_get_config_array ('forge_name', array ('user_registration_restricted', 'core')) ;
-		$this->assertEquals('FusionForge', $arr[0]);
-		$this->assertFalse(!!$arr[1]);
-
-		forge_set_vars_from_config ('forge_name', array ('user_registration_restricted', 'core')) ;
-		global $forge_name, $core__user_registration_restricted ;
-		$this->assertEquals('FusionForge', $forge_name);
-		$this->assertFalse(!!$core__user_registration_restricted);
-
-	}
-
-	/**
-	 * test mock config system
-	 */
-	public function testMockConfig()
-	{
-		MockConfig::insinuate () ;
-		forge_define_config_item ('forge_name', 'core', 'default') ;
-
-		$this->assertEquals('core/forge_name', forge_get_config ('forge_name'));
-		$this->assertEquals('core/forge_name', forge_get_config ('forge_name', 'core'));
-
-		MockConfig::cleanup () ;
-		forge_define_config_item ('forge_name', 'core', 'default') ;
-
-		$this->assertEquals('default', forge_get_config ('forge_name'));
-	}
-
-}
-
-class MockConfig extends FusionForgeConfig {
-	public function insinuate () {
-		parent::$instance = NULL ;
-		self::get_instance () ;
-	}
-
-	public function cleanup () {
-		parent::$instance = NULL ;
-	}
-		
-	public function get_instance () {
-		if (parent::$instance == NULL) {
-			parent::$instance = new MockConfig () ;
-		}
-		return parent::$instance ;
-	}
-	
-	public function get_value ($section, $var) {
-		return "$section/$var" ;
-	}
-}
\ No newline at end of file

Deleted: trunk/tests/unit/utils/AllTests.php
===================================================================
--- trunk/tests/unit/utils/AllTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/unit/utils/AllTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,21 +0,0 @@
-<?php
-
-require_once 'PHPUnit/Framework.php';
-require_once dirname(__FILE__).'/UtilsTests.php';
-require_once dirname(__FILE__).'/DbUtilsTests.php';
-require_once dirname(__FILE__).'/TextSanitizerTests.php';
- 
-class Utils_AllTests
-{
-    public static function suite()
-    {
-        $suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework');
- 
-        $suite->addTestSuite('Utils_Tests');
-        $suite->addTestSuite('TextSanitizerTests');
-        $suite->addTestSuite('Database_Utils_Tests');
- 
-        return $suite;
-    }
-}
-?>

Copied: trunk/tests/unit/utils/DbUtilsTest.php (from rev 9172, trunk/tests/unit/utils/DbUtilsTests.php)
===================================================================
--- trunk/tests/unit/utils/DbUtilsTest.php	                        (rev 0)
+++ trunk/tests/unit/utils/DbUtilsTest.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -0,0 +1,53 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php' ;
+require_once dirname(__FILE__) . '/../../../gforge/common/include/database-pgsql.php' ;
+
+/**
+ * Simple tests for the utils library.
+ *
+ * @package   Tests
+ * @author    Alain Peyrat <aljeux at free.fr>
+ * @copyright 2009 Alain Peyrat. All rights reserved.
+ * @license   GPL License
+ */
+class Database_Utils_Tests extends PHPUnit_Framework_TestCase
+{
+	/**
+	 * test the validate_hostname function.
+	 */
+	public function testConstructQPA()
+	{
+		$qpa = db_construct_qpa () ;
+		$this->assertEquals('', $qpa[0]) ;
+
+		$qpa = db_construct_qpa ($qpa, 'SELECT foo FROM bar') ;
+		$this->assertEquals('SELECT foo FROM bar', $qpa[0]) ;
+		$this->assertEquals(0, count($qpa[1])) ;
+		$this->assertEquals(0, $qpa[2]) ;
+
+		$qpa = db_construct_qpa ($qpa, ' WHERE name = $1', array ('nrst')) ;
+		$this->assertEquals('SELECT foo FROM bar WHERE name = $1', $qpa[0]) ;
+
+		$qpa = db_construct_qpa ($qpa, ' AND mail = $1 AND addr LIKE $2', array ('auie at foobar',
+									'bépo')) ;
+		$this->assertEquals('SELECT foo FROM bar WHERE name = $1 AND mail = $2 AND addr LIKE $3', $qpa[0]) ;
+
+		$qpa = db_construct_qpa ($qpa, ' AND quux = $1', array ('jldv')) ;
+		$this->assertEquals('SELECT foo FROM bar WHERE name = $1 AND mail = $2 AND addr LIKE $3 AND quux = $4', $qpa[0]) ;
+		$this->assertEquals(array ('nrst', 'auie at foobar', 'bépo', 'jldv'), $qpa[1]) ;
+		$this->assertEquals(4, $qpa[2]) ;
+
+		$qpa = db_construct_qpa ($qpa, ' AND long1 = $1 AND long2 = $2 AND long3 = $3 AND long4 = $4 AND long5 = $5 AND long6 = $6 AND long7 = $7 AND long8 = $8 AND long9 = $9 AND long10 = $10 AND long11 = $11 AND long12 = $12', array (1,2,3,4,5,6,7,8,9,10,11,12)) ;
+		$this->assertEquals('SELECT foo FROM bar WHERE name = $1 AND mail = $2 AND addr LIKE $3 AND quux = $4 AND long1 = $5 AND long2 = $6 AND long3 = $7 AND long4 = $8 AND long5 = $9 AND long6 = $10 AND long7 = $11 AND long8 = $12 AND long9 = $13 AND long10 = $14 AND long11 = $15 AND long12 = $16', $qpa[0]) ;
+
+		$this->assertEquals(array ('nrst', 'auie at foobar', 'bépo', 'jldv', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), $qpa[1]) ;
+		$this->assertEquals(16, $qpa[2]) ;
+
+	}
+}
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:

Deleted: trunk/tests/unit/utils/DbUtilsTests.php
===================================================================
--- trunk/tests/unit/utils/DbUtilsTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/unit/utils/DbUtilsTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,53 +0,0 @@
-<?php
-
-require_once 'PHPUnit/Framework/TestCase.php' ;
-require_once dirname(__FILE__) . '/../../../gforge/common/include/database-pgsql.php' ;
-
-/**
- * Simple tests for the utils library.
- *
- * @package   Tests
- * @author    Alain Peyrat <aljeux at free.fr>
- * @copyright 2009 Alain Peyrat. All rights reserved.
- * @license   GPL License
- */
-class Database_Utils_Tests extends PHPUnit_Framework_TestCase
-{
-	/**
-	 * test the validate_hostname function.
-	 */
-	public function testConstructQPA()
-	{
-		$qpa = db_construct_qpa () ;
-		$this->assertEquals('', $qpa[0]) ;
-
-		$qpa = db_construct_qpa ($qpa, 'SELECT foo FROM bar') ;
-		$this->assertEquals('SELECT foo FROM bar', $qpa[0]) ;
-		$this->assertEquals(0, count($qpa[1])) ;
-		$this->assertEquals(0, $qpa[2]) ;
-
-		$qpa = db_construct_qpa ($qpa, ' WHERE name = $1', array ('nrst')) ;
-		$this->assertEquals('SELECT foo FROM bar WHERE name = $1', $qpa[0]) ;
-
-		$qpa = db_construct_qpa ($qpa, ' AND mail = $1 AND addr LIKE $2', array ('auie at foobar',
-									'bépo')) ;
-		$this->assertEquals('SELECT foo FROM bar WHERE name = $1 AND mail = $2 AND addr LIKE $3', $qpa[0]) ;
-
-		$qpa = db_construct_qpa ($qpa, ' AND quux = $1', array ('jldv')) ;
-		$this->assertEquals('SELECT foo FROM bar WHERE name = $1 AND mail = $2 AND addr LIKE $3 AND quux = $4', $qpa[0]) ;
-		$this->assertEquals(array ('nrst', 'auie at foobar', 'bépo', 'jldv'), $qpa[1]) ;
-		$this->assertEquals(4, $qpa[2]) ;
-
-		$qpa = db_construct_qpa ($qpa, ' AND long1 = $1 AND long2 = $2 AND long3 = $3 AND long4 = $4 AND long5 = $5 AND long6 = $6 AND long7 = $7 AND long8 = $8 AND long9 = $9 AND long10 = $10 AND long11 = $11 AND long12 = $12', array (1,2,3,4,5,6,7,8,9,10,11,12)) ;
-		$this->assertEquals('SELECT foo FROM bar WHERE name = $1 AND mail = $2 AND addr LIKE $3 AND quux = $4 AND long1 = $5 AND long2 = $6 AND long3 = $7 AND long4 = $8 AND long5 = $9 AND long6 = $10 AND long7 = $11 AND long8 = $12 AND long9 = $13 AND long10 = $14 AND long11 = $15 AND long12 = $16', $qpa[0]) ;
-
-		$this->assertEquals(array ('nrst', 'auie at foobar', 'bépo', 'jldv', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), $qpa[1]) ;
-		$this->assertEquals(16, $qpa[2]) ;
-
-	}
-}
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:

Copied: trunk/tests/unit/utils/TextSanitizerTest.php (from rev 9172, trunk/tests/unit/utils/TextSanitizerTests.php)
===================================================================
--- trunk/tests/unit/utils/TextSanitizerTest.php	                        (rev 0)
+++ trunk/tests/unit/utils/TextSanitizerTest.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -0,0 +1,49 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php';
+require_once dirname(__FILE__) . '/../../../gforge/common/include/Error.class.php';
+require_once dirname(__FILE__) . '/../../../gforge/common/include/TextSanitizer.class.php';
+
+/**
+ * Simple tests for the text sanitizer class.
+ *
+ * @package   Tests
+ * @author    Alain Peyrat <aljeux at free.fr>
+ * @copyright 2009 Alain Peyrat. All rights reserved.
+ * @license   GPL License
+ */
+class TextSanitizerTests extends PHPUnit_Framework_TestCase
+{
+	protected $s;
+	
+	function setUp()
+	{
+		$this->s = new TextSanitizer();
+	}
+
+	/**
+	 * test purify on good code.
+	 */
+	public function testPurifyOnValidHtmlCode()
+	{
+		$this->assertEquals('<h1>A valid message</h1>', $this->s->purify('<h1>A valid message</h1>'));
+		$this->assertEquals('<h1>A <b>valid</b> message</h1>', $this->s->purify('<h1>A <B>valid</B> message</h1>'));
+	}
+	
+	/**
+	 * test purify on repairing damaged code.
+	 */
+	public function testPurifyOnInvalidHtmlCode()
+	{
+		$this->assertEquals('<h1>Missing ending tag</h1>', $this->s->purify('<h1>Missing ending tag'));
+		$this->assertEquals('Invalid  tag', $this->s->purify('Invalid <toto> tag'));
+	}
+	
+	/**
+	 * test purify on malicious code.
+	 */
+	public function testPurifyOnMaliciousHtmlCode()
+	{
+		$this->assertEquals('Hacker ', $this->s->purify('Hacker <script>hello</script>'));
+	}
+}

Deleted: trunk/tests/unit/utils/TextSanitizerTests.php
===================================================================
--- trunk/tests/unit/utils/TextSanitizerTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/unit/utils/TextSanitizerTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,49 +0,0 @@
-<?php
-
-require_once 'PHPUnit/Framework/TestCase.php';
-require_once dirname(__FILE__) . '/../../../gforge/common/include/Error.class.php';
-require_once dirname(__FILE__) . '/../../../gforge/common/include/TextSanitizer.class.php';
-
-/**
- * Simple tests for the text sanitizer class.
- *
- * @package   Tests
- * @author    Alain Peyrat <aljeux at free.fr>
- * @copyright 2009 Alain Peyrat. All rights reserved.
- * @license   GPL License
- */
-class TextSanitizerTests extends PHPUnit_Framework_TestCase
-{
-	protected $s;
-	
-	function setUp()
-	{
-		$this->s = new TextSanitizer();
-	}
-
-	/**
-	 * test purify on good code.
-	 */
-	public function testPurifyOnValidHtmlCode()
-	{
-		$this->assertEquals('<h1>A valid message</h1>', $this->s->purify('<h1>A valid message</h1>'));
-		$this->assertEquals('<h1>A <b>valid</b> message</h1>', $this->s->purify('<h1>A <B>valid</B> message</h1>'));
-	}
-	
-	/**
-	 * test purify on repairing damaged code.
-	 */
-	public function testPurifyOnInvalidHtmlCode()
-	{
-		$this->assertEquals('<h1>Missing ending tag</h1>', $this->s->purify('<h1>Missing ending tag'));
-		$this->assertEquals('Invalid  tag', $this->s->purify('Invalid <toto> tag'));
-	}
-	
-	/**
-	 * test purify on malicious code.
-	 */
-	public function testPurifyOnMaliciousHtmlCode()
-	{
-		$this->assertEquals('Hacker ', $this->s->purify('Hacker <script>hello</script>'));
-	}
-}

Copied: trunk/tests/unit/utils/UtilsTest.php (from rev 9172, trunk/tests/unit/utils/UtilsTests.php)
===================================================================
--- trunk/tests/unit/utils/UtilsTest.php	                        (rev 0)
+++ trunk/tests/unit/utils/UtilsTest.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -0,0 +1,41 @@
+<?php
+
+require_once 'PHPUnit/Framework/TestCase.php';
+require_once dirname(__FILE__) . '/../../../gforge/common/include/utils.php';
+
+/**
+ * Simple tests for the utils library.
+ *
+ * @package   Tests
+ * @author    Alain Peyrat <aljeux at free.fr>
+ * @copyright 2009 Alain Peyrat. All rights reserved.
+ * @license   GPL License
+ */
+class Utils_Tests extends PHPUnit_Framework_TestCase
+{
+	/**
+	 * test the validate_email function.
+	 */
+	public function testEmail()
+	{
+		$this->assertTrue(validate_email('al at fx.fr'), 'al at fx.fr is a valid email address');
+
+		$this->assertFalse(validate_email('al @fx.fr'), 'al @fx.fr is not a valid email address');
+
+		$this->assertFalse(validate_email('al'), 'al is not a valid email address');
+	}
+
+	/**
+	 * test the validate_hostname function.
+	 */
+	public function testHostname()
+	{
+		$this->assertTrue(valid_hostname('myhost.com'), 'myhost.com is a valid hostname.');
+
+		$this->assertTrue(valid_hostname('myhost.com.'), 'myhost.com. is a valid hostname.');
+
+		$this->assertFalse(valid_hostname('my host.com'), 'my host.com is not a valid hostname');
+
+		$this->assertFalse(valid_hostname('O at O'), 'O at O is not a valid hostname');
+	}
+}

Deleted: trunk/tests/unit/utils/UtilsTests.php
===================================================================
--- trunk/tests/unit/utils/UtilsTests.php	2010-03-19 20:48:42 UTC (rev 9172)
+++ trunk/tests/unit/utils/UtilsTests.php	2010-03-20 14:29:16 UTC (rev 9173)
@@ -1,41 +0,0 @@
-<?php
-
-require_once 'PHPUnit/Framework/TestCase.php';
-require_once dirname(__FILE__) . '/../../../gforge/common/include/utils.php';
-
-/**
- * Simple tests for the utils library.
- *
- * @package   Tests
- * @author    Alain Peyrat <aljeux at free.fr>
- * @copyright 2009 Alain Peyrat. All rights reserved.
- * @license   GPL License
- */
-class Utils_Tests extends PHPUnit_Framework_TestCase
-{
-	/**
-	 * test the validate_email function.
-	 */
-	public function testEmail()
-	{
-		$this->assertTrue(validate_email('al at fx.fr'), 'al at fx.fr is a valid email address');
-
-		$this->assertFalse(validate_email('al @fx.fr'), 'al @fx.fr is not a valid email address');
-
-		$this->assertFalse(validate_email('al'), 'al is not a valid email address');
-	}
-
-	/**
-	 * test the validate_hostname function.
-	 */
-	public function testHostname()
-	{
-		$this->assertTrue(valid_hostname('myhost.com'), 'myhost.com is a valid hostname.');
-
-		$this->assertTrue(valid_hostname('myhost.com.'), 'myhost.com. is a valid hostname.');
-
-		$this->assertFalse(valid_hostname('my host.com'), 'my host.com is not a valid hostname');
-
-		$this->assertFalse(valid_hostname('O at O'), 'O at O is not a valid hostname');
-	}
-}




More information about the Fusionforge-commits mailing list