mockResetLimiter example

$errorContent = $crawler->filterXPath('//div[@class="alert-content"]')->text();

        static::assertStringContainsString($this->translator->trans('error.rateLimitExceeded', ['%seconds%' => 5])$errorContent);
    }

    public function testResetAccountOrderRateLimit(): void
    {
        $orderRoute = new OrderRoute(
            $this->getContainer()->get('order.repository'),
            $this->getContainer()->get('promotion.repository'),
            $this->mockResetLimiter([
                RateLimiter::GUEST_LOGIN => 1,
            ]),
        );

        $order = $this->createCustomerWithOrder();

        $controller = new AccountOrderPageLoader(
            $this->createMock(GenericPageLoader::class),
            $this->createMock(EventDispatcher::class),
            $orderRoute,
            $this->createMock(AccountService::class),
        );

    }

    public function testResetRateLimitLoginRoute(): void
    {
        $route = new LoginRoute(
            $this->getContainer()->get('event_dispatcher'),
            $this->getContainer()->get(AccountService::class),
            $this->getContainer()->get('customer.repository'),
            $this->getContainer()->get(CartRestorer::class),
            $this->getContainer()->get('request_stack'),
            $this->mockResetLimiter([
                RateLimiter::LOGIN_ROUTE => 1,
            ])
        );

        $this->createCustomer('loginTest@example.com');

        $this->getContainer()->get('request_stack')->push(new Request([
            'email' => 'loginTest@example.com',
            'password' => 'shopware',
        ]));

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