function it_moves_the_notifications_from_new_to_current(SessionStore $session) { $notifications = [['type' => 'success', 'message' => 'It is successful'], ['type' => 'error', 'message' => 'It is an error']]; $session->has('my-key.new')->willReturn(true); $session->get('my-key.new')->willReturn($notifications); $session->put('my-key.current', $notifications)->shouldBeCalled(); $session->put('my-key.new', [])->shouldBeCalled(); $session->get('my-key.current')->willReturn($notifications); $this->beConstructedWith($session, 'my-key'); $this->getCurrentNotifications()->shouldHaveType(Notifications::class); }
/** * @return Notifications */ public function getCurrentNotifications() { $notifications = $this->session->get($this->currentKey()); return Notifications::mapFromArray($notifications); }