diff options
author | Joas Schilling <coding@schilljs.com> | 2023-08-28 15:50:45 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-08-28 15:50:45 +0200 |
commit | 25309bcb45232bf30fe719bac1776f0136f7cd7a (patch) | |
tree | 7cfa6dacd42f22a854b895c2ae5853ff1725d96b /tests/lib/AppFramework/Middleware/Security | |
parent | ac3d7e3a7e9848c5e134b79f481d73416cc810f4 (diff) | |
download | nextcloud-server-25309bcb45232bf30fe719bac1776f0136f7cd7a.tar.gz nextcloud-server-25309bcb45232bf30fe719bac1776f0136f7cd7a.zip |
techdebt(DI): Use public IThrottler interface which exists since Nextcloud 25
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/AppFramework/Middleware/Security')
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php | 6 | ||||
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php index faf2d24d172..0492d5f7fcf 100644 --- a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php @@ -24,11 +24,11 @@ namespace Test\AppFramework\Middleware\Security; use OC\AppFramework\Middleware\Security\BruteForceMiddleware; use OC\AppFramework\Utility\ControllerMethodReflector; -use OC\Security\Bruteforce\Throttler; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Attribute\BruteForceProtection; use OCP\AppFramework\Http\Response; use OCP\IRequest; +use OCP\Security\Bruteforce\IThrottler; use Psr\Log\LoggerInterface; use Test\TestCase; @@ -55,7 +55,7 @@ class TestController extends Controller { class BruteForceMiddlewareTest extends TestCase { /** @var ControllerMethodReflector */ private $reflector; - /** @var Throttler|\PHPUnit\Framework\MockObject\MockObject */ + /** @var IThrottler|\PHPUnit\Framework\MockObject\MockObject */ private $throttler; /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */ private $request; @@ -67,7 +67,7 @@ class BruteForceMiddlewareTest extends TestCase { parent::setUp(); $this->reflector = new ControllerMethodReflector(); - $this->throttler = $this->createMock(Throttler::class); + $this->throttler = $this->createMock(IThrottler::class); $this->request = $this->createMock(IRequest::class); $this->logger = $this->createMock(LoggerInterface::class); diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php index 7c48f7e2712..80c2ed84451 100644 --- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php @@ -15,21 +15,22 @@ use OC\AppFramework\Http\Request; use OC\AppFramework\Middleware\Security\CORSMiddleware; use OC\AppFramework\Middleware\Security\Exceptions\SecurityException; use OC\AppFramework\Utility\ControllerMethodReflector; -use OC\Security\Bruteforce\Throttler; use OC\User\Session; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\Response; use OCP\IConfig; use OCP\IRequest; use OCP\IRequestId; +use OCP\Security\Bruteforce\IThrottler; +use PHPUnit\Framework\MockObject\MockObject; use Test\AppFramework\Middleware\Security\Mock\CORSMiddlewareController; class CORSMiddlewareTest extends \Test\TestCase { /** @var ControllerMethodReflector */ private $reflector; - /** @var Session|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Session|MockObject */ private $session; - /** @var Throttler */ + /** @var IThrottler|MockObject */ private $throttler; /** @var CORSMiddlewareController */ private $controller; @@ -38,7 +39,7 @@ class CORSMiddlewareTest extends \Test\TestCase { parent::setUp(); $this->reflector = new ControllerMethodReflector(); $this->session = $this->createMock(Session::class); - $this->throttler = $this->createMock(Throttler::class); + $this->throttler = $this->createMock(IThrottler::class); $this->controller = new CORSMiddlewareController( 'test', $this->createMock(IRequest::class) |