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

Conversation

@simonhamp
Copy link
Contributor

commented Sep 16, 2019

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.

simonhamp added 2 commits Sep 16, 2019
Resurrects #20696
@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
2 checks passed
2 checks passed
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.