0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-02 21:10:39 +00:00
nextcloud_server/build/integration/features/bootstrap/RateLimitingContext.php
Ferdinand Thiessen 832f79ac93
chore: apply code style
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-04-30 19:04:59 +02:00

31 lines
899 B
PHP

<?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']);
}
}