MDL-29033 add tests for the sql injection hack

This commit is contained in:
Petr Skoda
2011-09-09 16:29:09 +02:00
parent bf0ddcb332
commit 040bd939b2
+17
View File
@@ -356,6 +356,23 @@ class dmllib_test extends prefix_changing_test_case {
}
function test_magic_hack() {
// test hacky sql injection protection - the resulting DB data is not really important,
// we only want to prevent SQL injections/DB errors
$obj = new stdClass();
$obj->textfield = 'lala\'';
$obj->id = insert_record($this->table, $obj);
$this->assertFalse(empty($obj->id));
$obj->textfield = 'lala\\';
$res = update_record($this->table, $obj);
$this->assertTrue($res);
$obj = get_record($this->table, 'textfield', 'lala\\');
$this->assertFalse(empty($obj));
}
}
?>