]> git.mjollnir.org Git - moodle.git/commitdiff
Added one more test to check the EXPERIMENTAL rename_key() function
authorstronk7 <stronk7>
Sat, 30 Sep 2006 19:45:51 +0000 (19:45 +0000)
committerstronk7 <stronk7>
Sat, 30 Sep 2006 19:45:51 +0000 (19:45 +0000)
admin/xmldb/actions/test/test.class.php

index ee16bf6ed0a2323e41e922c2ca5e37abedf6448a..c89b5ba01b7c58bf7c2c436bc9ec06130153b5ee 100644 (file)
@@ -668,15 +668,27 @@ class test extends XMLDBAction {
             $index->setAttributes(XMLDB_INDEX_UNIQUE, array('name', 'course'));
 
             $test->sql = $table->getRenameIndexSQL($CFG->dbtype, $CFG->prefix, $index, true);
-            $db->debug = true;
             $test->status = rename_index($table, $index, 'newnamefortheindex', false, false);
-            $db->debug = false;
             if (!$test->status) {
                 $test->error = $db->ErrorMsg();
             }
-            $tests['rename index'] = $test;
+            $tests['rename index (experimental. DO NOT USE IT)'] = $test;
         }
 
+    /// 38th test. Renaming one key
+        if ($test->status) {
+        /// Get SQL code and execute it
+            $test = new stdClass;
+            $key = new XMLDBKey('newnameforthekey');
+            $key->setAttributes(XMLDB_KEY_UNIQUE, array('id', 'course', 'grade'));
+
+            $test->sql = $table->getRenameKeySQL($CFG->dbtype, $CFG->prefix, $key, true);
+            $test->status = rename_key($table, $key, 'newnameforthekey', false, false);
+            if (!$test->status) {
+                $test->error = $db->ErrorMsg();
+            }
+            $tests['rename key (experimental. DO NOT USE IT)'] = $test;
+        }