Exemplo n.º 1
0
 function it_adds_message_from_event(SessionInterface $session, FlashBagInterface $flashBag, RequestConfiguration $requestConfiguration, ResourceControllerEvent $event)
 {
     $event->getMessage()->willReturn('sylius.channel.cannot_be_deleted');
     $event->getMessageType()->willReturn(ResourceControllerEvent::TYPE_WARNING);
     $event->getMessageParameters()->willReturn(['%name%' => 'Germany Sylius Webshop']);
     $session->getBag('flashes')->willReturn($flashBag);
     $flashBag->add(ResourceControllerEvent::TYPE_WARNING, ['message' => 'sylius.channel.cannot_be_deleted', 'parameters' => ['%name%' => 'Germany Sylius Webshop']])->shouldBeCalled();
     $this->addFlashFromEvent($requestConfiguration, $event);
 }
Exemplo n.º 2
0
 function it_adds_flash_from_event(SessionInterface $session, FlashBagInterface $flashBag, TranslatorInterface $translator, RequestConfiguration $requestConfiguration, ResourceControllerEvent $event)
 {
     $event->getMessage()->willReturn('sylius.channel.cannot_be_deleted');
     $event->getMessageType()->willReturn(ResourceControllerEvent::TYPE_WARNING);
     $event->getMessageParameters()->willReturn(array('%name%' => 'Germany Sylius Webshop'));
     $session->getBag('flashes')->willReturn($flashBag);
     $translator->trans('sylius.channel.cannot_be_deleted', array('%name%' => 'Germany Sylius Webshop'), 'flashes')->willReturn('Channel "Germany Sylius Webshop" cannot be deleted.');
     $flashBag->add(ResourceControllerEvent::TYPE_WARNING, 'Channel "Germany Sylius Webshop" cannot be deleted.')->shouldBeCalled();
     $this->addFlashFromEvent($requestConfiguration, $event);
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function addFlashFromEvent(RequestConfiguration $requestConfiguration, ResourceControllerEvent $event)
 {
     $translatedMessage = $this->translator->trans($event->getMessage(), $event->getMessageParameters(), 'flashes');
     $this->session->getBag('flashes')->add($event->getMessageType(), $translatedMessage);
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function addFlashFromEvent(RequestConfiguration $requestConfiguration, ResourceControllerEvent $event)
 {
     $this->addFlash($event->getMessageType(), $event->getMessage(), $event->getMessageParameters());
 }