summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-01-05 12:16:50 +0100
committerJoas Schilling <coding@schilljs.com>2017-01-05 15:16:24 +0100
commit1179471e41ce995a3edc1c310276d4d59945df99 (patch)
treefd39fbd7880c76932929e3a6f59f18031f288d18 /tests/lib
parent5339d216e3e4af4ec1c399bd7aedd2b790c48d31 (diff)
downloadnextcloud-server-1179471e41ce995a3edc1c310276d4d59945df99.tar.gz
nextcloud-server-1179471e41ce995a3edc1c310276d4d59945df99.zip
Fix tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/User/SessionTest.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php
index 27cb92d6732..51560d78a6a 100644
--- a/tests/lib/User/SessionTest.php
+++ b/tests/lib/User/SessionTest.php
@@ -528,7 +528,7 @@ class SessionTest extends \Test\TestCase {
->getMock();
$userSession = $this->getMockBuilder(Session::class)
//override, otherwise tests will fail because of setcookie()
- ->setMethods(['setMagicInCookie'])
+ ->setMethods(['setMagicInCookie', 'setLoginName'])
->setConstructorArgs([$manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random])
->getMock();
@@ -566,6 +566,15 @@ class SessionTest extends \Test\TestCase {
->with($oldSessionId, $sessionId)
->will($this->returnValue(true));
+ $tokenObject = $this->createMock(IToken::class);
+ $tokenObject->expects($this->once())
+ ->method('getLoginName')
+ ->willReturn('foobar');
+ $this->tokenProvider->expects($this->once())
+ ->method('getToken')
+ ->with($sessionId)
+ ->willReturn($tokenObject);
+
$user->expects($this->any())
->method('getUID')
->will($this->returnValue('foo'));
@@ -576,6 +585,9 @@ class SessionTest extends \Test\TestCase {
$session->expects($this->once())
->method('set')
->with('user_id', 'foo');
+ $userSession->expects($this->once())
+ ->method('setLoginName')
+ ->willReturn('foobar');
$granted = $userSession->loginWithCookie('foo', $token, $oldSessionId);