gpt4 book ai didi

php - Jenkins-Phing-PHPUnit 格式化程序不工作

转载 作者:搜寻专家 更新时间:2023-10-31 21:04:40 25 4
gpt4 key购买 nike

在我的项目中,在服务器上,PHP 单元格式化程序任务不工作(不生成报告文件)但在本地开发箱上,它工作。

我的build.xml文件如下:

<?xml version="1.0" encoding="UTF-8" ?>
<project name="Webshop" default="selenium">
<property name="project.lib.dir" value="${project.basedir}/vendor" />

<property name="selenium.logs.dir" value="${project.basedir}/build/logs" />
<property name="selenium.logs.file" value="junit-selenium.xml" />
<property name="selenium.tests.dir" value="${project.basedir}/tests" />

<target name="prepare" depends="clean">
<mkdir dir="${selenium.logs.dir}"/>
</target>

<target name="clean">
<delete dir="${selenium.logs.dir}"/>
</target>

<target name="selenium" description="Run all selenium tests of Webshop" depends="prepare">
<!-- Please change pharlocation. Vendor/bin/phpunit shouldn't be used with phing. -->
<phpunit bootstrap="${project.lib.dir}/autoload.php" pharlocation="${project.lib.dir}/bin/phpunit">
<formatter type="xml" todir="${selenium.logs.dir}" outfile="${selenium.logs.file}" />
<batchtest>
<fileset dir="${selenium.tests.dir}">
<!-- If some test folder needs to be excluded from test, mention it below -->
<!--exclude name="" /-->
</fileset>
</batchtest>
</phpunit>
</target>
</project>

它应该生成文件 'junit-selenium.xml' 但没有生成文件,我得到以下输出(控制台上的测试结果)。

vendor/bin/phing
Buildfile: /home/admin/ee/webshop-selenium/build.xml

Webshop > clean:

[delete] Deleting directory /home/admin/ee/webshop-selenium/build/logs

Webshop > prepare:

[mkdir] Created dir: /home/admin/ee/webshop-selenium/build/logs

Webshop > selenium:

.

Time: 9.99 seconds, Memory: 17.25Mb

OK (1 test, 29 assertions)

有人可以建议我哪里做错了吗?

最佳答案

将您的 selenium 目标替换为一个自定义的 phpunit 目标,该目标在 Linux (CentOS/Debian) 上适用于 PHP 5.5、5.6 和 7.0。

<?xml version="1.0" encoding="UTF-8" ?>
<project name="Webshop" default="phpunit">

<property name="myproject.lib.dir" value="${project.basedir}/vendor" />
<property name="selenium.logs.dir" value="${project.basedir}/build/logs" />
<property name="selenium.logs.file" value="junit-selenium.xml" />
<property name="selenium.tests.dir" value="${project.basedir}/tests" />

<target name="prepare" depends="clean">
<mkdir dir="${selenium.logs.dir}"/>
</target>

<target name="clean">
<delete dir="${selenium.logs.dir}"/>
</target>

<target name="selenium" description="Run all selenium tests of Webshop" depends="prepare">
<!-- Please change pharlocation. Vendor/bin/phpunit shouldn't be used with phing. -->
<phpunit bootstrap="${myproject.lib.dir}/autoload.php" pharlocation="${myproject.lib.dir}/bin/phpunit">
<formatter type="xml" todir="${selenium.logs.dir}" />
<batchtest>
<fileset dir="${selenium.tests.dir}"/>
</batchtest>
</phpunit>
</target>

<fileset id="phptests" dir="${selenium.tests.dir}"/>

<target name="phpunit" description="Run unit tests" depends="prepare">
<coverage-setup database="${selenium.logs.dir}/coverage.db">
<fileset refid="phptests"/>
</coverage-setup>
<phpunit haltonfailure="true" haltonerror="true" printsummary="true" bootstrap="${myproject.lib.dir}/autoload.php"
codecoverage="true">
<formatter todir="${selenium.logs.dir}" type="clover" outfile="clover.xml" />
<formatter todir="${selenium.logs.dir}" type="xml" outfile="junit.xml" />
<batchtest>
<fileset refid="phptests"/>
</batchtest>
</phpunit>
</target>
</project>

关于php - Jenkins-Phing-PHPUnit 格式化程序不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34591866/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com