This repository was archived by the owner on Feb 18, 2023. It is now read-only.
Change Laravel Permission config to avoid to log alert while running tests #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A simple fix to avoid Laravel log file to be filled with "Could not register permissions..." alert messages.
This is because for each test, an application instance is created before running use trait tasks (database migration, etc...). Each time application instance is created, the Spatie laravel-permission service provider attempt to register permissions. (and since database is not migrated yet, it fail and write an exception message in log file).
To avoid this behaviour, the laravel-permission provide the
log_registration_exception
boolean option : theses changes simply set this option to false if APP_ENV equals "testing".