我在使用Travis CI和PHPUnit时遇到了一点问题-它似乎只执行一个测试文件-奇怪的是- tests/unit/helpers/XMLFileTest.php。
https://travis-ci.org/Matt-Barber/DataCruncher/jobs/151193473这里是我正在使用的phpunit.xml.dist的副本:
<phpunit
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
strict="true"
bootstrap="vendor/autoload.php"
verbose = "true"
>
<testsuites>
<testsuite name="unit">
<directory suffix='.php'>./tests/unit</directory>
</testsuite>
<testsuite name="integration">
<directory suffix='.php'>./tests/integration</directory>
</testsuite>
<testsuite name="functional">
<directory suffix='.php'>./tests/functional</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-html" target="build/coverage" title="CSV_Cruncher" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
还有travis。我使用
language: php
php:
- '5.6'
- '7.0'
before_script:
- composer install
- find . -type f -name *.csv -exec chmod 777 {} +
- mkdir build
script:
- phpunit --configuration phpunit.xml.dist --debug
after_script:
- php vendor/bin/coveralls -v
我的src文件夹结构是:
src
- Analysis
- Statistics.php
- Config
- Validation.php
- Exceptions
- [various]
- Helpers
- DataInterface.php
- DataFile.php
- CSVFile.php
- XMLFile.php
- Segmentation
- Merger.php
- Query.php
- Split.php
Tests相同:
tests
- unit
- Analysis
- StatisticsTest.php
等....
这是一个git仓库的链接https://github.com/Matt-Barber/DataCruncher/tree/develop
其他测试没有执行的原因是什么?它们似乎可以在本地运行,也可以通过带有XDebug的流浪机器运行……它伤了我的大脑(你可以从提交历史中看到)
有任何问题,和帮助非常感谢!
干杯!
更新答案是记住
mv Folder folder
和
不一样git mv Folder folder
谢谢hcr !谢谢你指出了区别!
这是一个区分大小写的简单问题。您已经将您的测试目录指定为phpunit.xml.dist
中的./tests/..
,您的repo具有以下结构:
Tests/[...]
tests/unit/Helpers/XMLFileTest.php
PhpUnit只会在Travis上找到第二个。