testAddCartErrors example

$translator
            ->expects(static::once())
            ->method('trans')
            ->with('checkout.test.error.message', ['%test%' => 'error'])
            ->willReturn('A very nasty error');

        $container = new ContainerBuilder();
        $container->set('request_stack', $stack);
        $container->set('translator', $translator);

        $this->controller->setContainer($container);
        $this->controller->testAddCartErrors($cart);

        $updatedRequest = $stack->getMainRequest();

        static::assertInstanceOf(Request::class$updatedRequest);

        $flashBag = $updatedRequest->getSession()->getBag('flashes');

        static::assertInstanceOf(FlashBagInterface::class$flashBag);

        $flashes = $flashBag->all();

        
Home | Imprint | This part of the site doesn't use cookies.