public function testStorageOfAuthAttemptShouldNotError() { $request = RequestWrapper::$request; $attempt_info = ['username' => 'james', 'user_agent' => 'phpunit cli', 'ip' => $request->getClientIp(), 'successful' => 0, 'additional_info' => []]; LoginController::store_auth_attempt($attempt_info); $this->assertTrue(true); // Just check that no error occurs before this point }
public function testLoginWithGibberishFails() { $controller = new LoginController(); $error_message = $controller->perform_login_if_requested('gibber', 'ish'); $this->assertNotEmpty($error_message); }
function testPauseAccountAndLoginShouldFail() { $player = Player::findByName($this->test_ninja_name); $player->active = 1; $player->save(); $account = Account::findByChar($player); $account->confirmed = 1; $account->setOperational(true); $account->save(); $accountController = new AccountController(); $controller = new LoginController(); $res = $controller->performLogin($this->test_email, $this->test_password); $this->assertEmpty($res, 'Login should be successful when account is new'); // Fully pause the account, make the operational bit = false $player->active = 0; $player->save(); $account->setOperational(false); $account->save(); $res = $controller->performLogin($this->test_email, $this->test_password); $this->assertNotEmpty($res, 'Login should not be successful when account is paused'); }