root/tags/2.3.0RC2/test/build.xml

Revision 145, 2.8 kB (checked in by hans, 2 years ago)

Cleaning up some unit tests & adding Phing build script for tests.

Line 
1 <?xml version="1.0"?>
2
3 <project name="Phing Build Tests" default="phpunit" basedir=".">
4        
5         <!--
6                 =========================================================================================
7                 Global Properties
8                 ~~~~~~~~~~~~~~~~~
9                
10                 =========================================================================================                                       
11         -->
12         <property name="tests.dir" value="./tests"/>
13         <property name="tests.phpunit.dir" value="."/>
14         <property name="tests.reports.dir" value="${tests.phpunit.dir}/reports"/>
15         <property file="./test.properties" />
16
17         <!--
18                 =========================================================================================
19                 PHPUnit2 Targets
20                 ~~~~~~~~~~~~~~~~
21                
22                 =========================================================================================                                       
23         -->
24
25         <property name="test.class" value="${test}"/>
26        
27         <resolvepath propertyName="tests.dir.resolved" file="${tests.phpunit.dir}"/>
28         <resolvepath propertyName="tests.classes.dir.resolved" file="${tests.phpunit.dir}/classes"/>
29         <resolvepath propertyName="phing.classes.dir.resolved" file="../classes"/>
30        
31         <path id="incthis">
32                 <pathelement dir="${tests.dir.resolved}"/>
33                 <pathelement dir="${tests.classes.dir.resolved}"/>
34                 <pathelement dir="${phing.classes.dir.resolved}"/>
35         </path>
36        
37         <target name="configure">
38                 <echo>-------------------------------------------------</echo>
39                 <echo> +++++ Running Phing  unit tests</echo>
40                 <echo>-------------------------------------------------</echo>
41                 <adhoc><![CDATA[
42                         // Cannot use __FILE__ because that is the AdhocTask not this build.xml file
43                         define('PHING_TEST_BASE', dirname($this->getProject()->getProperty('phing.file')));
44                 ]]></adhoc>
45                
46                 <!-- startup will have changed the include_path, so set it back now -->
47                 <includepath classpathRef="incthis"/>
48                        
49                 <fileset dir="${tests.classes.dir.resolved}" id="relevant-tests">
50                         <include name="**/*${test.class}Test.php"/>
51                 </fileset>
52         </target>
53
54         <target name="reports" depends="configure">
55                 <phpunit2 haltonerror="true" haltonfailure="false" printsummary="true">
56                         <formatter type="xml" usefile="true" todir="${tests.reports.dir}" outfile="test-results.xml" />
57                         <formatter type="plain" usefile="false"/>
58                         <batchtest>
59                                 <fileset refid="relevant-tests"/>
60                         </batchtest>
61                 </phpunit2>
62                 <phpunit2report format="noframes" todir="${tests.reports.dir}" infile="${tests.reports.dir}/test-results.xml" styledir="${tests.phpunit.dir}/etc/xsl"/>
63         </target>
64        
65         <!-- run the insert-sql target of the build.xml unless we are doing this for one specific test -->
66         <target name="initialize" unless="test">
67                 <!--
68                 <phing phingFile="build.xml" target="insert-sql"/>
69                 -->
70                 <property name="test.class" value="" override="true"/>
71         </target>
72        
73         <target name="phpunit" depends="initialize,reports" description="Executes the PHPUnit2 test suite"/>
74        
75 </project>
Note: See TracBrowser for help on using the browser.