/**
     * @param Notification $notification
     * @return string
     */
    private function renderNotification(Notification $notification)
    {
        $classNameSuffix = $this->getClassNameSuffix($notification->getType());
        return <<<HTML
<div class="alert alert-{$classNameSuffix}" role="alert">
    {$notification->getMessage()}
</div>

HTML;
    }
Esempio n. 2
0
 /**
  * @param array $notifications
  * @return Notifications
  */
 public static function mapFromArray(array $notifications)
 {
     $mapped = array_map(function (array $notification) {
         return Notification::fromArray($notification);
     }, $notifications);
     return new Notifications($mapped);
 }
Esempio n. 3
0
 function it_can_get_the_current_notifications()
 {
     $notification = Notification::success('It was successful');
     $this->send($notification);
     $this->getCurrentNotifications()->shouldBe([]);
 }
Esempio n. 4
0
 function it_can_send_a_notification(Transport $transport)
 {
     $notification = Notification::success('It was successful');
     $transport->send($notification)->shouldBeCalled();
     $this->send($notification);
 }
Esempio n. 5
0
 function let()
 {
     $this->beConstructedWith([Notification::success('It is successful'), Notification::error('It is an error')]);
 }
Esempio n. 6
0
 function it_sends_the_notifications_to_the_session_store(SessionStore $session)
 {
     $notification = Notification::success('It was successful');
     $session->push('my-key.new', ['type' => $notification->getType(), 'message' => $notification->getMessage()])->shouldBeCalled();
     $this->send($notification);
 }
Esempio n. 7
0
 /**
  * @param Notification $notification
  * @return void
  */
 public function send(Notification $notification)
 {
     $this->session->push($this->newKey(), ['type' => $notification->getType(), 'message' => $notification->getMessage()]);
 }
 /**
  * @return Notifications
  */
 private function createNotifications()
 {
     return new Notifications([Notification::success('It is successful'), Notification::error('It is an error'), Notification::warning('It is a warning'), Notification::info('It is info')]);
 }