lxHive supports testing with PHPUnit.
PHPunit is included as a require-dev
dependency.
A phpunit.xml
file is setup in the project root folder of your lxHive app.
The tests
directory contains two sub-directories directories:
namespace | folder | notes |
---|---|---|
\Tests\Unit |
./Unit/* |
Assorted Unit tests, tests for issues, feature tests etc |
\Tests\API |
./src/xAPI/* |
Mirrors the app code's \API namespace and folder structure |
\Tests\Integration |
./Integration/* |
Integration tests, most notably for testing (mock) requests and request validation |
Test files have to follow the *Test.php suffix pattern, i.e. FoobarTest.php
An ExampleTest.php file is provided in the Unit
test directory.
Some tests may require a http-like connection x to your LRS, including basic authentication and xAPI headers.
- Copy
Config.template.php
toConfig.php
- Update
Config::$lrs
with your lrs data including valid authentication
./vendor/bin/phpunit
For more information and available command line options see the PHPUnit documentation