Permalink
Browse files

MDL-35155 dml: add unit test which exposes substr problem

Previously, when using parameters, substring broke on mssql.
  • Loading branch information...
danpoltawski committed Dec 31, 2014
1 parent 48ddb79 commit fa01f2b45aa28bdeba4e52c4f8f4da8fa69935b7
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/dml/tests/dml_test.php
@@ -4026,6 +4026,10 @@ public function test_sql_substring() {
} catch (moodle_exception $e) {
$this->assertInstanceOf('coding_exception', $e);
}
$sql = "SELECT id, ".$DB->sql_substr("name", ":param1 + 1")." AS name FROM {{$tablename}}";
$record = $DB->get_record_sql($sql, array('param1' => 4));
$this->assertEquals(substr($string, 5-1), $record->name);
}
public function test_sql_length() {

0 comments on commit fa01f2b

Please sign in to comment.