mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-52530 unittest: more robust capability assignments for guest
for core_files_file_storage_testcase and core_repositorylib_testcase
This commit is contained in:
parent
ea3ebbf20e
commit
8ef4fbc64f
2 changed files with 4 additions and 4 deletions
|
@ -327,8 +327,8 @@ class core_files_file_storage_testcase extends advanced_testcase {
|
||||||
$repositorypluginname = 'user';
|
$repositorypluginname = 'user';
|
||||||
// Override repository permission.
|
// Override repository permission.
|
||||||
$capability = 'repository/' . $repositorypluginname . ':view';
|
$capability = 'repository/' . $repositorypluginname . ':view';
|
||||||
$allroles = $DB->get_records_menu('role', array(), 'id', 'archetype, id');
|
$guestroleid = $DB->get_field('role', 'id', array('shortname' => 'guest'));
|
||||||
assign_capability($capability, CAP_ALLOW, $allroles['guest'], $syscontext->id, true);
|
assign_capability($capability, CAP_ALLOW, $guestroleid, $syscontext->id, true);
|
||||||
|
|
||||||
$args = array();
|
$args = array();
|
||||||
$args['type'] = $repositorypluginname;
|
$args['type'] = $repositorypluginname;
|
||||||
|
|
|
@ -44,8 +44,8 @@ class core_repositorylib_testcase extends advanced_testcase {
|
||||||
$repositorypluginname = 'boxnet';
|
$repositorypluginname = 'boxnet';
|
||||||
// override repository permission
|
// override repository permission
|
||||||
$capability = 'repository/' . $repositorypluginname . ':view';
|
$capability = 'repository/' . $repositorypluginname . ':view';
|
||||||
$allroles = $DB->get_records_menu('role', array(), 'id', 'archetype, id');
|
$guestroleid = $DB->get_field('role', 'id', array('shortname' => 'guest'));
|
||||||
assign_capability($capability, CAP_ALLOW, $allroles['guest'], $syscontext->id, true);
|
assign_capability($capability, CAP_ALLOW, $guestroleid, $syscontext->id, true);
|
||||||
|
|
||||||
$plugintype = new repository_type($repositorypluginname);
|
$plugintype = new repository_type($repositorypluginname);
|
||||||
$pluginid = $plugintype->create(false);
|
$pluginid = $plugintype->create(false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue