$steps[] = new Given('I click on "' . $this->escape($linkxpath) . '" "xpath_element"');
// After adding id numbers we should wait until the page is reloaded.
- $steps[] = new Given('I wait until the page is ready');
+ if ($this->running_javascript()) {
+ $steps[] = new Given('I wait until the page is ready');
+ }
// Mapping names to idnumbers.
$datahash = $data->getRowsHash();
// Grrr, we can't equal in categoryitem and courseitem because there is a line jump...
$inputxpath ="//input[@class='idnumber'][" .
"parent::li[@class='item'][text()='" . $gradeitem . "']" .
- " | " .
- "parent::li[@class='categoryitem' | @class='courseitem']/parent::ul/parent::li[starts-with(text(),'" . $gradeitem . "')]" .
+ " or " .
+ "parent::li[@class='categoryitem' or @class='courseitem']/parent::ul/parent::li[starts-with(text(),'" . $gradeitem . "')]" .
"]";
$steps[] = new Given('I set the field with xpath "' . $inputxpath . '" to "' . $idnumber . '"');
}
$steps[] = new Given('I press "' . get_string('addidnumbers', 'grades') . '"');
// After adding id numbers we should wait until the page is reloaded.
- $steps[] = new Given('I wait until the page is ready');
+ if ($this->running_javascript()) {
+ $steps[] = new Given('I wait until the page is ready');
+ }
$steps[] = new Given('I set the field "' . get_string('calculation', 'grades') . '" to "' . $calculation . '"');
$steps[] = new Given('I press "' . $savechanges . '"');
$steps[] = new Given('I click on "' . $this->escape($linktext) . '" "link"');
return $steps;
}
+
+ /**
+ * Step allowing to test before-the-fix behaviour of the gradebook
+ *
+ * @Given /^gradebook calculations for the course "(?P<coursename_string>(?:[^"]|\\")*)" are frozen at version "(?P<version_string>(?:[^"]|\\")*)"$/
+ * @param string $coursename
+ * @param string $version
+ * @return Given
+ */
+ public function gradebook_calculations_for_the_course_are_frozen_at_version($coursename, $version) {
+ global $DB;
+ $courseid = $DB->get_field('course', 'id', array('shortname' => $coursename), MUST_EXIST);
+ set_config('gradebook_calculations_freeze_' . $courseid, $version);
+ }
}