]> git.mjollnir.org Git - moodle.git/commitdiff
Minor changes in unit tests
authornicolasconnault <nicolasconnault>
Wed, 31 Oct 2007 14:55:23 +0000 (14:55 +0000)
committernicolasconnault <nicolasconnault>
Wed, 31 Oct 2007 14:55:23 +0000 (14:55 +0000)
lib/grade/grade_outcome.php
lib/grade/simpletest/testgradeitem.php
lib/grade/simpletest/testgradeoutcome.php
lib/simpletest/fixtures/gradetest.php

index 1eb2422d82a622c7a726daeb834761dc02846a18..3de0d1305b6c456be105bde4b42f4fb6302dcfce 100644 (file)
@@ -7,7 +7,7 @@
 // Moodle - Modular Object-Oriented Dynamic Learning Environment         //
 //          http://moodle.com                                            //
 //                                                                       //
-// Copyright (C) 1999 onwards Martin Dougiamas  http://dougiamas.com       //
+// Copyright (C) 1999 onwards Martin Dougiamas  http://dougiamas.com     //
 //                                                                       //
 // This program is free software; you can redistribute it and/or modify  //
 // it under the terms of the GNU General Public License as published by  //
index 520417888fbb6fad54738ef65bca693091d88b98..20da15ab4aa8994c70598b3116543c5d9408078f 100755 (executable)
@@ -361,7 +361,7 @@ class grade_item_test extends grade_test {
         $this->assertFalse(empty($grade_item->locked));
         $this->assertFalse(empty($grade->locked)); // individual grades should be locked too
 
-        $this->assertTrue($grade_item->set_locked(false));
+        $this->assertTrue($grade_item->set_locked(false, true));
         $grade = new grade_grade($grade_item->get_final(1));
 
         $this->assertTrue(empty($grade_item->locked));
@@ -390,7 +390,7 @@ class grade_item_test extends grade_test {
         $this->assertEqual(0, $grade_item->hidden);
         $this->assertEqual(0, $grade->hidden);
 
-        $grade_item->set_hidden(666);
+        $grade_item->set_hidden(666, true);
         $grade = new grade_grade($grade_item->get_final(1));
 
         $this->assertEqual(666, $grade_item->hidden);
index d21369f42b51139122718d105b95cd2d9ccdd70e..a8724503b5102b968fbfb38e47d1f1b37ba7ed04 100644 (file)
@@ -7,7 +7,7 @@
 // Moodle - Modular Object-Oriented Dynamic Learning Environment         //
 //          http://moodle.org                                            //
 //                                                                       //
-// Copyright (C) 1999 onwards Martin Dougiamas  http://dougiamas.com       //
+// Copyright (C) 1999 onwards Martin Dougiamas  http://dougiamas.com     //
 //                                                                       //
 // This program is free software; you can redistribute it and/or modify  //
 // it under the terms of the GNU General Public License as published by  //
@@ -91,7 +91,7 @@ class grade_outcome_test extends grade_test {
         $grade_outcome = grade_outcome::fetch(array('id'=>$this->grade_outcomes[0]->id));
         $this->assertEqual($this->grade_outcomes[0]->id, $grade_outcome->id);
         $this->assertEqual($this->grade_outcomes[0]->shortname, $grade_outcome->shortname);
-
+        $grade_outcome->load_scale();
         $this->assertEqual($this->scale[2]->id, $grade_outcome->scale->id);
     }
 
index 63b8d683bb013a34f01eb09b05c957ac91506210..ee2de170355814a31c38ad28617ff5dc88cae162 100644 (file)
@@ -114,7 +114,7 @@ class grade_test extends UnitTestCase {
         /// Define table course_modules to be created
         $table = new XMLDBTable('course_modules');
 
-        if (!table_exists($table)) {
+        if ($result && !table_exists($table)) {
             /// Adding fields to table course_modules
             $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
             $table->addFieldInfo('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
@@ -151,7 +151,7 @@ class grade_test extends UnitTestCase {
         /// Define table modules to be created
         $table = new XMLDBTable('modules');
 
-        if (!table_exists($table)) {
+        if ($result && !table_exists($table)) {
 
             /// Adding fields to table modules
             $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
@@ -177,7 +177,7 @@ class grade_test extends UnitTestCase {
         /// Define table grade_items to be created
         $table = new XMLDBTable('grade_items');
 
-        if (!table_exists($table)) {
+        if ($result && !table_exists($table)) {
             $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
             $table->addFieldInfo('courseid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null);
             $table->addFieldInfo('categoryid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null);