Skip to content
This repository
Browse code

Adding support for drupal.uri to get simpletests working.

  • Loading branch information...
commit f4e100ad6e2df15a5b99d2404a81bc60b9970c37 1 parent 90e1fd2
Pol Dell'Aiera authored March 28, 2012 Pol Dell'Aiera committed March 28, 2012

Showing 1 changed file with 43 additions and 33 deletions. Show diff stats Hide diff stats

  1. 76  build.xml
76  build.xml
@@ -693,46 +693,56 @@ Execution of this target can be skipped by setting the
693 693
       <property name="module" value="simpletest"/>
694 694
     </phingcall>
695 695
 
696  
-    <!-- Get a list of all available test cases -->
697  
-    <drush command="test-run" returnProperty="tests" returnGlue="${line.separator}"/>
  696
+    <if>
  697
+      <isset property="drupal.uri">
  698
+      <then>
698 699
 
699  
-    <!-- The project list is piped through a file as this seems to be
700  
-         the only way to handle filtering of values in Phing. -->
701  
-    <delete file="${project.logdir}/tests.txt" />
702  
-    <append text="${tests}" destFile="${project.logdir}/tests.txt" />
  700
+        <!-- Get a list of all available test cases -->
  701
+        <drush command="test-run" uri="${drupal.uri}" root="${project.drupal.dir}" returnProperty="tests" returnGlue="${line.separator}"/>
703 702
 
704  
-    <!-- Build a regular expression to match test groups based on the
705  
-         set properties. The expression should be in the format
706  
-         `^\s?(prefix1|prefix2|prefix3)_`. -->
707  
-    <php expression="'^\s?(' . preg_replace('/(\s+|\s*,\s*)/', '|', '${project.code.prefix}') .').*'"
708  
-         returnProperty="project.code.prefix.regex"/>
  703
+        <!-- The project list is piped through a file as this seems to be
  704
+             the only way to handle filtering of values in Phing. -->
  705
+        <delete file="${project.logdir}/tests.txt" />
  706
+        <append text="${tests}" destFile="${project.logdir}/tests.txt" />
709 707
 
710  
-    <!-- Load the list of tests but keep only the test groups matching our
711  
-         prefixes. -->
712  
-    <loadfile property="project.simpletest.tests"
713  
-              file="${project.logdir}/tests.txt">
714  
-      <filterchain>
715  
-        <linecontainsregexp>
716  
-          <regexp pattern="${project.code.prefix.regex}" ignoreCase="true"/>
717  
-        </linecontainsregexp>
718  
-      </filterchain>
719  
-    </loadfile>
  708
+        <!-- Build a regular expression to match test groups based on the
  709
+             set properties. The expression should be in the format
  710
+             `^\s?(prefix1|prefix2|prefix3)_`. -->
  711
+        <php expression="'^\s?(' . preg_replace('/(\s+|\s*,\s*)/', '|', '${project.code.prefix}') .').*'"
  712
+             returnProperty="project.code.prefix.regex"/>
720 713
 
721  
-<!-- Transform the list of filtered test groups in the form
  714
+        <!-- Load the list of tests but keep only the test groups matching our
  715
+             prefixes. -->
  716
+        <loadfile property="project.simpletest.tests"
  717
+                  file="${project.logdir}/tests.txt">
  718
+          <filterchain>
  719
+            <linecontainsregexp>
  720
+              <regexp pattern="${project.code.prefix.regex}" ignoreCase="true"/>
  721
+            </linecontainsregexp>
  722
+          </filterchain>
  723
+        </loadfile>
722 724
 
723  
-    Groupname 1             Groupname 1
724  
-    Groupname 2             Groupname 2
  725
+        <!-- Transform the list of filtered test groups in the form
725 726
 
726  
-into a list of comma separated unique group names `Groupname 1,Groupname 2`. -->
727  
-    <php expression="implode(',', array_unique(preg_split('/(\s{2,}|\r|\n)/', trim('${project.simpletest.tests}', PREG_SPLIT_NO_EMPTY))))"
728  
-         returnProperty="project.simpletest.tests"/>
  727
+        Groupname 1             Groupname 1
  728
+        Groupname 2             Groupname 2
729 729
 
730  
-    <!-- Run the tests and generate JUnit XML reports. This requires
731  
-         Drush 4.5 or newer or [a patch](http://drupal.org/node/1109408). -->
732  
-    <drush command="test-run" haltonerror="false">
733  
-      <param>${project.simpletest.tests}</param>
734  
-      <option name="xml">${project.testdir}</option>
735  
-    </drush>
  730
+        into a list of comma separated unique group names `Groupname 1,Groupname 2`. -->
  731
+        <php expression="implode(',', array_unique(preg_split('/(\s{2,}|\r|\n)/', trim('${project.simpletest.tests}', PREG_SPLIT_NO_EMPTY))))"
  732
+             returnProperty="project.simpletest.tests"/>
  733
+
  734
+        <!-- Run the tests and generate JUnit XML reports. This requires
  735
+             Drush 4.5 or newer or [a patch](http://drupal.org/node/1109408). -->
  736
+        <drush command="test-run" uri="${drupal.uri}" root="${project.drupal.dir}" haltonerror="false">
  737
+          <param>${project.simpletest.tests}</param>
  738
+          <option name="xml">${project.testdir}</option>
  739
+          </drush>
  740
+      </then>
  741
+      <else>
  742
+        <echo msg="You must set the drupal.uri property to get simpletests working.">
  743
+      </else>
  744
+    </if>
  745
+    
736 746
   </target>
737 747
 
738 748
 <!-- ### Generate documentation -->

0 notes on commit f4e100a

Please sign in to comment.
Something went wrong with that request. Please try again.