| # | Test | Result | Detail |
|---|---|---|---|
| 1 | Setup: test user created | โ PASS | user_id=139 |
| 2 | AuthService instantiates | โ PASS | |
| 3 | login() correct password โ success | โ PASS | |
| 4 | login() returns user array | โ PASS | ["success","user","permissions","session_token"] |
| 5 | login() returns permissions array | โ PASS | |
| 6 | login() returns session_token | โ PASS | 24a02940โฆ |
| 7 | Session::isLoggedIn() after login | โ PASS | |
| 8 | Session::getUserId() matches | โ PASS | got: 139 |
| 9 | Session user_data has auth_method | โ PASS | local |
| 10 | DB session auth_method = local (not hardcoded ldap) | โ PASS | got: local |
| 11 | logout() returns success | โ PASS | |
| 12 | Session cleared after logout | โ PASS | |
| 13 | DB session deactivated after logout | โ PASS | is_active=0 |
| 14 | login() wrong password โ fails | โ PASS | |
| 15 | login() wrong password โ error msg | โ PASS | Invalid credentials |
| 16 | failed_login_attempts incremented | โ PASS | attempts=1 |
| 17 | Account locked after 5 failures | โ PASS | is_locked=1 |
| 18 | login() locked account returns error | โ PASS | |
| 19 | login() locked error message correct | โ PASS | Account is locked. Contact your administrator. |
| 20 | unlockAccount() clears is_locked | โ PASS | |
| 21 | unlockAccount() resets failed_attempts | โ PASS | |
| 22 | isAccountLocked() false after unlock | โ PASS | |
| 23 | Inactive user cannot login | โ PASS | Invalid credentials |
| 24 | hasPermission() callable | โ PASS | |
| 25 | Non-existent user โ success=false | โ PASS | |
| 26 | Cleanup: test user deleted | โ PASS |
โ ๏ธ Delete test_authservice.php before deploying to production.