Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement: 'scopes', 'hasScope' and 'hasAnyScopes' method #107

Merged
merged 9 commits into from
Feb 26, 2024
Merged

Implement: 'scopes', 'hasScope' and 'hasAnyScopes' method #107

merged 9 commits into from
Feb 26, 2024

Conversation

vlauciani
Copy link
Contributor

Solve Issue: #106

@vlauciani vlauciani mentioned this pull request Feb 23, 2024
@robsontenorio
Copy link
Owner

Thanks @vlauciani !

Could you please add tests?

@vlauciani
Copy link
Contributor Author

Hi @robsontenorio

Tests added!
Could you check If all is ok?

Copy link

codecov bot commented Feb 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (042483a) to head (5db4c8a).

Additional details and impacted files
@@             Coverage Diff             @@
##              master      #107   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity        37        43    +6     
===========================================
  Files              4         4           
  Lines             97       112   +15     
===========================================
+ Hits              97       112   +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@robsontenorio
Copy link
Owner

robsontenorio commented Feb 24, 2024

There is a missing test case for empty returning. Check the report above.

@vlauciani
Copy link
Contributor Author

vlauciani commented Feb 25, 2024

The command composer test:coverage to test "coverage" doesn't work; the file .coverage/clover.xml is missing. It returns an error:

bash-5.1#
bash-5.1# composer test:coverage
> php -d pcov.enabled=1 ./vendor/bin/pest --coverage --coverage-clover=.coverage/clover.xml --coverage-html=.coverage

   PASS  KeycloakGuard\Tests\AuthenticateTest
  ✓ authenticates the user when requesting a private endpoint with token
  ✓ authenticates the user when requesting an public endpoint with token
  ✓ forbiden when request a protected endpoint without token
  ✓ laravel default interface for authenticated users
  ✓ laravel default interface for unathenticated users
  ✓ throws a exception when user is not found
  ✓ appends token to the user
  ✓ does not appends token to the user
  ✓ does not load user from database
  ✓ does not load user from database but appends decoded token
  ✓ throws a exception when resource access is not allowed by api
  ✓ ignores resources validation
  ✓ check user has role in resource
  ✓ check user no has role in resource
  ✓ prevent cross roles resources
  ✓ check user has any role in resource
  ✓ check user no has any role in resource
  ✓ prevent cross roles resources with any role
  ✓ check user has scope
  ✓ check user no has scope
  ✓ check user has any scope
  ✓ check user no has any scope
  ✓ custom user retrieve method
  ✓ throws a exception with invalid iat
  ✓ works with leeway
  ✓ authenticates with custom input key
  ✓ authentication prefers bearer token over with custom input key

  Tests:  27 passed
  Time:   0.95s


   ERROR  No code coverage driver is available.
Script php -d pcov.enabled=1 ./vendor/bin/pest --coverage --coverage-clover=.coverage/clover.xml --coverage-html=.coverage handling the test:coverage event returned with error code 1
bash-5.1#
bash-5.1#

@robsontenorio
Copy link
Owner

Thanks !

@robsontenorio robsontenorio merged commit cc051f5 into robsontenorio:master Feb 26, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants