diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2017-10-24 19:58:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-24 19:58:24 +0200 |
commit | b88db3a389c8211e58bcbc63674e336783ce81fe (patch) | |
tree | 6200429e786f19918bd62cbbd05f4156dcd2b7aa /tests | |
parent | 93d5500f9aada67e3adef585438aec5382de75ff (diff) | |
parent | ce0c45a4eabbe622500a4b621ccc4393720fc5ad (diff) | |
download | nextcloud-server-b88db3a389c8211e58bcbc63674e336783ce81fe.tar.gz nextcloud-server-b88db3a389c8211e58bcbc63674e336783ce81fe.zip |
Merge pull request #6921 from nextcloud/appmanager-securitymiddleware
Use proper DI for security middleware for app enabled check
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index 773cb2b196f..6b311c7ae15 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -37,6 +37,7 @@ use OC\Security\CSP\ContentSecurityPolicyManager; use OC\Security\CSP\ContentSecurityPolicyNonceManager; use OC\Security\CSRF\CsrfToken; use OC\Security\CSRF\CsrfTokenManager; +use OCP\App\IAppManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\EmptyContentSecurityPolicy; use OCP\AppFramework\Http\RedirectResponse; @@ -79,6 +80,8 @@ class SecurityMiddlewareTest extends \Test\TestCase { private $csrfTokenManager; /** @var ContentSecurityPolicyNonceManager|\PHPUnit_Framework_MockObject_MockObject */ private $cspNonceManager; + /** @var IAppManager|\PHPUnit_Framework_MockObject_MockObject */ + private $appManager; protected function setUp() { parent::setUp(); @@ -93,6 +96,10 @@ class SecurityMiddlewareTest extends \Test\TestCase { $this->contentSecurityPolicyManager = $this->createMock(ContentSecurityPolicyManager::class); $this->csrfTokenManager = $this->createMock(CsrfTokenManager::class); $this->cspNonceManager = $this->createMock(ContentSecurityPolicyNonceManager::class); + $this->appManager = $this->createMock(IAppManager::class); + $this->appManager->expects($this->any()) + ->method('isEnabledForUser') + ->willReturn(true); $this->middleware = $this->getMiddleware(true, true); $this->secException = new SecurityException('hey', false); $this->secAjaxException = new SecurityException('hey', true); @@ -116,7 +123,8 @@ class SecurityMiddlewareTest extends \Test\TestCase { $isAdminUser, $this->contentSecurityPolicyManager, $this->csrfTokenManager, - $this->cspNonceManager + $this->cspNonceManager, + $this->appManager ); } |