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

fix: Lazily bind dependencies #2321

Merged
merged 1 commit into from
Feb 9, 2023
Merged

Conversation

olivernybroe
Copy link
Contributor

@olivernybroe olivernybroe commented Feb 7, 2023

Here is a new version of the lazy binding solution. The reason why it was causing issues the first time around was because the registerPermissions method was called once PermissionRegistrar was resolved instead of when Gate was resolved.

I tested this out in a fresh installation of Laravel with the can directive in a file and my change here worked. but ofc. would love someone else to also validate

ping @drbyte

@danilopinotti
Copy link
Contributor

danilopinotti commented Feb 7, 2023

What about implementing a test to cover the last issues related?

In time, I will test these modifications locally and let you know about the results


EDIT:

It worked here

@drbyte
Copy link
Collaborator

drbyte commented Feb 7, 2023

@olivernybroe thanks for the update!

What are your thoughts on test suite changes to support it?

@olivernybroe
Copy link
Contributor Author

@drbyte I can't seem to find a great way of doing that, as we currently resolve all the classes in the setup method in the TestCase file.

So when we get to this part to check the lazy binding, it doesn't matter as they are resolved.

@drbyte
Copy link
Collaborator

drbyte commented Feb 9, 2023

Agreed.

@drbyte drbyte merged commit 5f051f8 into spatie:main Feb 9, 2023
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.

3 participants