diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-12-16 20:01:49 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-12-17 17:40:52 +0100 |
commit | 0939c3147e24b91b0ac6087c4a9371372aa88d45 (patch) | |
tree | 77c88e1bde80a69b5cd89da26af1a4739661fc6a /tests | |
parent | 236632702cf7fe68cc9ad1dcfcc463e0d4c14d64 (diff) | |
download | nextcloud-server-0939c3147e24b91b0ac6087c4a9371372aa88d45.tar.gz nextcloud-server-0939c3147e24b91b0ac6087c4a9371372aa88d45.zip |
use two tests instead of one
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/user/session.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/lib/user/session.php b/tests/lib/user/session.php index d441f802087..fb263d876b8 100644 --- a/tests/lib/user/session.php +++ b/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() { |