Skip to content

Commit

Permalink
MDL-69542 core_lib: make lti tool generator default to legacy version
Browse files Browse the repository at this point in the history
This means existing tests won't need to change.
  • Loading branch information
snake committed Feb 11, 2022
1 parent 4d8a078 commit c9636d2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/testing/generator/data_generator.php
Expand Up @@ -1097,10 +1097,15 @@ public function create_lti_tool($data = array()) {
$data->status = ENROL_INSTANCE_ENABLED;
}

// Default to legacy lti version.
if (empty($data->ltiversion) || !in_array($data->ltiversion, ['LTI-1p0/LTI-2p0', 'LTI-1p3'])) {
$data->ltiversion = 'LTI-1p0/LTI-2p0';
}

// Add some extra necessary fields to the data.
$data->name = 'Test LTI';
$data->roleinstructor = $studentrole->id;
$data->rolelearner = $teacherrole->id;
$data->name = $data->name ?? 'Test LTI';
$data->roleinstructor = $teacherrole->id;
$data->rolelearner = $studentrole->id;

// Get the enrol LTI plugin.
$enrolplugin = enrol_get_plugin('lti');
Expand Down

0 comments on commit c9636d2

Please sign in to comment.