3

Im kind of new with Travis, and I am expreimenting with it right now. I uploaded have my PHP Project on Github and when I let it test via Travis it fails and gives me this error.

PHP Fatal error:  Class 'controllers\Welcome' not found in /home/travis/build/ezylot/PHPSkeleton/tests/controllers/welcomeTest.php on line 4

I use a autoloader to load the classes, and it is no problem on my local machine. I include the autoloader in bootsrap.php with the bootstrap in the PHPUnit Konfiguration-XML File.

<?php
if (!@include __DIR__ . '/../vendor/autoload.php') {
    die('You must set up the project dependencies, run the following commands:
        wget http://getcomposer.org/composer.phar
        php composer.phar install');
}
?>
Florian Schöffl
  • 499
  • 3
  • 12

2 Answers2

4

You are most likely developing on OSX which has case insensitive filesystem and tests pass. Travis uses case sensitive file system. Try renaming app/controllers/welcome.php to app/controllers/Welcome.php.

In general it is good idea to follow PSR-1 standard to avoid autoloading issues.

Mika Tuupola
  • 19,877
  • 5
  • 42
  • 49
1

I had a short php open tag at the top of the class file.

<? 

as opposed to

<?php

This broke it on the remote, but not on my local. Which is weird, because I would've expected it to break locally too.

Putting this out there in case someone else is in the same odd situation.

piersb
  • 609
  • 9
  • 22