Add tests to support logoutpage_hook function
This commit is contained in:
parent
97cd90dcfe
commit
01949baf71
1 changed files with 27 additions and 0 deletions
|
@ -105,6 +105,33 @@ class auth_plugin_userkey_testcase extends advanced_testcase {
|
|||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that logout page hook sets global redirect variable correctly.
|
||||
*/
|
||||
public function test_logoutpage_hook_sets_global_redirect_correctly() {
|
||||
global $redirect, $SESSION;
|
||||
|
||||
$this->auth->logoutpage_hook();
|
||||
$this->assertEquals('', $redirect);
|
||||
|
||||
$SESSION->userkey = true;
|
||||
$this->auth = new auth_plugin_userkey();
|
||||
$this->auth->logoutpage_hook();
|
||||
$this->assertEquals('', $redirect);
|
||||
|
||||
unset($SESSION->userkey);
|
||||
set_config('redirecturl', 'http://example.com', 'auth_userkey');
|
||||
$this->auth = new auth_plugin_userkey();
|
||||
$this->auth->logoutpage_hook();
|
||||
$this->assertEquals('', $redirect);
|
||||
|
||||
$SESSION->userkey = true;
|
||||
set_config('redirecturl', 'http://example.com', 'auth_userkey');
|
||||
$this->auth = new auth_plugin_userkey();
|
||||
$this->auth->logoutpage_hook();
|
||||
$this->assertEquals('http://example.com', $redirect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that configured mapping field gets returned correctly.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue