Skip to content

Commit

Permalink
Merge branch 'mdl58161-moodle32' of https://github.com/tlock/moodle i…
Browse files Browse the repository at this point in the history
…nto MOODLE_32_STABLE
  • Loading branch information
stronk7 committed Jun 12, 2017
2 parents 5e39900 + 7e31bb6 commit ab8b6fa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion user/tests/userlib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ public function test_user_can_view_profile() {
// Visitor (Not a guest user, userid=0).
$CFG->forceloginforprofiles = 1;
$this->setUser($user8);
$this->assertFalse(user_can_view_profile($user1));

$allroles = $DB->get_records_menu('role', array(), 'id', 'archetype, id');
// Let us test with guest user.
Expand All @@ -591,7 +592,8 @@ public function test_user_can_view_profile() {
}

// Even with cap, still guests should not be allowed in.
assign_capability('moodle/user:viewdetails', CAP_ALLOW, $allroles['guest'], context_system::instance()->id, true);
$guestrole = $DB->get_records_menu('role', array('shortname' => 'guest'), 'id', 'archetype, id');
assign_capability('moodle/user:viewdetails', CAP_ALLOW, $guestrole['guest'], context_system::instance()->id, true);
reload_all_capabilities();
foreach ($users as $user) {
$this->assertFalse(user_can_view_profile($user));
Expand Down

0 comments on commit ab8b6fa

Please sign in to comment.