}
}
+ // Cache the changed letters.
if (!empty($letters)) {
- // Ensure that the letters are correctly sorted.
+
+ // For some reason, the cache saves it in the order in which they were entered
+ // but we really want to order them in descending order so we sort it here.
krsort($letters);
$cache->set($context->id, $letters);
}
$letters = $cache->get($context->id);
$this->assertEquals(1, count($letters));
- $this->assertEquals($letter->letter, $letters['100.00000']);
+ $this->assertTrue(in_array($letter->letter, $letters));
remove_grade_letters($context, false);
/**
* Test the caching of grade letters.
*/
- public function test_get_grade_letters(): void {
+ public function test_get_grade_letters() {
+
$this->resetAfterTest();
// Setup some basics.
/**
* Test custom letters.
*/
- public function test_get_grade_letters_custom(): void {
+ public function test_get_grade_letters_custom() {
global $DB;
$this->resetAfterTest();