Merge branch 'MDL-65335_master' of https://github.com/marxjohnson/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2019-10-01 23:21:51 +02:00
commit 7dbc1041b3
2 changed files with 20 additions and 2 deletions

View File

@ -402,7 +402,6 @@ class api {
* @return bool
*/
public static function is_enabled() {
$plugininfo = \core_plugin_manager::instance()->get_plugin_info('auth_oauth2');
return $plugininfo->is_enabled();
return is_enabled_auth('oauth2');
}
}

View File

@ -140,4 +140,23 @@ class auth_oauth2_external_testcase extends advanced_testcase {
$this->assertEquals($newuser->id, $match->get('userid'));
}
/**
* Test that is_enabled correctly identifies when the plugin is enabled.
*/
public function test_is_enabled() {
$this->resetAfterTest();
set_config('auth', 'manual,oauth2');
$this->assertTrue(\auth_oauth2\api::is_enabled());
}
/**
* Test that is_enabled correctly identifies when the plugin is disabled.
*/
public function test_is_enabled_disabled() {
$this->resetAfterTest();
set_config('auth', 'manual');
$this->assertFalse(\auth_oauth2\api::is_enabled());
}
}