Specify grades' decimal places in unit test (#277)
This commit is contained in:
parent
1746ec47dc
commit
14e369b775
1 changed files with 9 additions and 13 deletions
|
@ -194,14 +194,12 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
|
||||||
* Test we return the correct grade information for an activity.
|
* Test we return the correct grade information for an activity.
|
||||||
*/
|
*/
|
||||||
public function test_get_mod_grade_info() {
|
public function test_get_mod_grade_info() {
|
||||||
global $CFG;
|
|
||||||
|
|
||||||
// Set that we want 3 decimals to display.
|
|
||||||
$CFG->grade_decimalpoints = 3;
|
|
||||||
|
|
||||||
// Create a course.
|
// Create a course.
|
||||||
$course = $this->getDataGenerator()->create_course();
|
$course = $this->getDataGenerator()->create_course();
|
||||||
|
|
||||||
|
// Set that we want 3 decimals to display.
|
||||||
|
grade_set_setting($course->id, 'decimalpoints', 3);
|
||||||
|
|
||||||
// Create two users.
|
// Create two users.
|
||||||
$student1 = $this->getDataGenerator()->create_user();
|
$student1 = $this->getDataGenerator()->create_user();
|
||||||
$student2 = $this->getDataGenerator()->create_user();
|
$student2 = $this->getDataGenerator()->create_user();
|
||||||
|
@ -268,12 +266,12 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
|
||||||
// Including to use constant.
|
// Including to use constant.
|
||||||
require_once($CFG->dirroot . '/mod/customcert/element/grade/classes/element.php');
|
require_once($CFG->dirroot . '/mod/customcert/element/grade/classes/element.php');
|
||||||
|
|
||||||
// Set that we want 3 decimals to display.
|
|
||||||
$CFG->grade_decimalpoints = 3;
|
|
||||||
|
|
||||||
// Create a course.
|
// Create a course.
|
||||||
$course = $this->getDataGenerator()->create_course();
|
$course = $this->getDataGenerator()->create_course();
|
||||||
|
|
||||||
|
// Set that we want 3 decimals to display.
|
||||||
|
grade_set_setting($course->id, 'decimalpoints', 3);
|
||||||
|
|
||||||
// Create two users.
|
// Create two users.
|
||||||
$student1 = $this->getDataGenerator()->create_user();
|
$student1 = $this->getDataGenerator()->create_user();
|
||||||
$student2 = $this->getDataGenerator()->create_user();
|
$student2 = $this->getDataGenerator()->create_user();
|
||||||
|
@ -326,14 +324,12 @@ class mod_customcert_element_helper_testcase extends advanced_testcase {
|
||||||
* Test we return the correct grade information for a grade item.
|
* Test we return the correct grade information for a grade item.
|
||||||
*/
|
*/
|
||||||
public function test_get_grade_item_info() {
|
public function test_get_grade_item_info() {
|
||||||
global $CFG;
|
|
||||||
|
|
||||||
// Set that we want 3 decimals to display.
|
|
||||||
$CFG->grade_decimalpoints = 3;
|
|
||||||
|
|
||||||
// Create a course.
|
// Create a course.
|
||||||
$course = $this->getDataGenerator()->create_course();
|
$course = $this->getDataGenerator()->create_course();
|
||||||
|
|
||||||
|
// Set that we want 3 decimals to display.
|
||||||
|
grade_set_setting($course->id, 'decimalpoints', 3);
|
||||||
|
|
||||||
// Create two users.
|
// Create two users.
|
||||||
$student1 = $this->getDataGenerator()->create_user();
|
$student1 = $this->getDataGenerator()->create_user();
|
||||||
$student2 = $this->getDataGenerator()->create_user();
|
$student2 = $this->getDataGenerator()->create_user();
|
||||||
|
|
Loading…
Reference in a new issue