mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Added one more test to check the EXPERIMENTAL rename_key() function
This commit is contained in:
parent
9c4ee55b6c
commit
142d7fb842
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user