diff options
Diffstat (limited to 'tests/lib/User/SessionTest.php')
-rw-r--r-- | tests/lib/User/SessionTest.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index 9a5a45c46c5..24677b57dd6 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -581,6 +581,8 @@ class SessionTest extends \Test\TestCase { $tokenObject->expects($this->once()) ->method('getLoginName') ->willReturn('foobar'); + $tokenObject->method('getId') + ->willReturn(42); $this->tokenProvider->expects($this->once()) ->method('getToken') ->with($sessionId) @@ -593,15 +595,22 @@ class SessionTest extends \Test\TestCase { ->method('setMagicInCookie'); $user->expects($this->once()) ->method('updateLastLoginTimestamp'); - $session->expects($this->once()) + $setUID = false; + $session ->method('set') - ->with('user_id', 'foo'); + ->will($this->returnCallback(function ($k, $v) use (&$setUID) { + if ($k === 'user_id' && $v === 'foo') { + $setUID = true; + } + })); $userSession->expects($this->once()) ->method('setLoginName') ->willReturn('foobar'); $granted = $userSession->loginWithCookie('foo', $token, $oldSessionId); + $this->assertTrue($setUID); + $this->assertTrue($granted); } |