Skip to content
Permalink
Browse files

MDL-34550 libraries: Final deprecation - get_context_instance_by_id()

  • Loading branch information...
ankitagarwal committed Dec 10, 2014
1 parent 2d84748 commit f9b7be4f9546743daa51ded3b3bac7df2d07057b
Showing with 1 addition and 10 deletions.
  1. +1 −7 lib/deprecatedlib.php
  2. +0 −3 lib/tests/accesslib_test.php
@@ -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 @@ public function test_permission_evaluation() {
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 @@ public function test_permission_evaluation() {
// 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);

0 comments on commit f9b7be4

Please sign in to comment.
You can’t perform that action at this time.