getRequestStack example

use Symfony\Component\HttpFoundation\RequestStack;

/** * @internal * * @covers \Shopware\Storefront\Framework\Routing\MaintenanceModeResolver */
class MaintenanceModeResolverTest extends TestCase
{
    public function testShouldInstantiate(): void
    {
        static::assertInstanceOf(MaintenanceModeResolver::classnew MaintenanceModeResolver($this->getRequestStack()new CoreMaintenanceModeResolver(new EventDispatcher())));
    }

    /** * Tests whether the resolver redirects requests to the maintenance page correctly. * * @dataProvider maintenanceModeInactiveProvider * @dataProvider maintenanceModeActiveProvider * @dataProvider xmlHttpRequestProvider * @dataProvider maintenancePageRequestProvider * @dataProvider errorControllerRequestProvider */
    


    /** * @dataProvider cartProvider */
    public function testAddCartErrorsAddsUrlToSalutationErrors(Cart $cart): void
    {
        $container = static::createStub(ContainerInterface::class);

        $container->method('get')
            ->willReturnMap([
                $this->getRequestStack(),
                $this->getRouter(),
                $this->getTranslator($cart->getErrors()),
            ]);

        $controller = new TestController();

        $controller->setContainer($container);
        $controller->accessAddCartErrors($cart);

        static::assertNotEmpty($cart->getErrors()->getElements());
    }

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