我正在Zend Framework 1.8 Web应用程序开发书中编写一个名为storefront的小应用程序。
我安装了PHPUnit,版本是Sebastian Bergmann的PHPUnit 3.6.10。我也安装了apache ant。
作为我的电子书,我创建了一个构建文件夹,并通过CMD在该文件夹中运行ant命令 (文件夹包含ant.properties,build.xml文件)
执行ant命令时出现BUILD FAILED消息,测试部分中有一条消息“无法识别的选项--report”
这是我的build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="StoreFront" default="build" basedir="../">
<target name="getProps">
<property file="${basedir}/build/ant.properties" />
<condition property="script-suffix" value=".bat" else="">
<os family="windows" />
</condition>
<echo message="---- Build Properties ----" />
<echo message="" />
<echo message="OS is ${os.name}" />
<echo message="Basedir is ${basedir}" />
<echo message="Property file is ${basedir}/build/ant.properties" />
<echo message="Script-suffix is ${script-suffix}" />
<echo message="" />
<echo message="---- Storefront Properties ----" />
<echo message="" />
<echo message="Environment is ${environment}" />
</target>
<target name="test" depends="getProps">
<exec dir="${basedir}/tests" executable="phpunit${script-suffix}" failonerror="true">
<arg line="--colors --report ${basedir}/build/report
--log-xml ${basedir}/build/logs/phpunit.xml
--log-pmd ${basedir}/build/logs/phpunit.pmd.xml
--log-metrics ${basedir}/build/logs/phpunit.metrics.xml
--coverage-xml ${basedir}/build/logs/phpunit.coverage.xml
AllTests.php"/>
</exec>
</target>
<target name="configure" depends="getProps">
<copy file="${basedir}/application/application.php.dist"
tofile="${basedir}/application/application.php" overwrite="true" />
<replace file="${basedir}/application/application.php" token="@ENVIRONMENT@" value="${environment}" />
</target>
<target name="buildPreparation">
<mkdir dir="${basedir}/build/logs" />
<mkdir dir="${basedir}/build/report" />
</target>
<target name="clean">
<delete dir="${basedir}/build/logs" />
<delete dir="${basedir}/build/report" />
</target>
<target name="build" depends="buildPreparation,configure,test"/>
</project>
这是我在cmd中收到的消息
C:\wamp\www\storefront\build>ant
Buildfile: C:\wamp\www\storefront\build\build.xml
buildPreparation:
getProps:
[echo] ---- Build Properties ----
[echo]
[echo] OS is Windows 7
[echo] Basedir is C:\wamp\www\storefront
[echo] Property file is C:\wamp\www\storefront/build/ant.properties
[echo] Script-suffix is .bat
[echo]
[echo] ---- Storefront Properties ----
[echo]
[echo] Environment is development
configure:
[copy] Copying 1 file to C:\wamp\www\storefront\application
test:
[exec] PHPUnit 3.6.10 by Sebastian Bergmann.
[exec]
[exec] unrecognized option --report
BUILD FAILED
C:\wamp\www\storefront\build\build.xml:28: exec returned: 1
Total time: 0 seconds
C:\wamp\www\storefront\build>phpunit --version
PHPUnit 3.6.10 by Sebastian Bergmann.
我怎么能按照书中的步骤修复这个呢?
答案 0 :(得分:2)
--report
不是PHPUnit 3.6中的有效命令行开关。
请阅读手册以获取有效选项 - http://www.phpunit.de/manual/current/en/textui.html#textui.clioptions