I'm working on a CakePHP 2.x plugin that uses Composer to pull in a package dependency. I am now trying to use the Friends of Cake's Travis package to automatically run my unit tests whenever the plugin's repository is updated.
As far as I can tell this does not include the Composer autoload file required for loading in my vendor files. As a result my tests fail as the class defined in the third-party package is missing.
As described in CakePHP 2's advanced installation I'm trying to add the following to bootstrap.php
:-
require APP . 'Vendor' . DS . 'autoload.php';
I've attempted to do this via the before_script
of my .travis.yml
file to append bootstrap.php
:-
before_script:
- git clone https://github.com/FriendsOfCake/travis.git --depth 1 ../travis
- ../travis/before_script.sh
- echo "require APP . 'Vendor' . DS . 'autoload.php';" >> ../cakephp/app/Config/bootstrap.php
Unfortunately this is failing as the file APP . 'Vendor' . DS . 'autoload.php'
cannot be found. (I have also tried looking for the file in APP . '..' . DS . 'Vendor' . DS . 'autoload.php'
).
Where is the Composer autoload.php
file located when installing CakePHP using Travis? How can I ensure my third-party package is loaded when my tests run remotely on Travis CI?