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 withoutMix and withMix test helpers #30900

Merged
merged 1 commit into from Dec 23, 2019

Conversation

@jasonmccreary
Copy link
Contributor

jasonmccreary commented Dec 22, 2019

Similar to withoutExceptionHandling and withExceptionHandling, these two test helpers allow developers to quickly unbinding and rebinding Laravel Mix in the container during testing.

This behavior was added in #26289, but still requires intimate knowledge of the underlying Mix class and proper binding function. Furthermore, it adds a relatively obscure, big block of code for a simple need.

Before

$this->swap(\Illuminate\Foundation\Mix::class, function () {
    return '';
});

After

$this->withoutMix();

Note: Inline with other TestCase methods, withoutMix returns the instance allowing it to be chained with other fluent methods, e.g. $this->withoutMix()->withoutExceptionHandling()->get('/');

@GrahamCampbell GrahamCampbell changed the title Add withoutMix and withMix test helpers [6.x] Add withoutMix and withMix test helpers Dec 22, 2019
@taylorotwell taylorotwell merged commit f32662a into laravel:6.x Dec 23, 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
@jasonmccreary jasonmccreary deleted the jasonmccreary:without-mix branch Dec 23, 2019
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.