Reputation: 90
I'm having a bit of a problem with Travis CI and PHPUnit - it seems to be only executing a single test file - strangely - the tests/unit/helpers/XMLFileTest.php.
https://travis-ci.org/Matt-Barber/DataCruncher/jobs/151193473
Here is a copy of the phpunit.xml.dist I'm using :
<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>
And the travis.yml I'm using
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
My folder structure for my src is :
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 is the same:
tests
- unit
- Analysis
- StatisticsTest.php
and so on....
Here is a link to the git repo https://github.com/Matt-Barber/DataCruncher/tree/develop
Any reason as to why the rest of the tests aren't executing? They seem fine running both on local and through a vagrant machine with XDebug...It's hurting my brain (as you can see from the commit history)
Any questions, and help muchly appreciated!
Cheers!
The answer is to remember
mv Folder folder
isn't the same as
git mv Folder folder
thanks hcr! for pointing out the difference!
Upvotes: 0
Views: 165
Reputation: 317
It's a simple problem of case-sensitivity. You've specified your test directory as ./tests/..
in your phpunit.xml.dist
and your repo has the following structure:
Tests/[...]
tests/unit/Helpers/XMLFileTest.php
PhpUnit will only find the second one on Travis. Just make sure that the use the same case everywhere.
Upvotes: 1