Issue #47 - CLI will fail if outage plugin is not enabled.

This commit is contained in:
Daniel Thee Roperto
2016-09-26 10:51:32 +10:00
parent f8e671a80d
commit 909b4bbcd3
8 changed files with 43 additions and 17 deletions

View File

@@ -79,4 +79,17 @@ class cli_test extends cli_testcase {
public function test_exception() {
throw new cli_exception('An CLI exception.');
}
/**
* @expectedException auth_outage\local\cli\cli_exception
* @expectedExceptionCode 8
*/
public function test_authdisabled() {
// Disable all auth plugins.
set_config('auth', '');
\core\session\manager::gc(); // Remove stale sessions.
core_plugin_manager::reset_caches();
// Try to create an CLI
$cli = new create();
}
}

View File

@@ -28,6 +28,11 @@ defined('MOODLE_INTERNAL') || die();
*/
class cli_testcase extends advanced_testcase {
public function setUp() {
// Enable auth plugins.
set_config('auth', 'outage');
\core\session\manager::gc(); // Remove stale sessions.
core_plugin_manager::reset_caches();
$this->resetAfterTest(true);
$this->set_parameters([]);
parent::setUp();