PHPunit no tests run on Travis CI

This is my first time participating in a PHPUnit tutorial and my tests run fine locally. However, when I run my tests on Travis CI, the tests fail and my build exits at 0.

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

Build Log from Travis CI (Complete 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 are running locally successfully, but maybe there is a problem with the phpunit.xml file?

+3


source to share


2 answers


Invalid directory containing your tests.

The correct path will be phpUnitTutorial/tests

. Note that Windows doesn't care about case sensitivity, but everyone else in the world does. Your best bet would be to use lower case for paths, or double check that you are using the correct case throughout (PSR-0 and PSR-4 will require path names with the same case as the class name, which usually includes upper case letters).



And by the way: you probably need to upgrade to a newer version of PHPUnit. This old 3.7 series hasn't been updated in years, and the upgrade to 4.x isn't too cool - you should just do it.

+3


source


language: php

php:
 - 5.4
 - 5.5

install: composer install

script: ./vendor/bin/phpunit

      



Not sure about install: composer install

, maybe you can omit

0


source







All Articles