use two tests instead of one
This commit is contained in:
parent
236632702c
commit
0939c3147e
1 changed files with 21 additions and 7 deletions
|
@ -35,6 +35,27 @@ class Session extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testIsLoggedIn() {
|
||||
$session = $this->getMock('\OC\Session\Memory', array(), array(''));
|
||||
$session->expects($this->once())
|
||||
->method('get')
|
||||
->with('user_id')
|
||||
->will($this->returnValue('foo'));
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
public function testNotLoggedIn() {
|
||||
$session = $this->getMock('\OC\Session\Memory', array(), array(''));
|
||||
$session->expects($this->once())
|
||||
->method('get')
|
||||
|
@ -53,13 +74,6 @@ class Session extends \Test\TestCase {
|
|||
$userSession = new \OC\User\Session($manager, $session);
|
||||
$isLoggedIn = $userSession->isLoggedIn();
|
||||
$this->assertFalse($isLoggedIn);
|
||||
|
||||
$session->expects($this->once())
|
||||
->method('get')
|
||||
->with('user_id')
|
||||
->will($this->returnValue('foo'));
|
||||
$isLoggedIn = $userSession->isLoggedIn();
|
||||
$this->assertTrue($isLoggedIn);
|
||||
}
|
||||
|
||||
public function testSetUser() {
|
||||
|
|
Loading…
Reference in a new issue