blob: ca198dc5514892dfbfef3c59dc3f88bb79b83f9d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<?php
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
use Behat\Behat\Context\Context;
class RateLimitingContext implements Context {
use BasicStructure;
use CommandLine;
use Provisioning;
/**
* @BeforeScenario @RateLimiting
*/
public function enableRateLimiting() {
// Enable rate limiting for the tests.
// Ratelimiting is disabled by default, so we need to enable it
$this->runOcc(['config:system:set', 'ratelimit.protection.enabled', '--value', 'true', '--type', 'bool']);
}
/**
* @AfterScenario @RateLimiting
*/
public function disableRateLimiting() {
// Restore the default rate limiting configuration.
// Ratelimiting is disabled by default, so we need to disable it
$this->runOcc(['config:system:set', 'ratelimit.protection.enabled', '--value', 'false', '--type', 'bool']);
}
}
|