From 6acfea61d0a1efd34040b45e7a3f985759125096 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 5 Jan 2017 12:16:50 +0100 Subject: [PATCH] Fix tests Signed-off-by: Joas Schilling --- tests/lib/User/SessionTest.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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);