PHPUnit在Travis CI上“无法读取phpunit.xml”
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了PHPUnit在Travis CI上“无法读取phpunit.xml”,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1782字,纯文字阅读大概需要3分钟。
内容图文
![PHPUnit在Travis CI上“无法读取phpunit.xml”](/upload/InfoBanner/zyjiaocheng/795/69c88c20b6f94a22bfdd13dff1089cd8.jpg)
我在尝试在Travis CI上运行PHP单元测试时遇到了一个奇怪的问题.
.travis.yml
sudo: false
language: php
php:
- 5.4
env:
- VUFIND_HOME=$PWD VUFIND_LOCAL_DIR=$PWD/local
before_script:
- pear install pear/PHP_CodeSniffer
- pear channel-discover pear.phing.info
- pear install phing/phing
- composer global require fabpot/php-cs-fixer
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- phpenv rehash
script:
- phpunit --stderr --configuration module/VuFind/tests/phpunit.xml
- phpunit --stderr --configuration module/Swissbib/tests/phpunit.xml
- phpcs --standard=PEAR --ignore=*/config/*,*/tests/* --extensions=php $PWD/module
- phing php-cs-fixer-dryrun
module / VuFind / tests / phpunit.xml是第三方框架
module / Swissbib / tests / phpunit.xml是我们自己的代码
模块/ Swissbib /测试/ phpunit.xml
<phpunit bootstrap="Bootstrap.php">
<testsuites>
<testsuite name="sbvfrd">
<directory>.</directory>
</testsuite>
</testsuites>
</phpunit>
来自第三方框架的测试运行没有错误.我们自己的测试不起作用,我们收到错误消息:
$phpunit --stderr --configuration module/Swissbib/tests/phpunit.xml
Could not read "module/Swissbib/tests/phpunit.xml".
本地(Mac OS X)所有测试都通过.奇怪的是,模块/ Swissbib / tests / phpunit.xml中定义的Bootstrap.php在Travis CI上完全运行,我使用echo语句验证了这一点.然而,phpunit告诉我们它无法读取phpunit.xml.
特拉维斯:https://travis-ci.org/swissbib/vufind
回购:https://github.com/swissbib/vufind(开发部门)
什么想法可能会出错?
解决方法:
我通过下载phpunit源并使用它调试找到了解决方案.
我们将Bootstrap.php文件中的目录更改为其他位置,然后运行phpunit命令.我们从项目根文件夹运行phpunit命令,然后将工作目录更改为tests文件夹,因为我们使用的是相对路径.我将所有内容都更改为绝对路径(使用__DIR__),因此我们不必再更改工作目录了.
结论:不要更改bootstrap文件中的目录,因为它会导致phpunit失败并显示以下错误消息:无法读取phpunit.xml.
内容总结
以上是互联网集市为您收集整理的PHPUnit在Travis CI上“无法读取phpunit.xml”全部内容,希望文章能够帮你解决PHPUnit在Travis CI上“无法读取phpunit.xml”所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。