【问题标题】:ZEND framework & PHPUnit with ant having "unrecognized option --report"ZEND 框架和 PHPUnit 与 ant 具有“无法识别的选项 --report”
【发布时间】:2012-03-31 14:05:27
【问题描述】:

你好,我在 Zend Framework 1.8 Web 应用程序开发一书中做一个小应用程序,叫做店面。

我已经安装了 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.

我该如何解决这个问题,我只是按照书中的步骤进行操作

【问题讨论】:

    标签: zend-framework ant frameworks phpunit


    【解决方案1】:

    --report 在 PHPUnit 3.6 中不是有效的命令行开关。

    请阅读手册以获取有效选项 - http://www.phpunit.de/manual/current/en/textui.html#textui.clioptions

    【讨论】:

    • 谢谢我改变了它,但请你告诉我如何在 3.6 --log-pmd ${basedir}/build/logs/phpunit.pmd.xml --log- 中编写这两个命令指标 ${basedir}/build/logs/phpunit.metrics.xml
    猜你喜欢
    • 2011-04-18
    • 1970-01-01
    • 1970-01-01
    • 2020-01-09
    • 2013-05-22
    • 1970-01-01
    • 2013-04-20
    • 2012-08-19
    • 2011-12-13
    相关资源
    最近更新 更多