Created
December 29, 2016 08:41
-
-
Save mrook/22246bbed1b67a56c8ec901ade2aeece to your computer and use it in GitHub Desktop.
Sample Phing build.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
project: | |
_basedir: "." | |
_default: phpunit | |
_name: "Phing Build Tests" | |
items: | |
- | |
property: | |
- | |
_name: tests.dir | |
_value: ./tests | |
- | |
_name: tests.phpunit.dir | |
_value: "." | |
- | |
_name: tests.reports.dir | |
_value: "${tests.phpunit.dir}/reports" | |
- | |
_name: tests.codecoverage | |
_value: false | |
- | |
_name: test.class | |
_value: "${test}" | |
- | |
resolvepath: | |
- | |
_file: "${tests.phpunit.dir}" | |
_propertyName: tests.dir.resolved | |
- | |
_file: "${tests.phpunit.dir}/reports" | |
_propertyName: tests.reports.dir.resolved | |
- | |
_file: "${tests.phpunit.dir}/classes" | |
_propertyName: tests.classes.dir.resolved | |
- | |
_file: ../classes | |
_propertyName: phing.classes.dir.resolved | |
- | |
_file: ../etc | |
_propertyName: phing.etc.dir.resolved | |
- | |
path: | |
- | |
pathelement: | |
- | |
_dir: "${tests.dir.resolved}" | |
- | |
_dir: "${tests.classes.dir.resolved}" | |
- | |
_id: incthis | |
- | |
target: | |
_name: configure | |
items: | |
- | |
echo: | |
- "-------------------------------------------------" | |
- " +++++ Running Phing unit tests" | |
- "-------------------------------------------------" | |
- | |
adhoc: |- | |
// Cannot use __FILE__ because that is the AdhocTask not this build.xml file | |
define('PHING_TEST_BASE', dirname($this->getProject()->getProperty('phing.file'))); | |
- | |
includepath: | |
_classpathRef: incthis | |
- | |
mkdir: | |
_dir: "${tests.reports.dir.resolved}/tests" | |
- | |
mkdir: | |
_dir: "${tests.reports.dir.resolved}/coverage" | |
- | |
fileset: | |
_dir: "${tests.classes.dir.resolved}" | |
_id: relevant-tests | |
exclude: | |
_name: "**/Svn*TaskTest.php" | |
include: | |
_name: "**/*${test.class}.php" | |
- | |
target: | |
_name: reports | |
items: | |
- | |
delete: | |
_dir: tmp | |
- | |
mkdir: | |
_dir: tmp | |
- | |
adhoc: " @include_once 'PHPUnit/Autoload.php'; " | |
- | |
if: | |
equals: | |
_arg1: "${tests.codecoverage}" | |
_arg2: true | |
then: | |
coverage-setup: | |
_database: reports/coverage.db | |
fileset: | |
_dir: "${phing.classes.dir.resolved}" | |
include: | |
_name: "**/*.php" | |
- | |
phpunit: | |
_bootstrap: ../vendor/autoload.php | |
_codecoverage: "${tests.codecoverage}" | |
_configuration: phpunit-sparse.xml | |
_haltonerror: true | |
_haltonfailure: true | |
_pharlocation: /usr/local/bin/phpunit | |
_printsummary: true | |
batchtest: | |
fileset: | |
_refid: relevant-tests | |
formatter: | |
- | |
_outfile: test-results.xml | |
_todir: "${tests.reports.dir.resolved}" | |
_type: xml | |
_usefile: true | |
- | |
_todir: "${tests.reports.dir.resolved}" | |
_type: clover | |
- | |
_type: plain | |
_usefile: false | |
- | |
phpunitreport: | |
_depends: configure | |
_format: frames | |
_infile: "${tests.reports.dir.resolved}/test-results.xml" | |
_name: reports | |
_styledir: "${phing.etc.dir.resolved}" | |
_todir: "${tests.reports.dir.resolved}/tests" | |
- | |
if: | |
equals: | |
_arg1: "${tests.codecoverage}" | |
_arg2: true | |
then: | |
coverage-report: | |
_outfile: reports/coverage.xml | |
report: | |
_styledir: "${phing.etc.dir.resolved}" | |
_title: Phing | |
_todir: reports/coverage | |
_usesorttable: true | |
- | |
target: | |
_name: initialize | |
_unless: test | |
items: | |
- | |
property: | |
_name: test.class | |
_override: true | |
_value: "" | |
- | |
target: | |
_depends: "initialize,reports" | |
_description: "Executes the PHPUnit test suite. To run a specific test: phing -Dtest=NameOfTest" | |
_name: phpunit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment