mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-34346 fixed missing string and correct instantiating of repositories in tests
This commit is contained in:
parent
118ca9e96d
commit
0f232ed6e8
@ -53,6 +53,7 @@ $string['cachedef_plugininfo_repository'] = 'Plugin info - repositories';
|
||||
$string['cachedef_pluginlist'] = 'Plugin list';
|
||||
$string['cachedef_plugintypes'] = 'Plugin types';
|
||||
$string['cachedef_questiondata'] = 'Question definitions';
|
||||
$string['cachedef_repositories'] = 'Repositories instances data';
|
||||
$string['cachedef_string'] = 'Language string cache';
|
||||
$string['cachedef_yuimodules'] = 'YUI Module definitions';
|
||||
$string['cachelock_file_default'] = 'Default file locking';
|
||||
|
@ -173,7 +173,7 @@ class repositorylib_testcase extends advanced_testcase {
|
||||
|
||||
// Instance on a site level.
|
||||
$repoid = repository::static_function('flickr_public', 'create', 'flickr_public', 0, $syscontext, $params);
|
||||
$systemrepo = repository::get_instance($repoid);
|
||||
$systemrepo = repository::get_repository_by_id($repoid, $syscontext);
|
||||
|
||||
role_assign($roleid, $user->id, $syscontext->id);
|
||||
assign_capability('moodle/site:config', CAP_ALLOW, $roleid, $syscontext, true);
|
||||
@ -198,7 +198,7 @@ class repositorylib_testcase extends advanced_testcase {
|
||||
$this->getDataGenerator()->enrol_user($user->id, $course->id, $roleid);
|
||||
|
||||
$repoid = repository::static_function('flickr_public', 'create', 'flickr_public', 0, $coursecontext, $params);
|
||||
$courserepo = repository::get_instance($repoid);
|
||||
$courserepo = repository::get_repository_by_id($repoid, $coursecontext);
|
||||
|
||||
assign_capability('moodle/course:update', CAP_ALLOW, $roleid, $coursecontext, true);
|
||||
assign_capability('repository/flickr_public:view', CAP_ALLOW, $roleid, $coursecontext, true);
|
||||
@ -226,13 +226,13 @@ class repositorylib_testcase extends advanced_testcase {
|
||||
|
||||
// Editing someone else's instance.
|
||||
$repoid = repository::static_function('flickr_public', 'create', 'flickr_public', 0, $otherusercontext, $params);
|
||||
$userrepo = repository::get_instance($repoid);
|
||||
$userrepo = repository::get_repository_by_id($repoid, $syscontext);
|
||||
$this->assertFalse($userrepo->can_be_edited_by_user());
|
||||
|
||||
// Editing my own instance.
|
||||
$usercontext = context_user::instance($user->id);
|
||||
$repoid = repository::static_function('flickr_public', 'create', 'flickr_public', 0, $usercontext, $params);
|
||||
$userrepo = repository::get_instance($repoid);
|
||||
$userrepo = repository::get_repository_by_id($repoid, $syscontext);
|
||||
$this->assertTrue($userrepo->can_be_edited_by_user());
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user