Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-39923 badges: Fix unit tests

  • Loading branch information...
commit be2b37cf4b434848ac481f068a4850aece794050 1 parent f5d17c1
@ybozhko ybozhko authored
Showing with 7 additions and 1 deletion.
  1. +5 −0 badges/tests/badgeslib_test.php
  2. +2 −1  lib/badgeslib.php
View
5 badges/tests/badgeslib_test.php
@@ -166,6 +166,7 @@ public function test_delete_badge_criteria() {
}
public function test_badge_awards() {
+ $this->preventResetByRollback(); // Messaging is not compatible with transactions.
$badge = new badge($this->badgeid);
$user1 = $this->getDataGenerator()->create_user();
@@ -225,6 +226,7 @@ public function test_badge_message_from_template($message, $params, $result) {
* Test badges observer when course module completion event id fired.
*/
public function test_badges_observer_course_module_criteria_review() {
+ $this->preventResetByRollback(); // Messaging is not compatible with transactions.
$badge = new badge($this->coursebadge);
$this->assertFalse($badge->is_issued($this->user->id));
@@ -257,6 +259,7 @@ public function test_badges_observer_course_module_criteria_review() {
* Test badges observer when course_completed event is fired.
*/
public function test_badges_observer_course_criteria_review() {
+ $this->preventResetByRollback(); // Messaging is not compatible with transactions.
$badge = new badge($this->coursebadge);
$this->assertFalse($badge->is_issued($this->user->id));
@@ -282,6 +285,7 @@ public function test_badges_observer_course_criteria_review() {
* Test badges observer when user_updated event is fired.
*/
public function test_badges_observer_profile_criteria_review() {
+ $this->preventResetByRollback(); // Messaging is not compatible with transactions.
$badge = new badge($this->coursebadge);
$this->assertFalse($badge->is_issued($this->user->id));
@@ -304,6 +308,7 @@ public function test_badges_observer_profile_criteria_review() {
* Test badges assertion generated when a badge is issued.
*/
public function test_badges_assertion() {
+ $this->preventResetByRollback(); // Messaging is not compatible with transactions.
$badge = new badge($this->coursebadge);
$this->assertFalse($badge->is_issued($this->user->id));
View
3  lib/badgeslib.php
@@ -978,7 +978,8 @@ function badges_bake($hash, $badgeid, $userid = 0, $pathhash = false) {
}
}
} else {
- debugging('Error baking badge image!');
+ debugging('Error baking badge image!', DEBUG_DEVELOPER);
+ return;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.