diff options
Diffstat (limited to 'tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php')
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index 00bb1a0bb3c..ae0e6ff484d 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -77,7 +77,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */ private $l10n; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->controller = $this->createMock(Controller::class); @@ -256,9 +256,10 @@ class SecurityMiddlewareTest extends \Test\TestCase { /** * @PublicPage - * @expectedException \OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryException */ public function testCsrfCheck(){ + $this->expectException(\OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryException::class); + $this->request->expects($this->once()) ->method('passesCSRFCheck') ->will($this->returnValue(false)); @@ -300,9 +301,10 @@ class SecurityMiddlewareTest extends \Test\TestCase { /** * @PublicPage - * @expectedException \OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryException */ public function testFailCsrfCheck(){ + $this->expectException(\OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryException::class); + $this->request->expects($this->once()) ->method('passesCSRFCheck') ->will($this->returnValue(false)); @@ -317,9 +319,10 @@ class SecurityMiddlewareTest extends \Test\TestCase { /** * @PublicPage * @StrictCookieRequired - * @expectedException \OC\Appframework\Middleware\Security\Exceptions\StrictCookieMissingException */ public function testStrictCookieRequiredCheck() { + $this->expectException(\OC\Appframework\Middleware\Security\Exceptions\StrictCookieMissingException::class); + $this->request->expects($this->never()) ->method('passesCSRFCheck'); $this->request->expects($this->once()) |