summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests/Hooks
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-08-26 15:22:00 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2019-09-15 12:04:28 +0200
commit16d47b5928a4351aec444ad9a7f90a6e8d2a4676 (patch)
treef28c9118cdcf242e4d4a9f84dc7ce184e02be774 /apps/encryption/tests/Hooks
parent0a874c51af8dd6652c694f0545489af23d53771a (diff)
downloadnextcloud-server-16d47b5928a4351aec444ad9a7f90a6e8d2a4676.tar.gz
nextcloud-server-16d47b5928a4351aec444ad9a7f90a6e8d2a4676.zip
Fix wrongly mixed mock objects in encryption tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/encryption/tests/Hooks')
-rw-r--r--apps/encryption/tests/Hooks/UserHooksTest.php28
1 files changed, 12 insertions, 16 deletions
diff --git a/apps/encryption/tests/Hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php
index b14a1f6a559..2295b90625d 100644
--- a/apps/encryption/tests/Hooks/UserHooksTest.php
+++ b/apps/encryption/tests/Hooks/UserHooksTest.php
@@ -41,6 +41,7 @@ use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
/**
@@ -80,6 +81,10 @@ class UserHooksTest extends TestCase {
*/
private $userSessionMock;
/**
+ * @var MockObject|IUser
+ */
+ private $user;
+ /**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
private $cryptMock;
@@ -343,24 +348,15 @@ class UserHooksTest extends TestCase {
->disableOriginalConstructor()
->getMock();
- $this->userSessionMock = $this->getMockBuilder(IUserSession::class)
- ->disableOriginalConstructor()
- ->setMethods([
- 'isLoggedIn',
- 'getUID',
- 'login',
- 'logout',
- 'setUser',
- 'getUser',
- 'canChangePassword'
- ])
- ->getMock();
-
- $this->userSessionMock->expects($this->any())->method('getUID')->will($this->returnValue('testUser'));
+ $this->user = $this->createMock(IUser::class);
+ $this->user->expects($this->any())
+ ->method('getUID')
+ ->willReturn('testUser');
+ $this->userSessionMock = $this->createMock(IUserSession::class);
$this->userSessionMock->expects($this->any())
- ->method($this->anything())
- ->will($this->returnSelf());
+ ->method('getUser')
+ ->willReturn($this->user);
$utilMock = $this->getMockBuilder(Util::class)
->disableOriginalConstructor()