]> git.mjollnir.org Git - moodle.git/commitdiff
fixed grade category unit tests
authorskodak <skodak>
Sun, 29 Jul 2007 13:58:57 +0000 (13:58 +0000)
committerskodak <skodak>
Sun, 29 Jul 2007 13:58:57 +0000 (13:58 +0000)
lib/grade/grade_category.php
lib/grade/simpletest/testgradecategory.php

index 6f4a51285155f59e11181a21e21864a11feee5a2..fe9e327667a36aeb28a423ad3025dd63589a7ee9 100644 (file)
@@ -611,14 +611,6 @@ class grade_category extends grade_object {
 
     }
 
-    /**
-     * Returns true if this category has any child grade_category or grade_item.
-     * @return int number of direct children, or false if none found.
-     */
-    function has_children() {
-        return count_records('grade_categories', 'parent', $this->id) + count_records('grade_items', 'categoryid', $this->id);
-    }
-
     /**
      * Returns tree with all grade_items and categories as elements
      * @static
index 77f4721df77af965049ae5937770d1b2a7b04906..f233013fbfa4fcd7c33d4ecd57697b8c887a8339 100755 (executable)
@@ -118,7 +118,7 @@ class grade_category_test extends grade_test {
         $grade_category->fullname = 'Updated info for this unittest grade_category';
         $grade_category->path = null; // path must be recalculated if missing
         $grade_category->depth = null;
-        $grade_category->aggregation = GRADE_AGGREGATE_MAX; // should force regrading
+        $grade_category->aggregation = GRADE_AGGREGATE_MAX_ALL; // should force regrading
 
         $grade_item = $grade_category->get_grade_item();
         $this->assertEqual(0, $grade_item->needsupdate);
@@ -144,7 +144,7 @@ class grade_category_test extends grade_test {
 
         $this->assertFalse($grade_category->qualifies_for_regrading());
 
-        $grade_category->aggregation = GRADE_AGGREGATE_MAX;
+        $grade_category->aggregation = GRADE_AGGREGATE_MAX_ALL;
         $this->assertTrue($grade_category->qualifies_for_regrading());
 
         $grade_category = new grade_category($this->grade_categories[0]);
@@ -307,14 +307,6 @@ class grade_category_test extends grade_test {
         $this->assertEqual(true, $category->grade_item->is_hidden());
     }
 
-    function test_grade_category_has_children() {
-        $category = new grade_category($this->grade_categories[0]);
-        $this->assertTrue(method_exists($category, 'has_children'));
-        $this->assertTrue($category->has_children());
-        $category = new grade_category();
-        $this->assertFalse($category->has_children());
-    }
-
     function test_grade_category_generate_grades() {
         $category = new grade_category($this->grade_categories[3]);
         $this->assertTrue(method_exists($category, 'generate_grades'));