We do our best to follow the Moodle coding guidelines and we recommend you to apply these guidelines if you need to modify or extend this plugin.
Trax Logs has been successfully checked with:
Before running these tests, please exclude the vendor folder which contains third-party libraries that follow their own quality standards.
A test folder is included with the plugin, so you can test most of the plugin features.
-
Check that your Moodle environment is configured to run PHPUnit: https://docs.moodle.org/dev/PHPUnit.
-
Reinitialize the testing environment if it has not been already done:
php admin/tool/phpunit/cli/init.php
. -
In
admin/tool/log/store/trax/tests/utils/settings.php
, set the LRS access settings for your tests.
To run all the tests: vendor/bin/phpunit --testsuite logstore_trax_testsuite
.
To run a specific test: vendor/bin/phpunit admin/tool/log/store/trax/tests/xxx_test.php
, where xxx
can be:
- store: send a simple Statement to the LRS both with sync and async modes.
- async: test the asynchronous synchronization process.
- events: generate and send all supported events, except H5P.
- settings: test some of the plugin settings.
- filters: test the capability of the plugin to filter logs.
- batches: test the capability of the plugin to send batches of Statements.
- errors: test errors management.
- external: test the functions used by the plugin Web Services.
To run a specific test function, add the option --filter=yyy
to the previous command,
where yyy
is the name of the function you want to run.