mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +02:00
MDL-10364 improved internal formula format
This commit is contained in:
parent
713b2a2f71
commit
9acbd7269c
3 changed files with 16 additions and 16 deletions
|
@ -475,7 +475,7 @@ class grade_item_test extends grade_test {
|
|||
$grade_item = new grade_item($this->grade_items[1]);
|
||||
$this->assertTrue(method_exists($grade_item, 'is_calculated'));
|
||||
$grade_itemsource = new grade_item($this->grade_items[0]);
|
||||
$normalizedformula = str_replace('['.$grade_itemsource->idnumber.']', '[#gi'.$grade_itemsource->id.'#]', $this->grade_items[1]->calculation);
|
||||
$normalizedformula = str_replace('[['.$grade_itemsource->idnumber.']]', '##gi'.$grade_itemsource->id.'##', $this->grade_items[1]->calculation);
|
||||
|
||||
$this->assertTrue($grade_item->is_calculated());
|
||||
$this->assertEqual($normalizedformula, $grade_item->calculation);
|
||||
|
@ -486,10 +486,10 @@ class grade_item_test extends grade_test {
|
|||
$this->assertTrue(method_exists($grade_item, 'set_calculation'));
|
||||
$grade_itemsource = new grade_item($this->grade_items[0]);
|
||||
|
||||
$grade_item->set_calculation('=['.$grade_itemsource->idnumber.']');
|
||||
$grade_item->set_calculation('=[['.$grade_itemsource->idnumber.']]');
|
||||
|
||||
$this->assertTrue(!empty($grade_item->needsupdate));
|
||||
$this->assertEqual('=[#gi'.$grade_itemsource->id.'#]', $grade_item->calculation);
|
||||
$this->assertEqual('=##gi'.$grade_itemsource->id.'##', $grade_item->calculation);
|
||||
}
|
||||
|
||||
function test_grade_item_get_calculation() {
|
||||
|
@ -497,7 +497,7 @@ class grade_item_test extends grade_test {
|
|||
$this->assertTrue(method_exists($grade_item, 'get_calculation'));
|
||||
$grade_itemsource = new grade_item($this->grade_items[0]);
|
||||
|
||||
$denormalizedformula = str_replace('[#gi'.$grade_itemsource->id.'#]', '['.$grade_itemsource->idnumber.']', $this->grade_items[1]->calculation);
|
||||
$denormalizedformula = str_replace('##gi'.$grade_itemsource->id.'##', '[['.$grade_itemsource->idnumber.']]', $this->grade_items[1]->calculation);
|
||||
|
||||
$formula = $grade_item->get_calculation();
|
||||
$this->assertTrue(!empty($grade_item->needsupdate));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue