Skip to content

Commit 68fc394

Browse files
committed
Add Ant file, update PHPUnit files
1 parent a664f8e commit 68fc394

File tree

4 files changed

+142
-7
lines changed

4 files changed

+142
-7
lines changed

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
build
12
RELEASE_MESSAGE*
23
test*.php
34
*.jpg
4-
*.mp4
5+
*.mp4

Diff for: build.xml

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project name="codebird-php" default="build" basedir=".">
4+
<property name="source" value="."/>
5+
<property name="source_comma_sep" value="."/>
6+
<property environment="env"/>
7+
<property name="env.PHPUNIT_XML" value="phpunit.xml"/>
8+
<property name="env.PHPUNIT_XML_HHVM" value="phpunit.xml.hhvm"/>
9+
<property name="env.PHPUNIT_ARGS" value=""/>
10+
11+
<target name="clean" description="Clean up and create artifact directories">
12+
<delete dir="${basedir}/build/api"/>
13+
<delete dir="${basedir}/build/code-browser"/>
14+
<delete dir="${basedir}/build/coverage"/>
15+
<delete dir="${basedir}/build/logs"/>
16+
<delete dir="${basedir}/build/pdepend"/>
17+
18+
<mkdir dir="${basedir}/build/api"/>
19+
<mkdir dir="${basedir}/build/code-browser"/>
20+
<mkdir dir="${basedir}/build/coverage"/>
21+
<mkdir dir="${basedir}/build/logs"/>
22+
<mkdir dir="${basedir}/build/pdepend"/>
23+
</target>
24+
25+
<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
26+
<exec executable="${basedir}/vendor/bin/phpunit" failonerror="true">
27+
<arg line="--configuration ${env.PHPUNIT_XML} ${env.PHPUNIT_ARGS}"/>
28+
</exec>
29+
</target>
30+
31+
<target name="phpunit-hhvm" description="Run unit tests using PHPUnit with HHVM specific config">
32+
<exec executable="${basedir}/vendor/bin/phpunit" failonerror="true">
33+
<arg line="--configuration ${env.PHPUNIT_XML_HHVM} ${env.PHPUNIT_ARGS}"/>
34+
</exec>
35+
</target>
36+
37+
<target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
38+
<exec executable="pdepend">
39+
<arg line="'--jdepend-xml=${basedir}/build/logs/jdepend.xml'
40+
'--jdepend-chart=${basedir}/build/pdepend/dependencies.svg'
41+
'--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg'
42+
${source_comma_sep}" />
43+
</exec>
44+
</target>
45+
46+
<target name="phpmd" description="Generate pmd.xml using PHPMD">
47+
<exec executable="phpmd">
48+
<arg line="${source_comma_sep}
49+
xml
50+
codesize,design,naming,unusedcode
51+
--exclude test,build,vendor
52+
--reportfile '${basedir}/build/logs/pmd.xml'" />
53+
</exec>
54+
</target>
55+
56+
<target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD">
57+
<exec executable="phpcpd">
58+
<arg line="--log-pmd '${basedir}/build/logs/pmd-cpd.xml'
59+
--exclude test
60+
--exclude build
61+
--exclude vendor
62+
${source}" />
63+
</exec>
64+
</target>
65+
66+
<target name="phploc" description="Generate phploc.csv">
67+
<exec executable="phploc">
68+
<arg line="--log-csv '${basedir}/build/logs/phploc.csv'
69+
--exclude test
70+
--exclude build
71+
--exclude vendor
72+
${source}" />
73+
</exec>
74+
</target>
75+
76+
<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer excluding third party libraries">
77+
<exec executable="phpcs">
78+
<arg line="
79+
--ignore=*/vendor/*,*/build/*
80+
--report=checkstyle
81+
--extensions=php
82+
--report-file='${basedir}/build/logs/checkstyle.xml'
83+
--standard=PMAStandard
84+
${source}" />
85+
</exec>
86+
</target>
87+
88+
<target name="phpdoc" description="Generate API documentation using PHPDocumentor">
89+
<exec executable="phpdoc">
90+
<arg line="-d ${source} -t '${basedir}/build/api'" />
91+
</exec>
92+
</target>
93+
94+
<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
95+
<exec executable="phpcb">
96+
<arg line="--log '${basedir}/build/logs'
97+
--source '${source}'
98+
--output '${basedir}/build/code-browser'" />
99+
</exec>
100+
</target>
101+
102+
<target name="lint" description="Perform syntax check of sourcecode files">
103+
<apply executable="php" failonerror="true" output="${basedir}/build/logs/lint.log" logError="true">
104+
<arg value="-l" />
105+
106+
<fileset dir="${basedir}">
107+
<include name="src/**/*.php" />
108+
<include name="test/**/*.php" />
109+
<modified />
110+
</fileset>
111+
</apply>
112+
</target>
113+
114+
<target name="build" depends="clean,phpunit,pdepend,phpmd,phpcpd,phpcs,phpdoc,phploc,phpcb,lint"/>
115+
</project>

Diff for: phpunit.xml

+3-6
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@
1212
<directory suffix="_tests.php">test</directory>
1313
</testsuite>
1414
</testsuites>
15-
<!--
15+
1616
<logging>
17-
<log type="coverage-html" target="build/coverage" title="codebird-php"
18-
charset="UTF-8" yui="true" highlight="true"
19-
lowUpperBound="35" highLowerBound="70"/>
2017
<log type="coverage-clover" target="build/logs/clover.xml"/>
2118
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
2219
</logging>
23-
-->
20+
2421
<filter>
2522
<whitelist addUncoveredFilesFromWhitelist="true">
26-
<directory suffix=".php">.</directory>
23+
<directory suffix=".php">src</directory>
2724
</whitelist>
2825
</filter>
2926
</phpunit>

Diff for: phpunit.xml.hhvm

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="true"
3+
backupStaticAttributes="false"
4+
strict="true"
5+
timeoutForSmallTests="10"
6+
timeoutForMediumTests="30"
7+
colors="true"
8+
verbose="true">
9+
10+
<testsuites>
11+
<testsuite name="Environment">
12+
<file>test/environment_test.php</file>
13+
</testsuite>
14+
<testsuite name="Unit">
15+
<directory suffix="_tests.php">test</directory>
16+
</testsuite>
17+
</testsuites>
18+
19+
<logging>
20+
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
21+
</logging>
22+
</phpunit>

0 commit comments

Comments
 (0)