aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Core/Middleware
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-25 22:21:27 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-25 22:21:27 +0100
commit2ee65f177e4f7e09ad2287f14d564e7068d322fb (patch)
tree39075e87ea7927e20e8956824cb7c49bf626b178 /tests/Core/Middleware
parent3cf321fdfc4235a87015a9af2f59c63220016c65 (diff)
downloadnextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.tar.gz
nextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.zip
Use the shorter phpunit syntax for mocked return values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/Core/Middleware')
-rw-r--r--tests/Core/Middleware/TwoFactorMiddlewareTest.php40
1 files changed, 20 insertions, 20 deletions
diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
index 2198cc7d5b4..ac3a5fbc017 100644
--- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php
+++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
@@ -100,10 +100,10 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->never())
->method('getUser');
@@ -115,7 +115,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession->expects($this->never())
->method('isLoggedIn');
@@ -147,17 +147,17 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
->with($user)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->middleware->beforeController($this->controller, 'index');
}
@@ -171,21 +171,21 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->reflector->expects($this->once())
->method('hasAnnotation')
->with('PublicPage')
- ->will($this->returnValue(false));
+ ->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession->expects($this->once())
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->twoFactorManager->expects($this->once())
->method('needsSecondFactor')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->middleware->beforeController($this->controller, 'index');
}
@@ -201,18 +201,18 @@ class TwoFactorMiddlewareTest extends TestCase {
->willReturn(false);
$this->userSession->expects($this->once())
->method('isLoggedIn')
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->userSession
->method('getUser')
- ->will($this->returnValue($user));
+ ->willReturn($user);
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
->with($user)
- ->will($this->returnValue(true));
+ ->willReturn(true);
$this->twoFactorManager->expects($this->once())
->method('needsSecondFactor')
->with($user)
- ->will($this->returnValue(false));
+ ->willReturn(false);
$twoFactorChallengeController = $this->getMockBuilder('\OC\Core\Controller\TwoFactorChallengeController')
->disableOriginalConstructor()
@@ -226,7 +226,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('core.TwoFactorChallenge.selectChallenge')
- ->will($this->returnValue('test/url'));
+ ->willReturn('test/url');
$expected = new \OCP\AppFramework\Http\RedirectResponse('test/url');
$this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex));
@@ -238,7 +238,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('files.view.index')
- ->will($this->returnValue('redirect/url'));
+ ->willReturn('redirect/url');
$expected = new \OCP\AppFramework\Http\RedirectResponse('redirect/url');
$this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex));
@@ -249,9 +249,9 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->reflector
->method('hasAnnotation')
- ->will($this->returnCallback(function (string $annotation) {
+ ->willReturnCallback(function (string $annotation) {
return $annotation === 'TwoFactorSetUpDoneRequired';
- }));
+ });
$this->userSession->expects($this->once())
->method('isLoggedIn')
->willReturn(true);