I've taken the time to add some unit tests. Since I use this package for B2C authentication, most tests that were written test this functionality. I believe it's a good starting point for people to add more tests.
The tests use a MockHandler that returns fake openIdConfig, keys, and tokens. This lets us test the package's code without having to worry about external connections. (See Fakers/ and Helper/)
Overview:
AccessTokenTest: correctly create and serialize AccessToken
test validateAccessToken: ISSUE -> validateAccessToken causes UnexpectedValueException : "kid" invalid, unable to lookup correct key in JWT.php:448. Not sure if this is a bug. This function doesn't seem to be used anywhere else. The same error is thrown when I call validateAccessToken in my personal project.
throw exception for invalid keys: ISSUE -> code only catches JWT_Exception but this class does not exist and also does not catch other exceptions
Hi,
I've taken the time to add some unit tests. Since I use this package for B2C authentication, most tests that were written test this functionality. I believe it's a good starting point for people to add more tests.
The tests use a MockHandler that returns fake openIdConfig, keys, and tokens. This lets us test the package's code without having to worry about external connections. (See
Fakers/
andHelper/
)Overview:
AzureTest:
test openIdConfig handling
throw RuntimeException when client id is invalid
throw RuntimeException when token is expired
throw RuntimeException when token is from future
throw RuntimeException when issuer is invalid
test getBaseAuthorizationUrl
test getLogoutUrl
test validateAccessToken: ISSUE -> validateAccessToken causes UnexpectedValueException : "kid" invalid, unable to lookup correct key in JWT.php:448. Not sure if this is a bug. This function doesn't seem to be used anywhere else. The same error is thrown when I call validateAccessToken in my personal project.
throw exception for invalid keys: ISSUE -> code only catches JWT_Exception but this class does not exist and also does not catch other exceptions
throw exception for invalid token
test getGrant