From 2ee65f177e4f7e09ad2287f14d564e7068d322fb Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 25 Mar 2020 22:21:27 +0100 Subject: Use the shorter phpunit syntax for mocked return values Signed-off-by: Christoph Wurst --- .../tests/Middleware/OCSShareAPIMiddlewareTest.php | 2 +- .../tests/Middleware/SharingCheckMiddlewareTest.php | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'apps/files_sharing/tests/Middleware') diff --git a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php index 927cdd8a053..e4d6cefac4f 100644 --- a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php @@ -51,7 +51,7 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase { $this->shareManager = $this->createMock(IManager::class); $this->l = $this->createMock(IL10N::class); - $this->l->method('t')->will($this->returnArgument(0)); + $this->l->method('t')->willReturnArgument(0); $this->middleware = new OCSShareAPIMiddleware($this->shareManager, $this->l); } diff --git a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php index 54db20c239e..4a6d3859b03 100644 --- a/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/SharingCheckMiddlewareTest.php @@ -83,7 +83,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { ->expects($this->once()) ->method('isEnabledForUser') ->with('files_sharing') - ->will($this->returnValue(true)); + ->willReturn(true); $this->assertTrue(self::invokePrivate($this->sharingCheckMiddleware, 'isSharingEnabled')); } @@ -93,7 +93,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { ->expects($this->once()) ->method('isEnabledForUser') ->with('files_sharing') - ->will($this->returnValue(false)); + ->willReturn(false); $this->assertFalse(self::invokePrivate($this->sharingCheckMiddleware, 'isSharingEnabled')); } @@ -142,11 +142,11 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { $this->reflector ->expects($this->atLeastOnce()) ->method('hasAnnotation') - ->will($this->returnValueMap($annotations)); + ->willReturnMap($annotations); $this->config ->method('getAppValue') - ->will($this->returnValueMap($config)); + ->willReturnMap($config); $this->assertEquals($expectedResult, self::invokePrivate($this->sharingCheckMiddleware, 'externalSharesChecks')); } @@ -159,16 +159,16 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { ->expects($this->once()) ->method('isEnabledForUser') ->with('files_sharing') - ->will($this->returnValue(true)); + ->willReturn(true); $this->reflector ->expects($this->atLeastOnce()) ->method('hasAnnotation') - ->will($this->returnValueMap($annotations)); + ->willReturnMap($annotations); $this->config ->method('getAppValue') - ->will($this->returnValueMap($config)); + ->willReturnMap($config); $controller = $this->createMock(ExternalSharesController::class); @@ -191,7 +191,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { ->expects($this->once()) ->method('isEnabledForUser') ->with('files_sharing') - ->will($this->returnValue(true)); + ->willReturn(true); $controller = $this->createMock(ShareController::class); @@ -207,7 +207,7 @@ class SharingCheckMiddlewareTest extends \Test\TestCase { ->expects($this->once()) ->method('isEnabledForUser') ->with('files_sharing') - ->will($this->returnValue(false)); + ->willReturn(false); $this->sharingCheckMiddleware->beforeController($this->controllerMock, 'myMethod'); } -- cgit v1.2.3