| 1 |
<?xml version="1.0"?> |
|---|
| 2 |
|
|---|
| 3 |
<project name="Propel 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 name="tests.tools.dir" value="${tests.phpunit.dir}/tools" /> |
|---|
| 16 |
|
|---|
| 17 |
<property file="./test.properties" /> |
|---|
| 18 |
|
|---|
| 19 |
<path id="test-tools"> |
|---|
| 20 |
<pathelement dir="${tests.tools.dir}" /> |
|---|
| 21 |
</path> |
|---|
| 22 |
|
|---|
| 23 |
<taskdef name="define" classname="phing.DefineTask" classpathRef="test-tools" /> |
|---|
| 24 |
|
|---|
| 25 |
<!-- |
|---|
| 26 |
========================================================================================= |
|---|
| 27 |
PHPUnit Targets |
|---|
| 28 |
~~~~~~~~~~~~~~~~ |
|---|
| 29 |
|
|---|
| 30 |
========================================================================================= |
|---|
| 31 |
--> |
|---|
| 32 |
|
|---|
| 33 |
<property name="test.class" value="${test}" /> |
|---|
| 34 |
|
|---|
| 35 |
<resolvepath propertyName="tests.dir.resolved" file="${tests.phpunit.dir}" /> |
|---|
| 36 |
<resolvepath propertyName="tests.classes.dir.resolved" file="${tests.phpunit.dir}/classes" /> |
|---|
| 37 |
<resolvepath propertyName="propel-generator.classes.dir.resolved" file="../classes" /> |
|---|
| 38 |
<resolvepath propertyName="propel-runtime.classes.dir.resolved" file="../../runtime/classes" /> |
|---|
| 39 |
<resolvepath propertyName="bookstore.classes.dir.resolved" file="../projects/bookstore/build/classes" /> |
|---|
| 40 |
<resolvepath propertyName="bookstore.conf.dir.resolved" file="../projects/bookstore/build/conf" /> |
|---|
| 41 |
|
|---|
| 42 |
<path id="incthis"> |
|---|
| 43 |
<pathelement dir="${tests.dir.resolved}" /> |
|---|
| 44 |
<pathelement dir="${tests.classes.dir.resolved}" /> |
|---|
| 45 |
<pathelement dir="${propel-generator.classes.dir.resolved}" /> |
|---|
| 46 |
<pathelement dir="${propel-runtime.classes.dir.resolved}" /> |
|---|
| 47 |
<pathelement dir="${bookstore.classes.dir.resolved}" /> |
|---|
| 48 |
<pathelement dir="${bookstore.conf.dir.resolved}" /> |
|---|
| 49 |
</path> |
|---|
| 50 |
|
|---|
| 51 |
<target name="configure"> |
|---|
| 52 |
<echo>-------------------------------------------------</echo> |
|---|
| 53 |
<echo> +++++ Running Propel unit tests</echo> |
|---|
| 54 |
<echo>-------------------------------------------------</echo> |
|---|
| 55 |
<define name="TESTS_BASE_DIR" value="${tests.dir.resolved}" /> |
|---|
| 56 |
<adhoc> |
|---|
| 57 |
<![CDATA[ |
|---|
| 58 |
require_once 'propel/Propel.php'; |
|---|
| 59 |
Propel::init('bookstore-conf.php'); |
|---|
| 60 |
]]> |
|---|
| 61 |
</adhoc> |
|---|
| 62 |
|
|---|
| 63 |
<fileset dir="${tests.classes.dir.resolved}" id="relevant-tests"> |
|---|
| 64 |
<include name="**/*${test.class}Test.php" /> |
|---|
| 65 |
</fileset> |
|---|
| 66 |
</target> |
|---|
| 67 |
|
|---|
| 68 |
<includepath classpathRef="incthis" /> |
|---|
| 69 |
|
|---|
| 70 |
<target name="reports" depends="configure"> |
|---|
| 71 |
|
|---|
| 72 |
<phpunit2 haltonerror="false" haltonfailure="false" printsummary="true"> |
|---|
| 73 |
<formatter type="xml" usefile="true" todir="${tests.reports.dir}" outfile="test-results.xml" /> |
|---|
| 74 |
<formatter type="plain" usefile="false" /> |
|---|
| 75 |
<batchtest> |
|---|
| 76 |
<fileset refid="relevant-tests" /> |
|---|
| 77 |
</batchtest> |
|---|
| 78 |
</phpunit2> |
|---|
| 79 |
<phpunit2report format="noframes" todir="${tests.reports.dir}" infile="${tests.reports.dir}/test-results.xml" styledir="${tests.phpunit.dir}/etc/xsl" /> |
|---|
| 80 |
</target> |
|---|
| 81 |
|
|---|
| 82 |
<!-- run the insert-sql target of the build.xml unless we are doing this for one specific test --> |
|---|
| 83 |
<target name="initialize" unless="test"> |
|---|
| 84 |
<!-- |
|---|
| 85 |
<phing phingFile="build.xml" target="insert-sql"/> |
|---|
| 86 |
--> |
|---|
| 87 |
<property name="test.class" value="" override="true" /> |
|---|
| 88 |
</target> |
|---|
| 89 |
|
|---|
| 90 |
<target name="phpunit" depends="initialize,reports" description="Executes the PHPUnit test suite" /> |
|---|
| 91 |
|
|---|
| 92 |
</project> |
|---|