Travis CI 只执行单个测试文件 phpunit
Travis CI only executing single test file phpunit
我在使用 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.yml
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
- unit
- Analysis
- StatisticsTest.php
等等....
这是 git 回购的 link
https://github.com/Matt-Barber/DataCruncher/tree/develop
关于其余测试未执行的任何原因?他们看起来很好 运行 无论是在本地还是通过带有 XDebug 的流浪机器......它伤害了我的大脑(正如你从提交历史中看到的那样)
如有任何问题,请提供帮助,不胜感激!
干杯!
已更新
答案要记住
mv Folder folder
与
不一样
git mv Folder folder
感谢 hcr!指出不同之处!
这是一个简单的区分大小写的问题。您已在 phpunit.xml.dist
中将测试目录指定为 ./tests/..
并且您的存储库具有以下结构:
Tests/[...]
tests/unit/Helpers/XMLFileTest.php
PhpUnit 只会在 Travis 上找到第二个。只要确保到处都使用相同的大小写即可。
我在使用 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.yml
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
- unit
- Analysis
- StatisticsTest.php
等等....
这是 git 回购的 link https://github.com/Matt-Barber/DataCruncher/tree/develop
关于其余测试未执行的任何原因?他们看起来很好 运行 无论是在本地还是通过带有 XDebug 的流浪机器......它伤害了我的大脑(正如你从提交历史中看到的那样)
如有任何问题,请提供帮助,不胜感激!
干杯!
已更新
答案要记住
mv Folder folder
与
不一样git mv Folder folder
感谢 hcr!指出不同之处!
这是一个简单的区分大小写的问题。您已在 phpunit.xml.dist
中将测试目录指定为 ./tests/..
并且您的存储库具有以下结构:
Tests/[...]
tests/unit/Helpers/XMLFileTest.php
PhpUnit 只会在 Travis 上找到第二个。只要确保到处都使用相同的大小写即可。