function it_shares_the_notifications_from_the_session(Notifier $notifier, Factory $viewFactory, Request $request) { $notifications = Notifications::mapFromArray([]); $notifier->getCurrentNotifications()->willReturn($notifications); $viewFactory->share('notifications', $notifications)->shouldBeCalled(); $next = function ($req) use($request) { return $req === $request->getWrappedObject(); }; $this->handle($request, $next)->shouldBe(true); }
/** * Handle an incoming request. * * @param Request $request * @param Closure $next * @return mixed */ public function handle($request, Closure $next) { $notifications = $this->notifier->getCurrentNotifications(); $this->viewFactory->share('notifications', $notifications); return $next($request); }