PHPunit在Travis CI上不执行测试

伊达维奇·麦克唐纳

我第一次关注PHPUnit教程,并且我的测试在本地运行良好。但是,在Travis CI上运行测试时,不执行任何测试,并且构建以0退出。

我的目录结构和完整代码可以在仓库中看到

Travis CI的构建日志(完整的构建日志)

1.51s$ curl -s http://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Composer successfully installed to: /home/travis/build/idavidmcdonald/phpunit-tutorial/composer.phar
Use it: php composer.phar
before_script.2
0.33s$ php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
0.08s$ vendor/bin/phpunit --debug
PHPUnit 3.7.14 by Sebastian Bergmann.
Configuration read from /home/travis/build/idavidmcdonald/phpunit-tutorial/phpunit.xml
Time: 13 ms, Memory: 2.00Mb
No tests executed!
The command "vendor/bin/phpunit --debug" exited with 0.
Done. Your build exited with 0.

phpunit.xml:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="vendor/autoload.php">
    <testsuites>
        <testsuite name="Application Test Suite">
            <directory>phpunittutorial/tests/</directory>
        </testsuite>
    </testsuites>
</phpunit>

.travis.yml:

language: php

php:
  - 5.4
  - 5.5

before_script:
  - curl -s http://getcomposer.org/installer | php
  - php composer.phar install

script: vendor/bin/phpunit --debug

我的测试在本地成功运行,但是phpunit.xml文件是否存在问题?

斯文

包含测试的目录不正确。

正确的路径是phpUnitTutorial/tests请注意,Windows并不关心区分大小写,但世界上其他所有人都关心。最好的办法是始终对路径使用小写字母,或者仔细检查您在各处使用的大小写是否正确(PSR-0和PSR-4要求路径名与类名具有相同的大小写,通常包括大写字母)。

顺便说一句:您可能应该升级到更新版本的PHPUnit。那个旧的3.7系列已经很多年没有更新了,向4.x的过渡也不是很陡峭-您应该这样做。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章