Permalink
Browse files

Merge branch 'MDL-37854_m24' of https://github.com/markn86/moodle int…

…o MOODLE_24_STABLE
  • Loading branch information...
2 parents e57a314 + e0d4f2b commit b626992e09a90c83f7be08826dc3e7fa665f0456 @stronk7 stronk7 committed Feb 5, 2013
Showing with 19 additions and 19 deletions.
  1. +3 −3 lib/dml/tests/dml_test.php
  2. +16 −16 lib/tests/moodlelib_test.php
@@ -1814,7 +1814,7 @@ public function test_get_field() {
$this->assertSame(false, $DB->get_field($tablename, 'course', array('course' => 11), IGNORE_MISSING));
try {
$DB->get_field($tablename, 'course', array('course' => 4), MUST_EXIST);
- $this->assertFail('Exception expected due to missing record');
+ $this->fail('Exception expected due to missing record');
} catch (dml_exception $ex) {
$this->assertTrue(true);
}
@@ -1967,15 +1967,15 @@ public function test_insert_record_raw() {
// custom sequence - missing id error
try {
$DB->insert_record_raw($tablename, array('course' => 3, 'onechar' => 'bb'), true, false, true);
- $this->assertFail('Exception expected due to missing record');
+ $this->fail('Exception expected due to missing record');
} catch (coding_exception $ex) {
$this->assertTrue(true);
}
// wrong column error
try {
$DB->insert_record_raw($tablename, array('xxxxx' => 3, 'onechar' => 'bb'));
- $this->assertFail('Exception expected due to invalid column');
+ $this->fail('Exception expected due to invalid column');
} catch (dml_exception $ex) {
$this->assertTrue(true);
}
@@ -1369,46 +1369,46 @@ public function test_set_user_preference() {
$longvalue = str_repeat('a', 1334);
try {
set_user_preference('_test_long_user_preference', $longvalue);
- $this->assertFail('Exception expected - longer than 1333 chars not allowed as preference value');
- } catch (Exception $e) {
- $this->assertTrue($e instanceof coding_exception);
+ $this->fail('Exception expected - longer than 1333 chars not allowed as preference value');
+ } catch (coding_exception $ex) {
+ $this->assertTrue(true);
}
//test invalid params
try {
set_user_preference('_test_user_preferences_pref', array());
- $this->assertFail('Exception expected - array not valid preference value');
- } catch (Exception $ex) {
+ $this->fail('Exception expected - array not valid preference value');
+ } catch (coding_exception $ex) {
$this->assertTrue(true);
}
try {
set_user_preference('_test_user_preferences_pref', new stdClass);
- $this->assertFail('Exception expected - class not valid preference value');
- } catch (Exception $ex) {
+ $this->fail('Exception expected - class not valid preference value');
+ } catch (coding_exception $ex) {
$this->assertTrue(true);
}
try {
- set_user_preference('_test_user_preferences_pref', 1, array('xx'=>1));
- $this->assertFail('Exception expected - user instance expected');
- } catch (Exception $ex) {
+ set_user_preference('_test_user_preferences_pref', 1, array('xx' => 1));
+ $this->fail('Exception expected - user instance expected');
+ } catch (coding_exception $ex) {
$this->assertTrue(true);
}
try {
set_user_preference('_test_user_preferences_pref', 1, 'abc');
- $this->assertFail('Exception expected - user instance expected');
- } catch (Exception $ex) {
+ $this->fail('Exception expected - user instance expected');
+ } catch (coding_exception $ex) {
$this->assertTrue(true);
}
try {
set_user_preference('', 1);
- $this->assertFail('Exception expected - invalid name accepted');
- } catch (Exception $ex) {
+ $this->fail('Exception expected - invalid name accepted');
+ } catch (coding_exception $ex) {
$this->assertTrue(true);
}
try {
set_user_preference('1', 1);
- $this->assertFail('Exception expected - invalid name accepted');
- } catch (Exception $ex) {
+ $this->fail('Exception expected - invalid name accepted');
+ } catch (coding_exception $ex) {
$this->assertTrue(true);
}

0 comments on commit b626992

Please sign in to comment.