Skip to content

Commit

Permalink
[UPD] Added a test as reviewer suggested
Browse files Browse the repository at this point in the history
  • Loading branch information
IJOL committed Aug 2, 2023
1 parent 778c57f commit bdc539d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/auth_plugin_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,25 @@ public function test_throwing_exception_if_user_is_not_exist() {
$this->expectExceptionMessage('Invalid parameter value detected (User is not exist)');
$actual = $this->auth->get_login_url($user);
}
/**
* Test that auth plugin throws correct exception if we trying to request not existing user.
*/
public function test_throwing_exception_if_user_is_suspended() {
global $USER, $SESSION;

$user = $this->getDataGenerator()->create_user();
$user->suspended = 1;
$this->setUser($user);
$this->assertEquals($USER->id, $user->id);

$this->create_user_private_key();
$_POST['key'] = 'TestKey';

$this->expectException(invalid_parameter_exception::class);
$this->expectExceptionMessage('Invalid parameter value detected (User is suspended)');

$this->auth->user_login_userkey();
}

/**
* Test that auth plugin throws correct exception if we trying to request user,
Expand Down

0 comments on commit bdc539d

Please sign in to comment.