summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-05-15 11:32:25 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2018-05-15 11:32:25 +0200
commit991d9b5c3acb21b65aed9c52c4b18c47ff1951e2 (patch)
tree61ecd0b0142eb4067529f063a70f57940b44f2d6 /tests
parent466297829e978f03421f5e34a4b2c7213332163c (diff)
downloadnextcloud-server-991d9b5c3acb21b65aed9c52c4b18c47ff1951e2.tar.gz
nextcloud-server-991d9b5c3acb21b65aed9c52c4b18c47ff1951e2.zip
Fix session tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/User/SessionTest.php13
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);
}