mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-30147 do not expect text comparison exceptions when not in debug mode
Unfortunately the column type fetching is too expensive, we do extra verification in debug mode only.
This commit is contained in:
parent
a453ec079f
commit
fed02be153
1 changed files with 32 additions and 8 deletions
|
@ -1003,7 +1003,10 @@ class dml_test extends UnitTestCase {
|
|||
$conditions = array('onetext' => '1');
|
||||
try {
|
||||
$rs = $DB->get_recordset($tablename, $conditions);
|
||||
if (debugging()) {
|
||||
// only in debug mode - hopefully all devs test code in debug mode...
|
||||
$this->fail('An Exception is missing, expected due to equating of text fields');
|
||||
}
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof dml_exception);
|
||||
$this->assertEqual($e->errorcode, 'textconditionsnotallowed');
|
||||
|
@ -1260,7 +1263,10 @@ class dml_test extends UnitTestCase {
|
|||
$conditions = array('onetext' => '1');
|
||||
try {
|
||||
$records = $DB->get_records($tablename, $conditions);
|
||||
if (debugging()) {
|
||||
// only in debug mode - hopefully all devs test code in debug mode...
|
||||
$this->fail('An Exception is missing, expected due to equating of text fields');
|
||||
}
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof dml_exception);
|
||||
$this->assertEqual($e->errorcode, 'textconditionsnotallowed');
|
||||
|
@ -1681,7 +1687,10 @@ class dml_test extends UnitTestCase {
|
|||
$conditions = array('onetext' => '1');
|
||||
try {
|
||||
$DB->get_field($tablename, 'course', $conditions);
|
||||
if (debugging()) {
|
||||
// only in debug mode - hopefully all devs test code in debug mode...
|
||||
$this->fail('An Exception is missing, expected due to equating of text fields');
|
||||
}
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof dml_exception);
|
||||
$this->assertEqual($e->errorcode, 'textconditionsnotallowed');
|
||||
|
@ -2534,7 +2543,10 @@ class dml_test extends UnitTestCase {
|
|||
$conditions = array('onetext' => '1');
|
||||
try {
|
||||
$DB->set_field($tablename, 'onechar', 'frog', $conditions);
|
||||
if (debugging()) {
|
||||
// only in debug mode - hopefully all devs test code in debug mode...
|
||||
$this->fail('An Exception is missing, expected due to equating of text fields');
|
||||
}
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof dml_exception);
|
||||
$this->assertEqual($e->errorcode, 'textconditionsnotallowed');
|
||||
|
@ -2744,7 +2756,10 @@ class dml_test extends UnitTestCase {
|
|||
$conditions = array('onetext' => '1');
|
||||
try {
|
||||
$DB->count_records($tablename, $conditions);
|
||||
if (debugging()) {
|
||||
// only in debug mode - hopefully all devs test code in debug mode...
|
||||
$this->fail('An Exception is missing, expected due to equating of text fields');
|
||||
}
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof dml_exception);
|
||||
$this->assertEqual($e->errorcode, 'textconditionsnotallowed');
|
||||
|
@ -2819,7 +2834,10 @@ class dml_test extends UnitTestCase {
|
|||
$conditions = array('onetext' => '1');
|
||||
try {
|
||||
$DB->record_exists($tablename, $conditions);
|
||||
if (debugging()) {
|
||||
// only in debug mode - hopefully all devs test code in debug mode...
|
||||
$this->fail('An Exception is missing, expected due to equating of text fields');
|
||||
}
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof dml_exception);
|
||||
$this->assertEqual($e->errorcode, 'textconditionsnotallowed');
|
||||
|
@ -2967,7 +2985,10 @@ class dml_test extends UnitTestCase {
|
|||
$conditions = array('onetext'=>'1');
|
||||
try {
|
||||
$DB->delete_records($tablename, $conditions);
|
||||
if (debugging()) {
|
||||
// only in debug mode - hopefully all devs test code in debug mode...
|
||||
$this->fail('An Exception is missing, expected due to equating of text fields');
|
||||
}
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof dml_exception);
|
||||
$this->assertEqual($e->errorcode, 'textconditionsnotallowed');
|
||||
|
@ -2977,7 +2998,10 @@ class dml_test extends UnitTestCase {
|
|||
$conditions = array('onetext' => 1);
|
||||
try {
|
||||
$DB->delete_records($tablename, $conditions);
|
||||
if (debugging()) {
|
||||
// only in debug mode - hopefully all devs test code in debug mode...
|
||||
$this->fail('An Exception is missing, expected due to equating of text fields');
|
||||
}
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof dml_exception);
|
||||
$this->assertEqual($e->errorcode, 'textconditionsnotallowed');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue