idavidmcdonald
idavidmcdonald

Reputation: 103

PHPunit no tests execute on Travis CI

I'm been following a PHPUnit tutorial for the first time and my tests run fine locally. However, when running my tests on Travis CI, no tests are executed and my build exits with 0.

My directory structure and full code can be seen on the repo.

Build log from Travis CI (Full build log)

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

My tests run successfully locally, however maybe there is an issue somewhere with my phpunit.xml file?

Upvotes: 3

Views: 2693

Answers (2)

ymakux
ymakux

Reputation: 3495

language: php

php:
 - 5.4
 - 5.5

install: composer install

script: ./vendor/bin/phpunit

Not sure about install: composer install, probably can be omitted

Upvotes: 0

Sven
Sven

Reputation: 70923

The directory containing your tests is incorrect.

The correct path would be phpUnitTutorial/tests. Note that Windows does not care about case sensitivity, but everyone else in the world does. Best thing would be to always use lower case for paths, or double check you are using the correct case everywhere (PSR-0 and PSR-4 would require path names with the same case as the class name, which will usually include upper case letters).

And by the way: You should probably upgrade to a more recent version of PHPUnit. That old 3.7 series is not getting any more updates for years now, and the transition to 4.x isn't too steep - you should just do it.

Upvotes: 3

Related Questions