The repository contains GitHub Actions workflows, that are reused by the other repositories.
We now support two test types: Legacy Tests and JWT Tests.
Legacy tests continue to follow the existing workflow test scenarios. No changes are required for plugins that only use legacy tests.
A new workflow parameter is available to control whether legacy tests should be executed:
perform-legacy-tests(default:true)
Legacy tests will always run unless this parameter is explicitly set to false.
To enable JWT-specific tests, several prerequisites must be met.
If your plugin contains JWT-specific tests, you must set the perform-jwt-tests parameter to true when calling the CI workflow:
jobs:
call-moodle-ci-workflow:
uses: Opencast-Moodle/moodle-workflows-opencast/.github/workflows/moodle-ci.yml@main
with:
perform-jwt-tests: true # Required
requires-block-plugin: true # For Example, change based on your need.
branch-block-plugin: main # For Example, change based on your need.To ensure tests are recognized as JWT tests, follow the guidelines below.
PHPUnit tests are distinguished by the TEST_TYPE environment variable, which is set to either legacy or jwt.
To simplify this check, the tool_opencast plugin provides the tool_opencast_test_type_helper class with the following helper methods:
is_legacy_test()is_jwt_test()
JWT-specific tests should verify the test type during setup and skip execution when the current test run does not match the intended test type.
Example:
public function setUp(): void {
parent::setUp();
if (!tool_opencast_test_type_helper::is_jwt_test()) {
$this->markTestSkipped(
'Skipping JWT test because the current test type is not JWT.'
);
}
}For Behat tests, simply add the @opencast_jwt_test tag to the feature file:
@opencast_jwt_test
Feature: JWT authenticationThe test-jwt workflow job automatically discovers and executes all Behat tests tagged with @opencast_jwt_test.