Travis CI只执行单个测试文件phpunit

时间:2016-08-10 12:18:37

标签: php testing continuous-integration phpunit travis-ci

我对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 repo的链接 https://github.com/Matt-Barber/DataCruncher/tree/develop

为什么其余测试没有执行的原因?它们在本地和使用XDebug的流浪机上看起来都很好......它伤害了我的大脑(正如你从提交历史中看到的那样)

有任何问题,非常感谢!

干杯!

更新

答案是要记住

mv Folder folder

不同
git mv Folder folder

谢谢你!指出差异!

1 个答案:

答案 0 :(得分:1)

这是一个区分大小写的简单问题。您已在./tests/..中将测试目录指定为phpunit.xml.dist,并且您的回购具有以下结构:

Tests/[...]
tests/unit/Helpers/XMLFileTest.php

PhpUnit只会在Travis上找到第二个。只要确保在任何地方使用相同的情况。

相关问题