public function testDeleteWithEmptyPassword() { RequestWrapper::inject(new Request(['passw' => ''])); $session = SessionFactory::getSession(); $failure_count = $session->get('delete_attempts'); $controller = new AccountController(); $response = $controller->deleteAccount(); $reflection = new \ReflectionProperty(get_class($response), 'data'); $reflection->setAccessible(true); $response_data = $reflection->getValue($response); $this->assertNotEmpty($response_data['error']); $this->assertGreaterThan($failure_count, $session->get('delete_attempts')); }
public function testAccountControllerIndexRuns() { $controller = new AccountController(); $response = $controller->index(); $this->assertNotEmpty($response); }
/** * group accountconf */ function testPauseAccountAndLoginShouldFail() { $accountController = new AccountController(); $confirm_worked = confirm_player($this->test_ninja_name, false, true); // name, no confirm #, just autoconfirm. $this->assertTrue((bool) $confirm_worked); $char_id = get_char_id($this->test_ninja_name); $paused = $accountController->pauseAccount($char_id); // Fully pause the account, make the operational bit = false $this->assertTrue((bool) $paused); $account_operational = query_item('SELECT operational FROM accounts JOIN account_players ON account_id = _account_id WHERE _player_id = :char_id', [':char_id' => $char_id]); $this->assertFalse($account_operational); $res = login_user($this->test_email, $this->test_password); $this->assertFalse($res['success'], 'Login should not be successful when account is paused'); $this->assertTrue(is_string($res['login_error'])); $this->assertTrue((bool) $res['login_error']); }