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 void */ private function moveNewNotificationsToCurrent() { $notifications = $this->session->get($this->newKey()); $this->session->put($this->currentKey(), $notifications); $this->session->put($this->newKey(), []); }