Core userkey mamager doesn't care about existing of the user
This commit is contained in:
parent
b46edb61a9
commit
b24d466649
2 changed files with 5 additions and 10 deletions
|
@ -80,12 +80,6 @@ class core_userkey_manager implements userkey_manager_interface {
|
||||||
* @throws \Exception If there is no user with provided userid.
|
* @throws \Exception If there is no user with provided userid.
|
||||||
*/
|
*/
|
||||||
public function __construct($userid, \stdClass $config) {
|
public function __construct($userid, \stdClass $config) {
|
||||||
global $DB;
|
|
||||||
|
|
||||||
if (!$DB->record_exists('user', array('id' => $userid))) {
|
|
||||||
throw new \Exception('Invalid user id');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->userid = $userid;
|
$this->userid = $userid;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
|
||||||
|
|
|
@ -65,13 +65,14 @@ class core_userkey_manager_testcase extends advanced_testcase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that exception gets thrown if user is not exist.
|
* Test that we can use user ID of not existing user.
|
||||||
*
|
|
||||||
* @expectedException \Exception
|
|
||||||
*/
|
*/
|
||||||
public function test_throws_exception_if_user_is_not_exists() {
|
public function test_that_manager_does_not_care_if_user_is_not_exists() {
|
||||||
$brokenuserid = 500;
|
$brokenuserid = 500;
|
||||||
$manager = new core_userkey_manager($brokenuserid, $this->config);
|
$manager = new core_userkey_manager($brokenuserid, $this->config);
|
||||||
|
|
||||||
|
$expected = 'auth_userkey\userkey_manager_interface';
|
||||||
|
$this->assertInstanceOf($expected, $manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue