diff --git a/classes/core_userkey_manager.php b/classes/core_userkey_manager.php index 62b0714..0d0bd15 100644 --- a/classes/core_userkey_manager.php +++ b/classes/core_userkey_manager.php @@ -80,12 +80,6 @@ class core_userkey_manager implements userkey_manager_interface { * @throws \Exception If there is no user with provided userid. */ 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->config = $config; diff --git a/tests/core_userkey_manager_test.php b/tests/core_userkey_manager_test.php index 6cc2c18..00de1af 100644 --- a/tests/core_userkey_manager_test.php +++ b/tests/core_userkey_manager_test.php @@ -65,13 +65,14 @@ class core_userkey_manager_testcase extends advanced_testcase { } /** - * Test that exception gets thrown if user is not exist. - * - * @expectedException \Exception + * Test that we can use user ID of not existing user. */ - 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; $manager = new core_userkey_manager($brokenuserid, $this->config); + + $expected = 'auth_userkey\userkey_manager_interface'; + $this->assertInstanceOf($expected, $manager); } /**