Skip to content

Commit

Permalink
Event fake is broken when inspecting multiple events of same type.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 30, 2017
1 parent 819888c commit 55be2ea
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/Illuminate/Support/Testing/Fakes/EventFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public function dispatched($event, $callback = null)

return collect($this->events[$event])->filter(function ($arguments) use ($callback) {
return $callback(...$arguments);
})->flatMap(function ($arguments) {
return $this->mapEventArguments($arguments);
});
}

Expand All @@ -79,24 +77,6 @@ public function hasDispatched($event)
return isset($this->events[$event]) && ! empty($this->events[$event]);
}

/**
* Map the "fire" method arguments for inspection.
*
* @param array $arguments
* @return array
*/
protected function mapEventArguments($arguments)
{
// If the fired event was just a simple string event, we will return the event
// name as the key with the array of arguments as the value. Otherwise this
// event was an object event and we will return this object as the value.
if (is_string($arguments[0])) {
return [$arguments[0] => $arguments[1]];
} else {
return [get_class($arguments[0]) => $arguments[0]];
}
}

/**
* Register an event listener with the dispatcher.
*
Expand Down

0 comments on commit 55be2ea

Please sign in to comment.