Fix tests

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-01-05 12:16:50 +01:00
parent 5339d216e3
commit 1179471e41
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 13 additions and 1 deletions

View File

@ -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);