123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738 |
- <?php
- /**
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @author Lukas Reschke <lukas@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
- namespace Test\AppFramework\Middleware\Security;
- use OC\AppFramework\Http;
- use OC\AppFramework\Http\Request;
- use OC\AppFramework\Middleware\Security\Exceptions\AppNotEnabledException;
- use OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryException;
- use OC\AppFramework\Middleware\Security\Exceptions\NotAdminException;
- use OC\AppFramework\Middleware\Security\Exceptions\NotLoggedInException;
- use OC\AppFramework\Middleware\Security\Exceptions\SecurityException;
- use OC\Appframework\Middleware\Security\Exceptions\StrictCookieMissingException;
- use OC\AppFramework\Middleware\Security\SecurityMiddleware;
- use OC\AppFramework\Utility\ControllerMethodReflector;
- use OC\Security\CSP\ContentSecurityPolicy;
- 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;
- use OCP\AppFramework\Http\JSONResponse;
- use OCP\AppFramework\Http\Response;
- use OCP\AppFramework\Http\TemplateResponse;
- use OCP\IConfig;
- use OCP\IL10N;
- use OCP\ILogger;
- use OCP\INavigationManager;
- use OCP\IRequest;
- use OCP\IURLGenerator;
- use OCP\Security\ISecureRandom;
- class SecurityMiddlewareTest extends \Test\TestCase {
- /** @var SecurityMiddleware|\PHPUnit_Framework_MockObject_MockObject */
- private $middleware;
- /** @var Controller|\PHPUnit_Framework_MockObject_MockObject */
- private $controller;
- /** @var SecurityException */
- private $secException;
- /** @var SecurityException */
- private $secAjaxException;
- /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
- private $request;
- /** @var ControllerMethodReflector */
- private $reader;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
- private $logger;
- /** @var INavigationManager|\PHPUnit_Framework_MockObject_MockObject */
- private $navigationManager;
- /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
- private $urlGenerator;
- /** @var ContentSecurityPolicyManager|\PHPUnit_Framework_MockObject_MockObject */
- private $contentSecurityPolicyManager;
- /** @var CsrfTokenManager|\PHPUnit_Framework_MockObject_MockObject */
- private $csrfTokenManager;
- /** @var ContentSecurityPolicyNonceManager|\PHPUnit_Framework_MockObject_MockObject */
- private $cspNonceManager;
- /** @var IAppManager|\PHPUnit_Framework_MockObject_MockObject */
- private $appManager;
- /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
- private $l10n;
- protected function setUp() {
- parent::setUp();
- $this->controller = $this->createMock(Controller::class);
- $this->reader = new ControllerMethodReflector();
- $this->logger = $this->createMock(ILogger::class);
- $this->navigationManager = $this->createMock(INavigationManager::class);
- $this->urlGenerator = $this->createMock(IURLGenerator::class);
- $this->request = $this->createMock(IRequest::class);
- $this->contentSecurityPolicyManager = $this->createMock(ContentSecurityPolicyManager::class);
- $this->csrfTokenManager = $this->createMock(CsrfTokenManager::class);
- $this->cspNonceManager = $this->createMock(ContentSecurityPolicyNonceManager::class);
- $this->l10n = $this->createMock(IL10N::class);
- $this->middleware = $this->getMiddleware(true, true);
- $this->secException = new SecurityException('hey', false);
- $this->secAjaxException = new SecurityException('hey', true);
- }
- private function getMiddleware(bool $isLoggedIn, bool $isAdminUser, bool $isAppEnabledForUser = true): SecurityMiddleware {
- $this->appManager = $this->createMock(IAppManager::class);
- $this->appManager->expects($this->any())
- ->method('isEnabledForUser')
- ->willReturn($isAppEnabledForUser);
- return new SecurityMiddleware(
- $this->request,
- $this->reader,
- $this->navigationManager,
- $this->urlGenerator,
- $this->logger,
- 'files',
- $isLoggedIn,
- $isAdminUser,
- $this->contentSecurityPolicyManager,
- $this->csrfTokenManager,
- $this->cspNonceManager,
- $this->appManager,
- $this->l10n
- );
- }
- /**
- * @PublicPage
- * @NoCSRFRequired
- */
- public function testSetNavigationEntry(){
- $this->navigationManager->expects($this->once())
- ->method('setActiveEntry')
- ->with($this->equalTo('files'));
- $this->reader->reflect(__CLASS__, __FUNCTION__);
- $this->middleware->beforeController($this->controller, __FUNCTION__);
- }
- /**
- * @param string $method
- * @param string $test
- */
- private function ajaxExceptionStatus($method, $test, $status) {
- $isLoggedIn = false;
- $isAdminUser = false;
- // isAdminUser requires isLoggedIn call to return true
- if ($test === 'isAdminUser') {
- $isLoggedIn = true;
- }
- $sec = $this->getMiddleware($isLoggedIn, $isAdminUser);
- try {
- $this->reader->reflect(__CLASS__, $method);
- $sec->beforeController($this->controller, $method);
- } catch (SecurityException $ex){
- $this->assertEquals($status, $ex->getCode());
- }
- // add assertion if everything should work fine otherwise phpunit will
- // complain
- if ($status === 0) {
- $this->addToAssertionCount(1);
- }
- }
- public function testAjaxStatusLoggedInCheck() {
- $this->ajaxExceptionStatus(
- __FUNCTION__,
- 'isLoggedIn',
- Http::STATUS_UNAUTHORIZED
- );
- }
- /**
- * @NoCSRFRequired
- */
- public function testAjaxNotAdminCheck() {
- $this->ajaxExceptionStatus(
- __FUNCTION__,
- 'isAdminUser',
- Http::STATUS_FORBIDDEN
- );
- }
- /**
- * @PublicPage
- */
- public function testAjaxStatusCSRFCheck() {
- $this->ajaxExceptionStatus(
- __FUNCTION__,
- 'passesCSRFCheck',
- Http::STATUS_PRECONDITION_FAILED
- );
- }
- /**
- * @PublicPage
- * @NoCSRFRequired
- */
- public function testAjaxStatusAllGood() {
- $this->ajaxExceptionStatus(
- __FUNCTION__,
- 'isLoggedIn',
- 0
- );
- $this->ajaxExceptionStatus(
- __FUNCTION__,
- 'isAdminUser',
- 0
- );
- $this->ajaxExceptionStatus(
- __FUNCTION__,
- 'isSubAdminUser',
- 0
- );
- $this->ajaxExceptionStatus(
- __FUNCTION__,
- 'passesCSRFCheck',
- 0
- );
- }
- /**
- * @PublicPage
- * @NoCSRFRequired
- */
- public function testNoChecks(){
- $this->request->expects($this->never())
- ->method('passesCSRFCheck')
- ->will($this->returnValue(false));
- $sec = $this->getMiddleware(false, false);
- $this->reader->reflect(__CLASS__, __FUNCTION__);
- $sec->beforeController($this->controller, __FUNCTION__);
- }
- /**
- * @param string $method
- * @param string $expects
- */
- private function securityCheck($method, $expects, $shouldFail=false){
- // admin check requires login
- if ($expects === 'isAdminUser') {
- $isLoggedIn = true;
- $isAdminUser = !$shouldFail;
- } else {
- $isLoggedIn = !$shouldFail;
- $isAdminUser = false;
- }
- $sec = $this->getMiddleware($isLoggedIn, $isAdminUser);
- if($shouldFail) {
- $this->expectException(SecurityException::class);
- } else {
- $this->addToAssertionCount(1);
- }
- $this->reader->reflect(__CLASS__, $method);
- $sec->beforeController($this->controller, $method);
- }
- /**
- * @PublicPage
- * @expectedException \OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryException
- */
- public function testCsrfCheck(){
- $this->request->expects($this->once())
- ->method('passesCSRFCheck')
- ->will($this->returnValue(false));
- $this->request->expects($this->once())
- ->method('passesStrictCookieCheck')
- ->will($this->returnValue(true));
- $this->reader->reflect(__CLASS__, __FUNCTION__);
- $this->middleware->beforeController($this->controller, __FUNCTION__);
- }
- /**
- * @PublicPage
- * @NoCSRFRequired
- */
- public function testNoCsrfCheck(){
- $this->request->expects($this->never())
- ->method('passesCSRFCheck')
- ->will($this->returnValue(false));
- $this->reader->reflect(__CLASS__, __FUNCTION__);
- $this->middleware->beforeController($this->controller, __FUNCTION__);
- }
- /**
- * @PublicPage
- */
- public function testPassesCsrfCheck(){
- $this->request->expects($this->once())
- ->method('passesCSRFCheck')
- ->will($this->returnValue(true));
- $this->request->expects($this->once())
- ->method('passesStrictCookieCheck')
- ->will($this->returnValue(true));
- $this->reader->reflect(__CLASS__, __FUNCTION__);
- $this->middleware->beforeController($this->controller, __FUNCTION__);
- }
- /**
- * @PublicPage
- * @expectedException \OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryException
- */
- public function testFailCsrfCheck(){
- $this->request->expects($this->once())
- ->method('passesCSRFCheck')
- ->will($this->returnValue(false));
- $this->request->expects($this->once())
- ->method('passesStrictCookieCheck')
- ->will($this->returnValue(true));
- $this->reader->reflect(__CLASS__, __FUNCTION__);
- $this->middleware->beforeController($this->controller, __FUNCTION__);
- }
- /**
- * @PublicPage
- * @StrictCookieRequired
- * @expectedException \OC\Appframework\Middleware\Security\Exceptions\StrictCookieMissingException
- */
- public function testStrictCookieRequiredCheck() {
- $this->request->expects($this->never())
- ->method('passesCSRFCheck');
- $this->request->expects($this->once())
- ->method('passesStrictCookieCheck')
- ->will($this->returnValue(false));
- $this->reader->reflect(__CLASS__, __FUNCTION__);
- $this->middleware->beforeController($this->controller, __FUNCTION__);
- }
- /**
- * @PublicPage
- * @NoCSRFRequired
- */
- public function testNoStrictCookieRequiredCheck() {
- $this->request->expects($this->never())
- ->method('passesStrictCookieCheck')
- ->will($this->returnValue(false));
- $this->reader->reflect(__CLASS__, __FUNCTION__);
- $this->middleware->beforeController($this->controller, __FUNCTION__);
- }
- /**
- * @PublicPage
- * @NoCSRFRequired
- * @StrictCookieRequired
- */
- public function testPassesStrictCookieRequiredCheck() {
- $this->request
- ->expects($this->once())
- ->method('passesStrictCookieCheck')
- ->willReturn(true);
- $this->reader->reflect(__CLASS__, __FUNCTION__);
- $this->middleware->beforeController($this->controller, __FUNCTION__);
- }
- public function dataCsrfOcsController() {
- $controller = $this->getMockBuilder('OCP\AppFramework\Controller')
- ->disableOriginalConstructor()
- ->getMock();
- $ocsController = $this->getMockBuilder('OCP\AppFramework\OCSController')
- ->disableOriginalConstructor()
- ->getMock();
- return [
- [$controller, false, false, true],
- [$controller, false, true, true],
- [$controller, true, false, true],
- [$controller, true, true, true],
- [$ocsController, false, false, true],
- [$ocsController, false, true, false],
- [$ocsController, true, false, false],
- [$ocsController, true, true, false],
- ];
- }
- /**
- * @dataProvider dataCsrfOcsController
- * @param Controller $controller
- * @param bool $hasOcsApiHeader
- * @param bool $hasBearerAuth
- * @param bool $exception
- */
- public function testCsrfOcsController(Controller $controller, bool $hasOcsApiHeader, bool $hasBearerAuth, bool $exception) {
- $this->request
- ->method('getHeader')
- ->will(self::returnCallback(function ($header) use ($hasOcsApiHeader, $hasBearerAuth) {
- if ($header === 'OCS-APIREQUEST' && $hasOcsApiHeader) {
- return 'true';
- }
- if ($header === 'Authorization' && $hasBearerAuth) {
- return 'Bearer TOKEN!';
- }
- return '';
- }));
- $this->request->expects($this->once())
- ->method('passesStrictCookieCheck')
- ->willReturn(true);
- try {
- $this->middleware->beforeController($controller, 'foo');
- $this->assertFalse($exception);
- } catch (CrossSiteRequestForgeryException $e) {
- $this->assertTrue($exception);
- }
- }
- /**
- * @NoCSRFRequired
- * @NoAdminRequired
- */
- public function testLoggedInCheck(){
- $this->securityCheck(__FUNCTION__, 'isLoggedIn');
- }
- /**
- * @NoCSRFRequired
- * @NoAdminRequired
- */
- public function testFailLoggedInCheck(){
- $this->securityCheck(__FUNCTION__, 'isLoggedIn', true);
- }
- /**
- * @NoCSRFRequired
- */
- public function testIsAdminCheck(){
- $this->securityCheck(__FUNCTION__, 'isAdminUser');
- }
- /**
- * @NoCSRFRequired
- */
- public function testFailIsAdminCheck(){
- $this->securityCheck(__FUNCTION__, 'isAdminUser', true);
- }
- public function testAfterExceptionNotCaughtThrowsItAgain(){
- $ex = new \Exception();
- $this->expectException(\Exception::class);
- $this->middleware->afterException($this->controller, 'test', $ex);
- }
- public function testAfterExceptionReturnsRedirectForNotLoggedInUser() {
- $this->request = new Request(
- [
- 'server' =>
- [
- 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'REQUEST_URI' => 'nextcloud/index.php/apps/specialapp'
- ]
- ],
- $this->createMock(ISecureRandom::class),
- $this->createMock(IConfig::class)
- );
- $this->middleware = $this->getMiddleware(false, false);
- $this->urlGenerator
- ->expects($this->once())
- ->method('linkToRoute')
- ->with(
- 'core.login.showLoginForm',
- [
- 'redirect_url' => 'nextcloud/index.php/apps/specialapp',
- ]
- )
- ->will($this->returnValue('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp'));
- $this->logger
- ->expects($this->once())
- ->method('logException');
- $response = $this->middleware->afterException(
- $this->controller,
- 'test',
- new NotLoggedInException()
- );
- $expected = new RedirectResponse('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp');
- $this->assertEquals($expected , $response);
- }
- public function testAfterExceptionRedirectsToWebRootAfterStrictCookieFail() {
- $this->request = new Request(
- [
- 'server' => [
- 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'REQUEST_URI' => 'nextcloud/index.php/apps/specialapp',
- ],
- ],
- $this->createMock(ISecureRandom::class),
- $this->createMock(IConfig::class)
- );
- $this->middleware = $this->getMiddleware(false, false);
- $response = $this->middleware->afterException(
- $this->controller,
- 'test',
- new StrictCookieMissingException()
- );
- $expected = new RedirectResponse(\OC::$WEBROOT);
- $this->assertEquals($expected , $response);
- }
- /**
- * @return array
- */
- public function exceptionProvider() {
- return [
- [
- new AppNotEnabledException(),
- ],
- [
- new CrossSiteRequestForgeryException(),
- ],
- [
- new NotAdminException(''),
- ],
- ];
- }
- /**
- * @dataProvider exceptionProvider
- * @param SecurityException $exception
- */
- public function testAfterExceptionReturnsTemplateResponse(SecurityException $exception) {
- $this->request = new Request(
- [
- 'server' =>
- [
- 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'REQUEST_URI' => 'nextcloud/index.php/apps/specialapp'
- ]
- ],
- $this->createMock(ISecureRandom::class),
- $this->createMock(IConfig::class)
- );
- $this->middleware = $this->getMiddleware(false, false);
- $this->logger
- ->expects($this->once())
- ->method('logException');
- $response = $this->middleware->afterException(
- $this->controller,
- 'test',
- $exception
- );
- $expected = new TemplateResponse('core', '403', ['message' => $exception->getMessage()], 'guest');
- $expected->setStatus($exception->getCode());
- $this->assertEquals($expected , $response);
- }
- public function testAfterAjaxExceptionReturnsJSONError(){
- $response = $this->middleware->afterException($this->controller, 'test',
- $this->secAjaxException);
- $this->assertTrue($response instanceof JSONResponse);
- }
- public function testAfterController() {
- $this->cspNonceManager
- ->expects($this->once())
- ->method('browserSupportsCspV3')
- ->willReturn(false);
- $response = $this->createMock(Response::class);
- $defaultPolicy = new ContentSecurityPolicy();
- $defaultPolicy->addAllowedImageDomain('defaultpolicy');
- $currentPolicy = new ContentSecurityPolicy();
- $currentPolicy->addAllowedConnectDomain('currentPolicy');
- $mergedPolicy = new ContentSecurityPolicy();
- $mergedPolicy->addAllowedMediaDomain('mergedPolicy');
- $response
- ->expects($this->exactly(2))
- ->method('getContentSecurityPolicy')
- ->willReturn($currentPolicy);
- $this->contentSecurityPolicyManager
- ->expects($this->once())
- ->method('getDefaultPolicy')
- ->willReturn($defaultPolicy);
- $this->contentSecurityPolicyManager
- ->expects($this->once())
- ->method('mergePolicies')
- ->with($defaultPolicy, $currentPolicy)
- ->willReturn($mergedPolicy);
- $response->expects($this->once())
- ->method('setContentSecurityPolicy')
- ->with($mergedPolicy);
- $this->middleware->afterController($this->controller, 'test', $response);
- }
- public function testAfterControllerEmptyCSP() {
- $response = $this->createMock(Response::class);
- $emptyPolicy = new EmptyContentSecurityPolicy();
- $response->expects($this->any())
- ->method('getContentSecurityPolicy')
- ->willReturn($emptyPolicy);
- $response->expects($this->never())
- ->method('setContentSecurityPolicy');
- $this->middleware->afterController($this->controller, 'test', $response);
- }
- public function testAfterControllerWithContentSecurityPolicy3Support() {
- $this->cspNonceManager
- ->expects($this->once())
- ->method('browserSupportsCspV3')
- ->willReturn(true);
- $token = $this->createMock(CsrfToken::class);
- $token
- ->expects($this->once())
- ->method('getEncryptedValue')
- ->willReturn('MyEncryptedToken');
- $this->csrfTokenManager
- ->expects($this->once())
- ->method('getToken')
- ->willReturn($token);
- $response = $this->createMock(Response::class);
- $defaultPolicy = new ContentSecurityPolicy();
- $defaultPolicy->addAllowedImageDomain('defaultpolicy');
- $currentPolicy = new ContentSecurityPolicy();
- $currentPolicy->addAllowedConnectDomain('currentPolicy');
- $mergedPolicy = new ContentSecurityPolicy();
- $mergedPolicy->addAllowedMediaDomain('mergedPolicy');
- $response
- ->expects($this->exactly(2))
- ->method('getContentSecurityPolicy')
- ->willReturn($currentPolicy);
- $this->contentSecurityPolicyManager
- ->expects($this->once())
- ->method('getDefaultPolicy')
- ->willReturn($defaultPolicy);
- $this->contentSecurityPolicyManager
- ->expects($this->once())
- ->method('mergePolicies')
- ->with($defaultPolicy, $currentPolicy)
- ->willReturn($mergedPolicy);
- $response->expects($this->once())
- ->method('setContentSecurityPolicy')
- ->with($mergedPolicy);
- $this->assertEquals($response, $this->middleware->afterController($this->controller, 'test', $response));
- }
- public function dataRestrictedApp() {
- return [
- [false, false, false,],
- [false, false, true,],
- [false, true, false,],
- [false, true, true,],
- [ true, false, false,],
- [ true, false, true,],
- [ true, true, false,],
- [ true, true, true,],
- ];
- }
- /**
- * @PublicPage
- * @NoAdminRequired
- * @NoCSRFRequired
- */
- public function testRestrictedAppLoggedInPublicPage() {
- $middleware = $this->getMiddleware(true, false);
- $this->reader->reflect(__CLASS__,__FUNCTION__);
- $this->appManager->method('getAppPath')
- ->with('files')
- ->willReturn('foo');
- $this->appManager->method('isEnabledForUser')
- ->with('files')
- ->willReturn(false);
- $middleware->beforeController($this->controller, __FUNCTION__);
- $this->addToAssertionCount(1);
- }
- /**
- * @PublicPage
- * @NoAdminRequired
- * @NoCSRFRequired
- */
- public function testRestrictedAppNotLoggedInPublicPage() {
- $middleware = $this->getMiddleware(false, false);
- $this->reader->reflect(__CLASS__,__FUNCTION__);
- $this->appManager->method('getAppPath')
- ->with('files')
- ->willReturn('foo');
- $this->appManager->method('isEnabledForUser')
- ->with('files')
- ->willReturn(false);
- $middleware->beforeController($this->controller, __FUNCTION__);
- $this->addToAssertionCount(1);
- }
- /**
- * @NoAdminRequired
- * @NoCSRFRequired
- */
- public function testRestrictedAppLoggedIn() {
- $middleware = $this->getMiddleware(true, false, false);
- $this->reader->reflect(__CLASS__,__FUNCTION__);
- $this->appManager->method('getAppPath')
- ->with('files')
- ->willReturn('foo');
- $this->expectException(AppNotEnabledException::class);
- $middleware->beforeController($this->controller, __FUNCTION__);
- }
- }
|