From 142d7fb842a7e6e01245e1a0cdb99a59b41f3eec Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sat, 30 Sep 2006 19:45:51 +0000 Subject: [PATCH] Added one more test to check the EXPERIMENTAL rename_key() function --- admin/xmldb/actions/test/test.class.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/admin/xmldb/actions/test/test.class.php b/admin/xmldb/actions/test/test.class.php index ee16bf6ed0..c89b5ba01b 100644 --- a/admin/xmldb/actions/test/test.class.php +++ b/admin/xmldb/actions/test/test.class.php @@ -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; + } -- 2.39.5