diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-13 09:51:24 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-13 10:06:32 +0200 |
commit | 009761be58c4485f29a8d3382e51fb4e1bfbeec4 (patch) | |
tree | 3be1783ef819cd853c6ab61e3133a97107b004b9 /tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php | |
parent | 86f01a3358df1c5b9c8c8f78ffa46f2cf234b0e3 (diff) | |
download | nextcloud-server-009761be58c4485f29a8d3382e51fb4e1bfbeec4.tar.gz nextcloud-server-009761be58c4485f29a8d3382e51fb4e1bfbeec4.zip |
test: Adjust tests for CSP nonce
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php')
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php index 63a3e7ff123..9ce4f3daf79 100644 --- a/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php @@ -20,15 +20,15 @@ use OCP\AppFramework\Http\Response; use PHPUnit\Framework\MockObject\MockObject; class CSPMiddlewareTest extends \Test\TestCase { - /** @var CSPMiddleware|MockObject */ + /** @var CSPMiddleware&MockObject */ private $middleware; - /** @var Controller|MockObject */ + /** @var Controller&MockObject */ private $controller; - /** @var ContentSecurityPolicyManager|MockObject */ + /** @var ContentSecurityPolicyManager&MockObject */ private $contentSecurityPolicyManager; - /** @var CsrfTokenManager|MockObject */ + /** @var CsrfTokenManager&MockObject */ private $csrfTokenManager; - /** @var ContentSecurityPolicyNonceManager|MockObject */ + /** @var ContentSecurityPolicyNonceManager&MockObject */ private $cspNonceManager; protected function setUp(): void { @@ -94,14 +94,10 @@ class CSPMiddlewareTest extends \Test\TestCase { ->expects($this->once()) ->method('browserSupportsCspV3') ->willReturn(true); - $token = $this->createMock(CsrfToken::class); - $token - ->expects($this->once()) - ->method('getEncryptedValue') - ->willReturn('MyEncryptedToken'); - $this->csrfTokenManager + $token = base64_encode('the-nonce'); + $this->cspNonceManager ->expects($this->once()) - ->method('getToken') + ->method('getNonce') ->willReturn($token); $response = $this->createMock(Response::class); $defaultPolicy = new ContentSecurityPolicy(); |