function it_performs_kernel_exception_action_successfully(UrlGeneratorInterface $router, SessionInterface $session, TranslatorInterface $translator, GetResponseForExceptionEvent $event, FlashBagInterface $flashBag, StockableInterface $stockable) { $stockable->getOnHand()->willReturn('30'); $stockable->getInventoryName()->willReturn('Inventory Name'); $event->getException()->willReturn(new InsufficientStockException($stockable->getWrappedObject(), 42)); $event->setResponse(Argument::type(RedirectResponse::class))->shouldBeCalled(); $translator->trans('sylius.checkout.out_of_stock', ['%quantity%' => '30', '%name%' => 'Inventory Name'], 'flashes')->willReturn('message translated'); $flashBag->add('notice', 'message translated')->shouldBeCalled(); $session->getBag('flashes')->willReturn($flashBag); $router->generate('redirect_to_url')->willReturn('url'); $this->onKernelException($event); }