10000 [5.6] Allow faking events for only a specific part by arjanwestdorp · Pull Request #24230 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

[5.6] Allow faking events for only a specific part #24230

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

Merged
merged 4 commits into from
May 18, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use static instead of Event
  • Loading branch information
arjanwestdorp committed May 16, 2018
commit 2ca07e8ac7c3b5af8a75c4bb19f49b60988d7e22
6 changes: 3 additions & 3 deletions src/Illuminate/Support/Facades/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public static function fake($eventsToFake = [])
*/
public static function fakeFor(callable $callable, array $eventsToFake = [])
{
$initialDispatcher = Event::getFacadeRoot();
$initialDispatcher = static::getFacadeRoot();

Event::fake($eventsToFake);
static::fake($eventsToFake);

return tap($callable(), function () use ($initialDispatcher) {
Model::setEventDispatcher($initialDispatcher);

Event::swap($initialDispatcher);
static::swap($initialDispatcher);
});
}

Expand Down
0