]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17491 dml tests4oracle empties/null/hack added.
authorstronk7 <stronk7>
Tue, 22 Sep 2009 16:26:14 +0000 (16:26 +0000)
committerstronk7 <stronk7>
Tue, 22 Sep 2009 16:26:14 +0000 (16:26 +0000)
lib/dml/simpletest/testdml.php

index b3f19066e3c9954850622c12a248c2077472c427..cb20d044f795efe47551d1c17430ecf715a874e7 100755 (executable)
@@ -1831,19 +1831,31 @@ class dml_test extends UnitTestCase {
 
         $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
         $table->add_field('name', XMLDB_TYPE_CHAR, '255', null, null, null, null);
+        $table->add_field('namenotnull', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, 'default value');
+        $table->add_field('namenotnullnodeflt', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
         $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
         $dbman->create_table($table);
         $this->tables[$tablename] = $table;
 
-        $DB->insert_record($tablename, array('name'=>''));
+        $DB->insert_record($tablename, array('name'=>'', 'namenotnull'=>''));
         $DB->insert_record($tablename, array('name'=>null));
-        $DB->insert_record($tablename, array('name'=>'lalalal'));
+        $DB->insert_record($tablename, array('name'=>'lalala'));
         $DB->insert_record($tablename, array('name'=>0));
 
         $records = $DB->get_records_sql("SELECT * FROM {".$tablename."} WHERE name = '".$DB->sql_empty()."'");
         $this->assertEqual(count($records), 1);
         $record = reset($records);
         $this->assertEqual($record->name, '');
+
+        $records = $DB->get_records_sql("SELECT * FROM {".$tablename."} WHERE namenotnull = '".$DB->sql_empty()."'");
+        $this->assertEqual(count($records), 1);
+        $record = reset($records);
+        $this->assertEqual($record->namenotnull, '');
+
+        $records = $DB->get_records_sql("SELECT * FROM {".$tablename."} WHERE namenotnullnodeflt = '".$DB->sql_empty()."'");
+        $this->assertEqual(count($records), 4);
+        $record = reset($records);
+        $this->assertEqual($record->namenotnullnodeflt, '');
     }
 
     function test_sql_isempty() {