From 12bda5832f9bf28de1ac824fcf057c92676112c4 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 12 Sep 2006 22:21:51 +0000 Subject: [PATCH] Two more tests added: add_field() and drop_field() --- admin/xmldb/actions/test/test.class.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/admin/xmldb/actions/test/test.class.php b/admin/xmldb/actions/test/test.class.php index 00b9b64065..890d95db5f 100644 --- a/admin/xmldb/actions/test/test.class.php +++ b/admin/xmldb/actions/test/test.class.php @@ -144,7 +144,31 @@ class test extends XMLDBAction { $tests['create table - 2'] = $test; } + /// 4th test. Adding one complex enum field + if ($test->status) { + /// Create a new field with complex specs (enums are good candidates) + $field = new XMLDBField('type'); + $field->setAttributes(XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, XMLDB_ENUM, array('single', 'news', 'general', 'social', 'eachuser', 'teacher', 'qanda'), 'general', 'course'); + $test = new stdClass; + $test->sql = $table->getAddFieldSQL($CFG->dbtype, $CFG->prefix, $field, true); + $test->status = add_field($table, $field, false, false); + if (!$test->status) { + $test->error = $db->ErrorMsg(); + } + $tests['add field'] = $test; + } + /// 5th test. Dropping one complex enum field + if ($test->status) { + /// Create a new field with complex specs (enums are good candidates) + $test = new stdClass; + $test->sql = $table->getDropFieldSQL($CFG->dbtype, $CFG->prefix, $field, true); + $test->status = drop_field($table, $field, false, false); + if (!$test->status) { + $test->error = $db->ErrorMsg(); + } + $tests['drop field'] = $test; + } /// Iterate over tests, showing information as needed $o .= '
    '; -- 2.39.5