diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 15:27:18 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 15:27:18 +0100 |
commit | 3a7cf40aaa678bea1df143d2982d603b7a334eec (patch) | |
tree | 63c1e3ad7f7f401d14411a4d44c523632906afc9 /apps/files_sharing/tests/Middleware | |
parent | 0568b012672d650c6b5a49e72c4028dde5463c60 (diff) | |
download | nextcloud-server-3a7cf40aaa678bea1df143d2982d603b7a334eec.tar.gz nextcloud-server-3a7cf40aaa678bea1df143d2982d603b7a334eec.zip |
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_sharing/tests/Middleware')
3 files changed, 10 insertions, 10 deletions
diff --git a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php index 06d33859a28..31ca88cc4fc 100644 --- a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php @@ -44,7 +44,7 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase { /** @var OCSShareAPIMiddleware */ private $middleware; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->shareManager = $this->createMock(IManager::class); diff --git a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php index e6744d5fd1d..db698d94f11 100644 --- a/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/ShareInfoMiddlewareTest.php @@ -41,7 +41,7 @@ class ShareInfoMiddlewareTest extends TestCase { /** @var ShareInfoMiddleware */ private $middleware; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->shareManager = $this->createMock(ShareManager::class); diff --git a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php index e3fb602acd6..7a2baba16e0 100644 --- a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php @@ -198,11 +198,11 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { $this->sharingCheckMiddleware->beforeController($controller, 'myMethod'); } - /** - * @expectedException \OCP\Files\NotFoundException - * @expectedExceptionMessage Sharing is disabled. - */ + public function testBeforeControllerWithSharingDisabled() { + $this->expectException(\OCP\Files\NotFoundException::class); + $this->expectExceptionMessage('Sharing is disabled.'); + $this->appManager ->expects($this->once()) ->method('isEnabledForUser') @@ -212,11 +212,11 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { $this->sharingCheckMiddleware->beforeController($this->controllerMock, 'myMethod'); } - /** - * @expectedException \Exception - * @expectedExceptionMessage My Exception message - */ + public function testAfterExceptionWithRegularException() { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('My Exception message'); + $this->sharingCheckMiddleware->afterException($this->controllerMock, 'myMethod', new \Exception('My Exception message')); } |