I'm using phpunit-spiderling alongside PHPUnit to run browser/functional tests on PhantomJS, installed via jonnyw/php-phantomjs, which in turn installs the phantomjs
binary in <project>/bin
. Since that folder is not in the system path, I need to start tests thus:
PATH=$PATH:`pwd`/bin ./phpunit test/browser/tests
This works fine, but I expect I'll need to condense it into the raw command when I set this up on hosted CI, without the environment prefix:
./phpunit test/browser/tests
I've tried a --bootstrap
command to run a system()
command to reset the system path, to no avail, and I can't see anything in the manual that describes how to do this via phpunit.xml
. Unfortunately Spiderling hard-wires the Phantom command, and it is expected to be visible in the system path.
I've also tried doing this is a setUp()
test method, but that's too late - Spiderling will already have tried, and failed, to start up PhantomJS on a random port.
(The command ./phpunit
is just a symlink to vendor/phpunit/phpunit/phpunit
, which is PHPUnit installed via Composer.)
Further to this question, it turns out that:
phantomjs
in the standard path anywayThus, whilst it turns out I don't need this, there seems to be two ways to achieve it. Since my approach requires the execution of the backticks, I wonder if the
env
approach might not work. However, for completeness, here is both:env
approach is an entry in the .travis.yml file.You could also try a
before_script
key with a value thus:Since the working directory should be set to the root of the project, the
pwd
plus the subdirectory should add in the new path to the system path.