如何设置 xampp、phpunit、ant、zend 框架

发布于 2024-11-01 14:22:13 字数 3707 浏览 4 评论 0原文

第一次发帖,请放心。

我正在阅读 Keith Pope 所著的 Zend Framework 1.8 Web 应用程序开发的第一章,以学习 PHP 和 MVC 框架。

我认为我正确包含了所有路径并正确安装了 PHPUnit 3.3 以及 Zend 1.8 和 1.7.4 Xampp。 Ant 版本为 1.8.2。但是,我似乎无法构建第一个最简单的构建。

通过查看此站点上的其他问题,我可以看出 PHPunit 的 build.xml 文件中的一些调用不正确,我已尝试更正它们,但现在我收到错误 C:\ xampp\htdocs\zendStoreFront/library/Zend 不存在,当我添加 Zend 目录时,我收到很多很多错误,这告诉我这可能不是正确的答案。

我知道整个项目中发生了很多事情,我愿意花时间学习,但有一个问题 - 在“ --log-xml ${basedir}/build/logs/phpunit.xml ”这一行“,该文件是否应该已位于此目录中,或者构建过程是否创建了该文件?在某些尝试中,回显的错误表明该文件不存在,并且当前该目录中没有文件。

谢谢,

hestes

cmd line output
*****************


C:\xampp\htdocs\zendStoreFront\build>ant
Buildfile: C:\xampp\htdocs\zendStoreFront\build\build.xml

buildPreparation:

    getProps:
     [echo] ---- Build Properties ----
     [echo]
     [echo] OS is Windows XP
     [echo] Basedir is C:\xampp\htdocs\zendStoreFront
     [echo] Property file is C:\xampp\htdocs\zendStoreFront/build/ant.properties

     [echo] Script-suffix is .bat
     [echo]
     [echo] ---- Storefront Properties ----
     [echo]
     [echo] Environment is development

configure:
     [copy] Copying 1 file to C:\xampp\htdocs\zendStoreFront\application

test:
     [exec] The filename, directory name, or volume label syntax is incorrect.
     [exec] PHPUnit 3.3.10 by Sebastian Bergmann.
     [exec]
     [exec] C:\xampp\htdocs\zendStoreFront/library/Zend does not exist

BUILD FAILED
C:\xampp\htdocs\zendStoreFront\build\build.xml:28: exec returned: 1

Total time: 1 second

C:\xampp\htdocs\zendStoreFront\build>cd ..

C:\xampp\htdocs\zendStoreFront>ant -version
Apache Ant(TM) version 1.8.2 compiled on December 20 2010

Build.xml 文件

<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 --coverage-html ${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-clover ${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"/>

First post here, so take it easy please.

I'm working through the first chapter of Zend Framework 1.8 Web Application Development by Keith Pope in an effort to learn PHP and the MVC framework.

I thought I included all the paths correctly and installed PHPUnit 3.3 correctly as well as Zend 1.8 and 1.7.4 Xampp. with Ant version 1.8.2. However, I can't seem to get the first simplest build to build.

From looking at other q's and a's on this site I can tell some of the calls in the build.xml file for PHPunit aren't correct and I've tried to correct them, but now I'm getting the error that C:\xampp\htdocs\zendStoreFront/library/Zend does not exist and when I add the Zend directory in I get lots and lots of errors which is telling me that's probably not the right answer.

I understand there's a lot going on in the whole project and I'm willing to take the time to learn, but one question- On the line that says " --log-xml ${basedir}/build/logs/phpunit.xml ", is this file expected to be in this directory already, or does the build process create the file? On some attempts an error that's echo'd back say that file doesn't exist and currently there is no file in that directory.

Thanks,

hestes

cmd line output
*****************


C:\xampp\htdocs\zendStoreFront\build>ant
Buildfile: C:\xampp\htdocs\zendStoreFront\build\build.xml

buildPreparation:

    getProps:
     [echo] ---- Build Properties ----
     [echo]
     [echo] OS is Windows XP
     [echo] Basedir is C:\xampp\htdocs\zendStoreFront
     [echo] Property file is C:\xampp\htdocs\zendStoreFront/build/ant.properties

     [echo] Script-suffix is .bat
     [echo]
     [echo] ---- Storefront Properties ----
     [echo]
     [echo] Environment is development

configure:
     [copy] Copying 1 file to C:\xampp\htdocs\zendStoreFront\application

test:
     [exec] The filename, directory name, or volume label syntax is incorrect.
     [exec] PHPUnit 3.3.10 by Sebastian Bergmann.
     [exec]
     [exec] C:\xampp\htdocs\zendStoreFront/library/Zend does not exist

BUILD FAILED
C:\xampp\htdocs\zendStoreFront\build\build.xml:28: exec returned: 1

Total time: 1 second

C:\xampp\htdocs\zendStoreFront\build>cd ..

C:\xampp\htdocs\zendStoreFront>ant -version
Apache Ant(TM) version 1.8.2 compiled on December 20 2010

Build.xml File

<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 --coverage-html ${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-clover ${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"/>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文