Open true2thepen opened 1 year ago
This is failing 2 tests. I have yet to discover why. It works on the dev server. I did find during all these failed test that I inadvertently allowed the email field to contain either the username or email. I have since fixed this. Any ideas on why these two tests are failing let me know.
@nicumicle Help please. Are the following two test possibly incorrect. Both mock a password of 1234 and send a password of 123. It's the only reason I can see that my changes are failing the tests. If not, any suggestions - cause I'm befuddled at the moment. Code works with testing on my dev server.
Use Postman to test. Pass username field with username or email and correct password returns true. Pass incorrect credentials returns false. Pass email field with email and correct password returns true. Pass email field with username and correct password returns false. Pass incorrect credentials returns false.
Error output: There were 2 errors:
1) SimpleJWTLoginTests\Services\AuthenticateServiceTest::testSuccessFlowWithFullPayload Exception: Wrong user credentials.
/app/simple-jwt-login/src/Services/AuthenticateService.php:119 /app/simple-jwt-login/src/Services/AuthenticateService.php:79 /app/tests/Services/AuthenticateServiceTest.php:293
2) SimpleJWTLoginTests\Services\AuthenticateServiceTest::testSuccessFlowWithFullPayloadAndPasshash Exception: Wrong user credentials.
/app/simple-jwt-login/src/Services/AuthenticateService.php:119 /app/simple-jwt-login/src/Services/AuthenticateService.php:79 /app/tests/Services/AuthenticateServiceTest.php:346
ERRORS! Tests: 270, Assertions: 602, Errors: 2.
Found the problem in the tests. When you change the authentication to allow username to contain either the username or the email, you need to account for this in the tests. Which they weren't. Tests are now fixed.
Issue Link
19
Types of changes
Description
Added check for username/email in username field on /auth endpoint. This allows user to login in with either username or email in username field as they normally would in WordPress.
How has this been tested?
Tested on dev server running WP 6.1.1 and PHP 8.1
Screenshots (optional)
Checklist:
composer check-plugin
locally