Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge branch 'MDL-63729-master' of git://github.com/dpalou/moodle
- Loading branch information
Showing
with
6 additions
and
1 deletion.
-
+6
−1
badges/tests/external_test.php
|
@@ -155,6 +155,7 @@ public function test_get_my_user_badges() { |
|
|
|
|
|
$badges = (array) badges_get_user_badges($this->student->id); |
|
|
$expectedbadges = array(); |
|
|
$coursebadge = null; |
|
|
|
|
|
foreach ($badges as $badge) { |
|
|
$context = ($badge->type == BADGE_TYPE_SITE) ? context_system::instance() : context_course::instance($badge->courseid); |
|
@@ -196,6 +197,10 @@ public function test_get_my_user_badges() { |
|
|
} |
|
|
|
|
|
$expectedbadges[] = (array) $badge; |
|
|
if (isset($badge->courseid)) { |
|
|
// Save the course badge to be able to compare it in our tests. |
|
|
$coursebadge = (array) $badge; |
|
|
} |
|
|
} |
|
|
|
|
|
$result = core_badges_external::get_user_badges(); |
|
@@ -206,7 +211,7 @@ public function test_get_my_user_badges() { |
|
|
$result = core_badges_external::get_user_badges(0, $this->course->id, 0, 1, '', true); |
|
|
$result = external_api::clean_returnvalue(core_badges_external::get_user_badges_returns(), $result); |
|
|
$this->assertCount(1, $result['badges']); |
|
|
$this->assertEquals($expectedbadges[1], $result['badges'][0]); |
|
|
$this->assertEquals($coursebadge, $result['badges'][0]); |
|
|
} |
|
|
|
|
|
/** |
|
|