[evolvis-commits] r17607: fix Sonar build:

mirabilos at evolvis.org mirabilos at evolvis.org
Fri Oct 21 12:03:44 CEST 2011


Author: mirabilos
Date: 2011-10-21 12:03:44 +0200 (Fri, 21 Oct 2011)
New Revision: 17607

Added:
   trunk/gforge_base/evolvisforge/mvntests/
   trunk/gforge_base/evolvisforge/mvntests/AllTests.php
   trunk/gforge_base/evolvisforge/mvntests/syntax/
Modified:
   trunk/gforge_base/evolvisforge/
   trunk/gforge_base/evolvisforge/README
   trunk/gforge_base/evolvisforge/mvntests/syntax/SyntaxTests.php
   trunk/gforge_base/evolvisforge/pom.xml
Log:
fix Sonar build:

• add a stripped-down testsuite (based on the existing php unit tests)
  adapted for use with Sonar and Maven2
• add notes to README on regress-depends
• edit pom.xml to Make Things Work™ ☺



Property changes on: trunk/gforge_base/evolvisforge
___________________________________________________________________
Added: svn:ignore
   + target


Modified: trunk/gforge_base/evolvisforge/README
===================================================================
--- trunk/gforge_base/evolvisforge/README	2011-10-21 08:30:05 UTC (rev 17606)
+++ trunk/gforge_base/evolvisforge/README	2011-10-21 10:03:44 UTC (rev 17607)
@@ -7,4 +7,10 @@
 
 It should use gforge/BuildDSC.sh which is very nice.
 
+
+The pom.xml is for use with PHP Sonar plugin, as of
+<http://docs.codehaus.org/display/SONAR/PHP+Plugin>
+You must install these packages for the testsuite:
++ moreutils pcregrep
+
 -- Thorsten Glaser

Copied: trunk/gforge_base/evolvisforge/mvntests/AllTests.php (from rev 17606, trunk/gforge_base/evolvisforge/tests/AllTests.php)
===================================================================
--- trunk/gforge_base/evolvisforge/mvntests/AllTests.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge/mvntests/AllTests.php	2011-10-21 10:03:44 UTC (rev 17607)
@@ -0,0 +1,33 @@
+<?php
+if (!defined('PHPUnit_MAIN_METHOD')) {
+	define('PHPUnit_MAIN_METHOD', 'AllTests::main');
+}
+
+require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/TextUI/TestRunner.php';
+
+// Code tests
+require_once 'syntax/AllTests.php';
+
+class AllTests
+{
+	public static function main()
+	{
+		PHPUnit_TextUI_TestRunner::run(self::suite());
+	}
+
+	public static function suite()
+	{
+		$suite = new PHPUnit_Framework_TestSuite('PHPUnit');
+
+		// Code tests
+		$suite->addTest(Syntax_AllTests::suite());
+		
+		return $suite;
+	}
+}
+
+if (PHPUnit_MAIN_METHOD == 'AllTests::main') {
+	AllTests::main();
+}
+?>

Modified: trunk/gforge_base/evolvisforge/mvntests/syntax/SyntaxTests.php
===================================================================
--- trunk/gforge_base/evolvisforge/tests/code/syntax/SyntaxTests.php	2011-10-21 08:30:05 UTC (rev 17606)
+++ trunk/gforge_base/evolvisforge/mvntests/syntax/SyntaxTests.php	2011-10-21 10:03:44 UTC (rev 17607)
@@ -1,5 +1,7 @@
 <?php
 
+/* depends: moreutils pcregrep */
+
 require_once 'PHPUnit/Framework/TestCase.php';
 
 /**
@@ -17,7 +19,7 @@
      */
     public function testPhpSyntax()
     {
-	    $output = `cd .. ; find gforge -name '*.php' -type f  -exec php -l {} \; | grep -v '^No syntax errors detected'`;
+	    $output = `find gforge -name '*.php' -type f  -exec php -l {} \; | grep -v '^No syntax errors detected'`;
 	    $this->assertEquals('', $output);
     }
 
@@ -27,13 +29,13 @@
     public function testUTF8Chars()
     {
 	    // Skip the wiki part which is not UTF-8 encoded.
-	    $output = `cd .. ; find gforge -name '*.php' -not -path 'gforge/plugins/wiki/www/*' -type f  -exec isutf8 {} \;`;
+	    $output = `find gforge -name '*.php' -not -path 'gforge/plugins/wiki/www/*' -type f  -exec isutf8 {} \;`;
 	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge -name '*.sql' -type f  -exec isutf8 {} \;`;
+	    $output = `find gforge -name '*.sql' -type f  -exec isutf8 {} \;`;
 	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge -name '*.sh' -type f  -exec isutf8 {} \;`;
+	    $output = `find gforge -name '*.sh' -type f  -exec isutf8 {} \;`;
 	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge -name '*.pl' -type f  -exec isutf8 {} \;`;
+	    $output = `find gforge -name '*.pl' -type f  -exec isutf8 {} \;`;
 	    $this->assertEquals('', $output);
     }
 
@@ -42,13 +44,13 @@
      */
     public function testUnixLineEndings()
     {
-	    $output = `cd .. ; find gforge -name '*.php' -type f | xargs pcregrep -l '\r$'`;
+	    $output = `find gforge -name '*.php' -type f | xargs pcregrep -l '\r$'`;
 	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge -name '*.sql' -type f | xargs pcregrep -l '\r$'`;
+	    $output = `find gforge -name '*.sql' -type f | xargs pcregrep -l '\r$'`;
 	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge -name '*.sh' -type f | xargs pcregrep -l '\r$'`;
+	    $output = `find gforge -name '*.sh' -type f | xargs pcregrep -l '\r$'`;
 	    $this->assertEquals('', $output);
-	    $output = `cd .. ; find gforge -name '*.pl' -type f | xargs pcregrep -l '\r$'`;
+	    $output = `find gforge -name '*.pl' -type f | xargs pcregrep -l '\r$'`;
 	    $this->assertEquals('', $output);
     }
 }

Modified: trunk/gforge_base/evolvisforge/pom.xml
===================================================================
--- trunk/gforge_base/evolvisforge/pom.xml	2011-10-21 08:30:05 UTC (rev 17606)
+++ trunk/gforge_base/evolvisforge/pom.xml	2011-10-21 10:03:44 UTC (rev 17607)
@@ -5,11 +5,13 @@
   <artifactId>evolvisforge</artifactId>
   <name>EvolvisForge 4.8</name>
   <version>4.8-trunk</version>
-  <build>
-    <sourceDirectory>gforge</sourceDirectory>
-    <testSourceDirectory>mvntests</testSourceDirectory>
-  </build>
+  <packaging>pom</packaging>
   <properties>
     <sonar.language>php</sonar.language>
+    <sonar.phpUnit.mainTestClass>/mvntests/AllTests.php</sonar.phpUnit.mainTestClass>
   </properties>
+  <build>
+    <sourceDirectory>${basedir}/gforge</sourceDirectory>
+    <testSourceDirectory>${basedir}/mvntests</testSourceDirectory>
+  </build>
 </project>



More information about the evolvis-commits mailing list