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

[6.x] Add hasMacro methods to Eloquent Builder #30008

Merged
merged 2 commits into from
Sep 18, 2019
Merged

[6.x] Add hasMacro methods to Eloquent Builder #30008

merged 2 commits into from
Sep 18, 2019

Conversation

simonhamp
Copy link
Contributor

Adding 3 new public methods to the Eloquent Builder for convenience to allow tests to assert on whether or not the Builder class has global macros - or an instance of it, local macros - registered to it.

This will allow for tests where the assertion is looking to see if a macro method is registered without having to be concerned about the macro's specific implementation, as demonstrated.

It also allows for a more defensive style of coding against Builder macros, if you're that way inclined. For those times when you prefer to check that a macro is registered rather than handling the exception thrown when it isn't.

@GrahamCampbell GrahamCampbell changed the title Add hasMacro methods to Eloquent Builder [6.x] Add hasMacro methods to Eloquent Builder Sep 16, 2019
@taylorotwell taylorotwell merged commit b3bc1e0 into laravel:6.x Sep 18, 2019
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