mirror of
https://github.com/moodle/moodle.git
synced 2025-03-20 07:30:01 +01:00
Merge branch 'MDL-34550-master' of git://github.com/ankitagarwal/moodle
This commit is contained in:
commit
3bd434cd49
@ -3250,16 +3250,10 @@ function get_context_instance($contextlevel, $instance = 0, $strictness = IGNORE
|
||||
* Get a context instance as an object, from a given context id.
|
||||
*
|
||||
* @deprecated since Moodle 2.2 MDL-35009 - please do not use this function any more.
|
||||
* @todo MDL-34550 This will be deleted in Moodle 2.8
|
||||
* @see context::instance_by_id($id)
|
||||
* @param int $id context id
|
||||
* @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found;
|
||||
* MUST_EXIST means throw exception if no record or multiple records found
|
||||
* @return context|bool the context object or false if not found.
|
||||
*/
|
||||
function get_context_instance_by_id($id, $strictness = IGNORE_MISSING) {
|
||||
debugging('get_context_instance_by_id() is deprecated, please use context::instance_by_id($id) instead.', DEBUG_DEVELOPER);
|
||||
return context::instance_by_id($id, $strictness);
|
||||
throw new coding_exception('get_context_instance_by_id() is now removed, please use context::instance_by_id($id) instead.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2579,7 +2579,6 @@ class core_accesslib_testcase extends advanced_testcase {
|
||||
|
||||
foreach ($DB->get_records('context') as $contextid => $record) {
|
||||
$context = context::instance_by_id($contextid);
|
||||
$this->assertEquals($context, get_context_instance_by_id($contextid, IGNORE_MISSING));
|
||||
$this->assertEquals($context, get_context_instance($record->contextlevel, $record->instanceid));
|
||||
$this->assertEquals($context->get_parent_context_ids(), get_parent_contexts($context));
|
||||
if ($context->id == SYSCONTEXTID) {
|
||||
@ -2599,8 +2598,6 @@ class core_accesslib_testcase extends advanced_testcase {
|
||||
// Make sure a debugging is thrown.
|
||||
get_context_instance($record->contextlevel, $record->instanceid);
|
||||
$this->assertDebuggingCalled('get_context_instance() is deprecated, please use context_xxxx::instance() instead.', DEBUG_DEVELOPER);
|
||||
get_context_instance_by_id($record->id);
|
||||
$this->assertDebuggingCalled('get_context_instance_by_id() is deprecated, please use context::instance_by_id($id) instead.', DEBUG_DEVELOPER);
|
||||
get_system_context();
|
||||
$this->assertDebuggingCalled('get_system_context() is deprecated, please use context_system::instance() instead.', DEBUG_DEVELOPER);
|
||||
get_parent_contexts($context);
|
||||
|
Loading…
x
Reference in New Issue
Block a user