MDL-34346 fixed missing string and correct instantiating of repositories in tests
authorMarina Glancy <marina@moodle.com>
Tue, 9 Apr 2013 04:40:15 +0000 (14:40 +1000)
committerMarina Glancy <marina@moodle.com>
Tue, 9 Apr 2013 04:40:15 +0000 (14:40 +1000)
lang/en/cache.php
repository/tests/repository_test.php

index d081b61..689e6ae 100644 (file)
@@ -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';
index 72df62c..89afd41 100644 (file)
@@ -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());
 
     }