use two tests instead of one

This commit is contained in:
Bernhard Posselt 2014-12-16 20:01:49 +01:00
parent 236632702c
commit 0939c3147e

View file

@ -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() {