summaryrefslogtreecommitdiffstats
path: root/tests/lib/user
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@owncloud.com>2016-05-06 16:31:40 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-05-11 13:36:46 +0200
commit46bdf6ea2b1e10c2f4d2fae214ecc81b188fa981 (patch)
tree56c5fb779556bea6489463a315affa6726d81655 /tests/lib/user
parent3ffa7d986a3bb2a67ae37e017f3e34097774cbf2 (diff)
downloadnextcloud-server-46bdf6ea2b1e10c2f4d2fae214ecc81b188fa981.tar.gz
nextcloud-server-46bdf6ea2b1e10c2f4d2fae214ecc81b188fa981.zip
fix PHPDoc and other minor issues
Diffstat (limited to 'tests/lib/user')
-rw-r--r--tests/lib/user/session.php27
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/lib/user/session.php b/tests/lib/user/session.php
index bbbe5e0c796..c6ddeb416fb 100644
--- a/tests/lib/user/session.php
+++ b/tests/lib/user/session.php
@@ -45,39 +45,43 @@ class Session extends \Test\TestCase {
->method('get')
->with('user_id')
->will($this->returnValue($expectedUser->getUID()));
+ $sessionId = 'abcdef12345';
$manager = $this->getMockBuilder('\OC\User\Manager')
->disableOriginalConstructor()
->getMock();
+ $session->expects($this->once())
+ ->method('getId')
+ ->will($this->returnValue($sessionId));
$this->defaultProvider->expects($this->once())
->method('getToken')
->will($this->returnValue($token));
- // TODO: check passed session id once it's mockable
- $session->expects($this->at(1))
- ->method('last_login_check')
+ $session->expects($this->at(2))
+ ->method('get')
+ ->with('last_login_check')
->will($this->returnValue(null)); // No check has been run yet
$this->defaultProvider->expects($this->once())
->method('getPassword')
- // TODO: check passed UID and session id once it's mockable
+ ->with($token, $sessionId)
->will($this->returnValue('password123'));
$manager->expects($this->once())
->method('checkPassword')
->with($expectedUser->getUID(), 'password123')
->will($this->returnValue(true));
- $session->expects($this->at(2))
+ $session->expects($this->at(3))
->method('set')
->with('last_login_check', 10000);
- $session->expects($this->at(3))
+ $session->expects($this->at(4))
->method('get')
->with('last_token_update')
->will($this->returnValue(null)); // No check run so far
$this->defaultProvider->expects($this->once())
->method('updateToken')
->with($token);
- $session->expects($this->at(4))
+ $session->expects($this->at(5))
->method('set')
- ->with('last_token_update', $this->equalTo(time(), 10));
+ ->with('last_token_update', $this->equalTo(10000));
$manager->expects($this->any())
->method('get')
@@ -171,7 +175,7 @@ class Session extends \Test\TestCase {
$backend = $this->getMock('\Test\Util\User\Dummy');
$user = $this->getMock('\OC\User\User', array(), array('foo', $backend));
- $user->expects($this->once())
+ $user->expects($this->any())
->method('isEnabled')
->will($this->returnValue(true));
$user->expects($this->any())
@@ -197,6 +201,9 @@ class Session extends \Test\TestCase {
$this->assertEquals($user, $userSession->getUser());
}
+ /**
+ * @expectedException \OC\User\LoginException
+ */
public function testLoginValidPasswordDisabled() {
$session = $this->getMock('\OC\Session\Memory', array(), array(''));
$session->expects($this->never())
@@ -219,7 +226,7 @@ class Session extends \Test\TestCase {
$backend = $this->getMock('\Test\Util\User\Dummy');
$user = $this->getMock('\OC\User\User', array(), array('foo', $backend));
- $user->expects($this->once())
+ $user->expects($this->any())
->method('isEnabled')
->will($this->returnValue(false));
$user->expects($this->never())