phpunit - phpUnderControl 和 PHPUnit 总是构建失败,代码为 255

标签 phpunit cruisecontrol phpundercontrol

我在 phpUnderControl 中设置了以下 build.xml 文件。

    <target name="phpunit">
    <exec executable="phpunit" dir="${basedir}/httpdocs" failonerror="on">
        <arg line="--log-junit ${basedir}/build/logs/phpunit.xml
                --coverage-clover ${basedir}/build/logs/phpunit.coverage.xml
                --coverage-html ${basedir}/build/coverage
                --colors
                ${basedir}/httpdocs/qc/unit/CalculatorTest.php" />
    </exec>
</target>

由于某些未知原因,构建总是失败并显示以下消息。

phpunit:
 [exec] PHPUnit 3.4.15 by Sebastian Bergmann.
 [exec] 

BUILD FAILED
/opt/cruisecontrol-bin-2.8.3/projects/citest.local/build.xml:30: exec returned: 255

我在单元目录中手动运行了非常简单的单元测试,PHPUnit 返回了。

PHPUnit 3.4.15 by Sebastian Bergmann.

.

Time: 0 seconds, Memory: 5.25Mb

OK (1 test, 1 assertion)

有谁知道为什么在所有测试都正常的情况下构建仍然失败?

我的构建脚本确实有一个干净的方法来删除和记录文件,所以它不是那样的。我还手动删除了日志文件,以防万一是那个脚本。并更改了日志目录的所有者,使它们可写。

如果有任何不同,PHPUnit 运行后 phpunit.xml 为空。

谢谢。

更新:顺便说一下,如果我删除 failonerror="on" 它显然有效,但是 PHPUnit 仍然返回 255,我确实希望它在出现任何错误时失败,问题是没有任何错误错误但它仍然失败!

最佳答案

255 是 PHP 抛出 fatal error 和(我认为)解析错误的错误代码。

脚本执行中是否存在 fatal error 或解析错误,也许是在测试运行之后?

有任何 PHP 错误吗?如果添加 error_reporting(E_ALL); 会发生什么情况?

关于phpunit - phpUnderControl 和 PHPUnit 总是构建失败,代码为 255,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3319719/

相关文章:

php - 如何执行PHPUnit?

java - 将 Ant 与 PHPUnderControl 一起使用会出现 java.lang.NoClassDefFoundError

PHPUnit 和 C.R.A.P 索引

unit-testing - 如何解决此错误 : "Class PHPUnit_Extensions_SeleniumTestCase could not be found"

zend-framework - ZF-Autoloader 无法在 Ubuntu 上的 UnitTests 中工作

laravel - 不配置白名单,不会产生代码覆盖错误

svn - Cruisecontrol SVN 代理问题

tomcat - 持续交付场景——实现回滚

CruiseControl.NET 在项目配置中使用项目名称

php - 在 Laravel 测试期间创建和删除表