Fix failing test_get_grades (#282)
This commit is contained in:
parent
5a7e1ee98d
commit
bb2ed945fa
1 changed files with 26 additions and 0 deletions
|
@ -37,6 +37,11 @@ global $CFG;
|
|||
*/
|
||||
class mod_customcert_element_helper_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Static variable used for clearing cache
|
||||
*/
|
||||
static $courseId;
|
||||
|
||||
/**
|
||||
* Test set up.
|
||||
*/
|
||||
|
@ -197,6 +202,9 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
|
|||
// Create a course.
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
|
||||
// Assign course->id for cache
|
||||
self::$courseId = $course->id;
|
||||
|
||||
// Set that we want 3 decimals to display.
|
||||
grade_set_setting($course->id, 'decimalpoints', 3);
|
||||
|
||||
|
@ -264,6 +272,9 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
|
|||
// Create a course.
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
|
||||
// Assign course->id for cache
|
||||
self::$courseId = $course->id;
|
||||
|
||||
// Set that we want 3 decimals to display.
|
||||
grade_set_setting($course->id, 'decimalpoints', 3);
|
||||
|
||||
|
@ -322,6 +333,9 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
|
|||
// Create a course.
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
|
||||
// Assign course->id for cache
|
||||
self::$courseId = $course->id;
|
||||
|
||||
// Set that we want 3 decimals to display.
|
||||
grade_set_setting($course->id, 'decimalpoints', 3);
|
||||
|
||||
|
@ -374,4 +388,16 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
|
|||
$this->assertEquals('-', $grade->get_displaygrade());
|
||||
$this->assertEquals(null, $grade->get_dategraded());
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup after all tests are executed.
|
||||
*
|
||||
*
|
||||
* @static
|
||||
* @return void
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
// Clear the cache
|
||||
grade_get_setting(self::$courseId, null, null, true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue