Browse Source

use two tests instead of one

remotes/origin/fix-10825
Bernhard Posselt 11 years ago
parent
commit
8689fe1a2e
  1. 22
      tests/lib/user/session.php

22
tests/lib/user/session.php

@ -39,7 +39,7 @@ class Session extends \Test\TestCase {
$session->expects($this->once())
->method('get')
->with('user_id')
->will($this->returnValue(null));
->will($this->returnValue('foo'));
$backend = $this->getMock('OC_User_Dummy');
$backend->expects($this->once())
@ -52,14 +52,28 @@ class Session extends \Test\TestCase {
$userSession = new \OC\User\Session($manager, $session);
$isLoggedIn = $userSession->isLoggedIn();
$this->assertFalse($isLoggedIn);
$this->assertTrue($isLoggedIn);
}
public function testNotLoggedIn() {
$session = $this->getMock('\OC\Session\Memory', array(), array(''));
$session->expects($this->once())
->method('get')
->with('user_id')
->will($this->returnValue('foo'));
->will($this->returnValue(null));
$backend = $this->getMock('OC_User_Dummy');
$backend->expects($this->once())
->method('userExists')
->with('foo')
->will($this->returnValue(true));
$manager = new \OC\User\Manager();
$manager->registerBackend($backend);
$userSession = new \OC\User\Session($manager, $session);
$isLoggedIn = $userSession->isLoggedIn();
$this->assertTrue($isLoggedIn);
$this->assertFalse($isLoggedIn);
}
public function testSetUser() {

Loading…
Cancel
Save