mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-58138 completion: mform wants 0-based indexes for arrays
This commit is contained in:
parent
6f9f15d1ad
commit
6c48135896
@ -100,9 +100,11 @@ class core_completion_bulkedit_form extends core_completion_edit_base_form {
|
||||
|
||||
$mform = $this->_form;
|
||||
|
||||
$idx = 0;
|
||||
foreach ($this->cms as $cm) {
|
||||
$mform->addElement('hidden', 'cmid['.$cm->id.']', $cm->id);
|
||||
$mform->setType('cmid['.$cm->id.']', PARAM_INT);
|
||||
$mform->addElement('hidden', 'cmid['.$idx.']', $cm->id);
|
||||
$mform->setType('cmid['.$idx.']', PARAM_INT);
|
||||
$idx++;
|
||||
}
|
||||
|
||||
parent::definition();
|
||||
|
@ -254,11 +254,13 @@ class core_completion_bulk_update_testcase extends advanced_testcase {
|
||||
$cmrec = $DB->get_record('course_modules', ['id' => $cm->id]);
|
||||
$instancerec = $DB->get_record($cm->modname, ['id' => $cm->instance]);
|
||||
foreach ($cmdata as $key => $value) {
|
||||
$this->assertEquals($value, $cmrec->$key);
|
||||
$this->assertEquals($value, $cmrec->$key, 'Error asserting that value for the field ' . $key.' ' .
|
||||
$cmrec->$key . ' matches expected value ' . $value);
|
||||
}
|
||||
if ($instancedata) {
|
||||
foreach ($instancedata[$cnt] as $key => $value) {
|
||||
$this->assertEquals($value, $instancerec->$key);
|
||||
$this->assertEquals($value, $instancerec->$key, 'Error asserting that value for the field ' . $key . ' '.
|
||||
$instancerec->$key . ' matches expected value ' . $value);
|
||||
}
|
||||
}
|
||||
$cnt++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user