Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#12 target phpunit now able to do with bootstrap or without bootstrap
  • Loading branch information
chriscalip committed Aug 14, 2012
1 parent 1f3ae38 commit a0e5d36
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 11 deletions.
8 changes: 5 additions & 3 deletions build.default.properties
Expand Up @@ -69,20 +69,22 @@ csslint.rules.break = parsing-errors
# The url from where to download rhino
rhino.url = http://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R3.zip

#-- Begin phpunit bootstrap configuration
#-- to trigger phpunit without bootstrap comment out/disable phpunit.upal.repository.url
# The phpunit-drupal integration library to use
# alternative is https://github.com/weitzman/upal which continues the assumption of 'System Under Test' the site being tested is the actual site and drupal provides pseudo
# clone through adhoc cloning of db tables with sut prefix
# https://github.com/chriscalip/upal.git is ACS based, Assume Clone Site. assumption the site being tested is cloned, and its ok to create content, orders, etc..
phpunit.upal.repository.url = https://github.com/chriscalip/upal.git
phpunit.upal.repository.revision = master

# phpunit.upal.repository.revision = master
# sample manual command line trigger :
# phpunit --bootstrap drupal_test_case.php --configuration phpunit.xml --log-junit logfile.xml XXXXXUnitTest.php

# (PHPUnit-Drupal integration class) upal bootstrap file name, A "bootstrap" PHP file that is run before the tests. @link http://www.phpunit.de/manual/current/en/textui.html
project.phpunit.bootstrap = drupal_test_case.php
# (PHPUnit-Drupal integration class) upal configuration file name
project.phpunit.configuration = phpunit.xml
#-- End phpunit bootstrap configuration

# Chosen File Pattern by project for phpunit ie.. ExampleUnitTest.php SampleUnitTest.php
project.phpunit.filepattern = UnitTest.php

Expand Down
45 changes: 37 additions & 8 deletions build.xml
Expand Up @@ -1373,12 +1373,7 @@ http://www.phing.info/trac/ticket/437
<target name="phpunit"
description="Execute unit test using phpunit with bootstrap (upal)"
depends="init">
<!-- Clone a repository Drupal-PHPunit Integration Library upal, defined at build.default.properties . -->
<phingcall target="setup-git-repo">
<property name="repo.revision" value="${phpunit.upal.repository.revision}"/>
<property name="repo.url" value="${phpunit.upal.repository.url}" />
<property name="repo.dir" value="${project.toolsdir.upal}" />
</phingcall>
<mkdir dir="${project.unitdir}"/>
<php expression="preg_replace('/(\s+|\s*,\s*)/', ',', '${project.code.custom}')"
returnProperty="project.code.custom"/>
<!-- loop through code custom directories, and call sub-phcs task with setted param -->
Expand All @@ -1388,12 +1383,28 @@ http://www.phing.info/trac/ticket/437
<exec command="find ${project.code.dir} -type d -iname '${custom-directory}'" escape="true" outputProperty="phpunit-custom-directory-location" checkreturn="true"/>
<if>
<not><equals arg1="${phpunit-custom-directory-location}" arg2="" /></not>
<then><phingcall target="call-unit-report" /></then>
<then>
<if>
<isset property="phpunit.upal.repository.url"/>
<then>
<!-- Clone a repository Drupal-PHPunit Integration Library upal, defined at build.default.properties . -->
<phingcall target="setup-git-repo">
<property name="repo.revision" value="${phpunit.upal.repository.revision}"/>
<property name="repo.url" value="${phpunit.upal.repository.url}" />
<property name="repo.dir" value="${project.toolsdir.upal}" />
</phingcall>
<phingcall target="call-unit-report-with-bootstrap" />
</then>
<else>
<phingcall target="call-unit-report-without-bootstrap" />
</else>
</if>
</then>
</if>
</target>


<target name="call-unit-report">
<target name="call-unit-report-with-bootstrap">
<foreach param="fname" absparam="abs-fname" target="sub-unit-report">
<fileset dir=".">
<include name="${phpunit-custom-directory-location}/*${project.phpunit.filepattern}" />
Expand All @@ -1408,12 +1419,30 @@ http://www.phing.info/trac/ticket/437
<target name="move-unitlog">
<move file="${phpunit-filename}-logfile.xml" tofile="${project.unitdir}/${phpunit-filename}-logfile.xml" overwrite="true"/>
</target>
<target name="call-unit-report-without-bootstrap">
<phpunit>
<batchtest>
<fileset dir=".">
<include name="${phpunit-custom-directory-location}/*${project.phpunit.filepattern}" />
</fileset>
</batchtest>

<formatter type="xml" todir="${project.unitdir}" outfile="logfile.xml"/>
</phpunit>

<phpunitreport infile="${project.unitdir}/logfile.xml"
styledir="/usr/share/php/data/phing/etc"
format="frames"
todir="${project.unitdir}"/>
</target>


<!-- ### Execute Execute selenium test using phpunit
-->
<target name="selenium"
description="Execute selenium test using phpunit"
depends="init">
<mkdir dir="${project.seleniumdir}"/>
<php expression="preg_replace('/(\s+|\s*,\s*)/', ',', '${project.code.custom}')"
returnProperty="project.code.custom"/>
<!-- loop through code custom directories, and call sub-selenium task with setted param -->
Expand Down

0 comments on commit a0e5d36

Please sign in to comment.