# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/lib/grade/simpletest/testgradecategory.php
--- moodle/lib/grade/simpletest/testgradecategory.php Base (1.21)
+++ moodle/lib/grade/simpletest/testgradecategory.php Locally Modified (Based On 1.21)
@@ -39,7 +39,56 @@
 
 class grade_category_test extends grade_test {
 
-    function test_grade_category_construct() {
+    public function __construct() {
+        $this->starttime = time();
+        var_dump($this->starttime);
+        parent::__construct();
+    }
+
+    public function __destruct() {
+        $this->endtime = time();
+        var_dump($this->endtime);
+        var_dump($this->endtime-$this->starttime);
+        
+        parent::__destruct();
+    }
+
+    function test_grade_category() {
+        $this->sub_test_grade_category_construct();
+        $this->sub_test_grade_category_build_path();
+        $this->sub_test_grade_category_fetch();
+        $this->sub_test_grade_category_fetch_all();
+        $this->sub_test_grade_category_update();
+        $this->sub_test_grade_category_delete();
+        $this->sub_test_grade_category_insert();
+        $this->sub_test_grade_category_insert_course_category();
+        $this->sub_test_grade_category_qualifies_for_regrading();
+        $this->sub_test_grade_category_force_regrading();
+        $this->sub_test_grade_category_aggregate_grades();
+        $this->sub_test_grade_category_apply_limit_rules();
+        $this->sub_test_grade_category_is_aggregationcoef_used();
+        $this->sub_test_grade_category_fetch_course_tree();
+        $this->sub_test_grade_category_get_children();
+        $this->sub_test_grade_category_load_grade_item();
+        $this->sub_test_grade_category_get_grade_item();
+        $this->sub_test_grade_category_load_parent_category();
+        $this->sub_test_grade_category_get_parent_category();
+        $this->sub_test_grade_category_get_name();
+        $this->sub_test_grade_category_set_parent();
+        $this->sub_test_grade_category_get_final();
+        $this->sub_test_grade_category_get_sortorder();
+        $this->sub_test_grade_category_set_sortorder();
+        $this->sub_test_grade_category_is_editable();
+        $this->sub_test_grade_category_move_after_sortorder();
+        $this->sub_test_grade_category_is_course_category();
+        $this->sub_test_grade_category_fetch_course_category();
+        $this->sub_test_grade_category_is_locked();
+        $this->sub_test_grade_category_set_locked();
+        $this->sub_test_grade_category_is_hidden();
+        $this->sub_test_grade_category_set_hidden();
+    }
+
+    function sub_test_grade_category_construct() {
         $course_category = grade_category::fetch_course_category($this->courseid);
 
         $params = new stdClass();
@@ -75,14 +124,14 @@
         $this->assertEqual($parentpath.$grade_category->id."/", $grade_category->path);
     }
 
-    function test_grade_category_build_path() {
+    function sub_test_grade_category_build_path() {
         $grade_category = new grade_category($this->grade_categories[1]);
         $this->assertTrue(method_exists($grade_category, 'build_path'));
         $path = grade_category::build_path($grade_category);
         $this->assertEqual($grade_category->path, $path);
     }
 
-    function test_grade_category_fetch() {
+    function sub_test_grade_category_fetch() {
         $grade_category = new grade_category();
         $this->assertTrue(method_exists($grade_category, 'fetch'));
 
@@ -91,7 +140,7 @@
         $this->assertEqual($this->grade_categories[0]->fullname, $grade_category->fullname);
     }
 
-    function test_grade_category_fetch_all() {
+    function sub_test_grade_category_fetch_all() {
         $grade_category = new grade_category();
         $this->assertTrue(method_exists($grade_category, 'fetch_all'));
 
@@ -99,7 +148,7 @@
         $this->assertEqual(count($this->grade_categories), count($grade_categories)-1);
     }
 
-    function test_grade_category_update() {
+    function sub_test_grade_category_update() {
         global $DB;
         $grade_category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($grade_category, 'update'));
@@ -127,7 +176,7 @@
         $this->assertEqual(1, $grade_item->needsupdate);
     }
 
-    function test_grade_category_delete() {
+    function sub_test_grade_category_delete() {
         global $DB;
         $grade_category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($grade_category, 'delete'));
@@ -136,7 +185,7 @@
         $this->assertFalse($DB->get_record('grade_categories', array('id' => $grade_category->id)));
     }
 
-    function test_grade_category_insert() {
+    function sub_test_grade_category_insert() {
         $course_category = grade_category::fetch_course_category($this->courseid);
 
         $grade_category = new grade_category();
@@ -167,7 +216,7 @@
         $this->assertFalse(empty($grade_category->timemodified));
     }
 
-    function test_grade_category_insert_course_category() {
+    function sub_test_grade_category_insert_course_category() {
         $grade_category = new grade_category();
         $this->assertTrue(method_exists($grade_category, 'insert_course_category'));
 
@@ -180,7 +229,7 @@
         $this->assertNull($grade_category->parent);
     }
 
-    function test_grade_category_qualifies_for_regrading() {
+    function sub_test_grade_category_qualifies_for_regrading() {
         $grade_category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($grade_category, 'qualifies_for_regrading'));
 
@@ -198,7 +247,7 @@
         $this->assertTrue($grade_category->qualifies_for_regrading());
     }
 
-    function test_grade_category_force_regrading() {
+    function sub_test_grade_category_force_regrading() {
         $grade_category = new grade_category($this->grade_categories[1]);
         $this->assertTrue(method_exists($grade_category, 'force_regrading'));
 
@@ -241,13 +290,13 @@
 
     */
 
-    function test_grade_category_aggregate_grades() {
+    function sub_test_grade_category_aggregate_grades() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'aggregate_grades'));
         // tested above in test_grade_category_generate_grades()
     }
 
-    function test_grade_category_apply_limit_rules() {
+    function sub_test_grade_category_apply_limit_rules() {
         $items[$this->grade_items[0]->id] = new grade_item($this->grade_items[0], false);
         $items[$this->grade_items[1]->id] = new grade_item($this->grade_items[1], false);
         $items[$this->grade_items[2]->id] = new grade_item($this->grade_items[2], false);
@@ -308,17 +357,17 @@
     /**
      * TODO implement
      */
-    function test_grade_category_is_aggregationcoef_used() {
+    function sub_test_grade_category_is_aggregationcoef_used() {
 
     }
 
-    function test_grade_category_fetch_course_tree() {
+    function sub_test_grade_category_fetch_course_tree() {
         $category = new grade_category();
         $this->assertTrue(method_exists($category, 'fetch_course_tree'));
         //TODO: add some tests
     }
 
-    function test_grade_category_get_children() {
+    function sub_test_grade_category_get_children() {
         $course_category = grade_category::fetch_course_category($this->courseid);
 
         $category = new grade_category($this->grade_categories[0]);
@@ -337,7 +386,7 @@
         $this->assertEqual($this->grade_items[2]->id, $children_array[5]['children'][6]['object']->id);
     }
 
-    function test_grade_category_load_grade_item() {
+    function sub_test_grade_category_load_grade_item() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'load_grade_item'));
         $this->assertEqual(null, $category->grade_item);
@@ -345,14 +394,14 @@
         $this->assertEqual($this->grade_items[3]->id, $category->grade_item->id);
     }
 
-    function test_grade_category_get_grade_item() {
+    function sub_test_grade_category_get_grade_item() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'get_grade_item'));
         $grade_item = $category->get_grade_item();
         $this->assertEqual($this->grade_items[3]->id, $grade_item->id);
     }
 
-    function test_grade_category_load_parent_category() {
+    function sub_test_grade_category_load_parent_category() {
         $category = new grade_category($this->grade_categories[1]);
         $this->assertTrue(method_exists($category, 'load_parent_category'));
         $this->assertEqual(null, $category->parent_category);
@@ -360,20 +409,20 @@
         $this->assertEqual($this->grade_categories[0]->id, $category->parent_category->id);
     }
 
-    function test_grade_category_get_parent_category() {
+    function sub_test_grade_category_get_parent_category() {
         $category = new grade_category($this->grade_categories[1]);
         $this->assertTrue(method_exists($category, 'get_parent_category'));
         $parent_category = $category->get_parent_category();
         $this->assertEqual($this->grade_categories[0]->id, $parent_category->id);
     }
 
-    function test_grade_category_get_name() {
+    function sub_test_grade_category_get_name() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'get_name'));
         $this->assertEqual($this->grade_categories[0]->fullname, $category->get_name());
     }
 
-    function test_grade_category_set_parent() {
+    function sub_test_grade_category_set_parent() {
         $category = new grade_category($this->grade_categories[1]);
         $this->assertTrue(method_exists($category, 'set_parent'));
         // TODO: implement detailed tests
@@ -383,41 +432,41 @@
         $this->assertEqual($course_category->id, $category->parent);
     }
 
-    function test_grade_category_get_final() {
+    function sub_test_grade_category_get_final() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'get_final'));
         $category->load_grade_item();
         $this->assertEqual($category->get_final(), $category->grade_item->get_final());
     }
 
-    function test_grade_category_get_sortorder() {
+    function sub_test_grade_category_get_sortorder() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'get_sortorder'));
         $category->load_grade_item();
         $this->assertEqual($category->get_sortorder(), $category->grade_item->get_sortorder());
     }
 
-    function test_grade_category_set_sortorder() {
+    function sub_test_grade_category_set_sortorder() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'set_sortorder'));
         $category->load_grade_item();
         $this->assertEqual($category->set_sortorder(10), $category->grade_item->set_sortorder(10));
     }
 
-    function test_grade_category_move_after_sortorder() {
+    function sub_test_grade_category_move_after_sortorder() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'move_after_sortorder'));
         $category->load_grade_item();
         $this->assertEqual($category->move_after_sortorder(10), $category->grade_item->move_after_sortorder(10));
     }
 
-    function test_grade_category_is_course_category() {
+    function sub_test_grade_category_is_course_category() {
         $category = grade_category::fetch_course_category($this->courseid);
         $this->assertTrue(method_exists($category, 'is_course_category'));
         $this->assertTrue($category->is_course_category());
     }
 
-    function test_grade_category_fetch_course_category() {
+    function sub_test_grade_category_fetch_course_category() {
         $category = new grade_category();
         $this->assertTrue(method_exists($category, 'fetch_course_category'));
         $category = grade_category::fetch_course_category($this->courseid);
@@ -426,31 +475,31 @@
     /**
      * TODO implement
      */
-    function test_grade_category_is_editable() {
+    function sub_test_grade_category_is_editable() {
 
     }
 
-    function test_grade_category_is_locked() {
+    function sub_test_grade_category_is_locked() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'is_locked'));
         $category->load_grade_item();
         $this->assertEqual($category->is_locked(), $category->grade_item->is_locked());
     }
 
-    function test_grade_category_set_locked() {
+    function sub_test_grade_category_set_locked() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'set_locked'));
         $this->assertTrue($category->set_locked(1));
     }
 
-    function test_grade_category_is_hidden() {
+    function sub_test_grade_category_is_hidden() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'is_hidden'));
         $category->load_grade_item();
         $this->assertEqual($category->is_hidden(), $category->grade_item->is_hidden());
     }
 
-    function test_grade_category_set_hidden() {
+    function sub_test_grade_category_set_hidden() {
         $category = new grade_category($this->grade_categories[0]);
         $this->assertTrue(method_exists($category, 'set_hidden'));
         $category->set_hidden(1);
