You will need Docker Engine, Docker Compose, and NodeJS.
Please follow the directions here to install Docker Engine. Be sure to also create a Docker group so Docker can be run without using sudo
.
Next, install Docker Compose:
curl -L https://github.com/docker/compose/releases/download/1.8.1/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
Make sure you have NodeJS installed. If not, follow the instructions here.
Finally, run npm install
in the root folder (this is only required for Javascript linting).
To run all the unit tests:
npm run tests:unit
To run all of the integration tests:
npm run tests:integration
You can see the integration tests in action by connecting your VNC viewer to <host>:5900
and supplying the password secret
.
To run PHP linting:
npm run lint:php
To run Javascript linting:
npm run lint:js
You can view the testing process as it happens with Selenium Server and using VNC Viewer.
-
Start the tests with npm:
npm run tests:integration
-
View the tests as they perform with VNC Viewer at
127.0.0.1
with passwordsecret
. -
You should now be able to view the browser performing all the tests (one by one) in realtime.
You can pass any PHPUnit command-line options by appending --
followed by the options. For example, say you only wanted to run the unit tests contained in the CandidateTest
class. To achieve this you could run the following command:
npm run tests:unit -- --filter CandidateTest
Or, to run a specific test within CandidateTest
:
npm run tests:unit -- --filter CandidateTest::testValidatePSCID
Both the unit and integration tests can be run with XDebug enabled.
npm run tests:unit:debug
Or
npm run tests:integration:debug
You must specify a remote host for XDebug to connect to via the XDEBUG_REMOTE_HOST
environment variable when using either of these commands.
- Run integration tests in parallel
-
By default npm will output some irrelevant info when a script returns a non-zero error code, as described here. To prevent this pass
-s
or--silent
tonpm run
, e.g.npm run -s tests:unit
. -
Running the entire integration test suite with XDebug enabled sometimes results in a segmentation fault. This appears to be an issue with XDebug itself.