MDL-23997 modified char comparison tests to ensure they are executed without metadata at all

This commit is contained in:
Eloy Lafuente 2010-08-30 12:05:35 +00:00
parent c899cbeae9
commit 7a45a5f1ec

View File

@ -2848,13 +2848,20 @@ class dml_test extends UnitTestCase {
$this->assertTrue($DB->insert_record($tablename, array('name' => 'bb', 'content'=>2)));
$this->assertTrue($records = $DB->get_records($tablename, array('name' => 1)));
// Conditions in CHAR colums
$sqlqm = "SELECT *
FROM {{$tablename}}
WHERE name = ?";
$this->assertTrue($records = $DB->get_records_sql($sqlqm, array(1)));
$this->assertEqual(1, count($records));
$this->assertTrue($records = $DB->get_records($tablename, array('name' => '1')));
$this->assertTrue($records = $DB->get_records_sql($sqlqm, array('1')));
$this->assertEqual(1, count($records));
$this->assertTrue($records = $DB->get_records($tablename, array('name' => 2)));
$sqlnamed = "SELECT *
FROM {{$tablename}}
WHERE name = :name";
$this->assertTrue($records = $DB->get_records_sql($sqlnamed, array('name' => 2)));
$this->assertEqual(1, count($records));
$this->assertTrue($records = $DB->get_records($tablename, array('name' => '2')));
$this->assertTrue($records = $DB->get_records_sql($sqlnamed, array('name' => '2')));
$this->assertEqual(1, count($records));
// Conditions in TEXT columns always must be performed with the sql_compare_text