|
|
@ -61,10 +61,6 @@ class Session extends \PHPUnit_Framework_TestCase { |
|
|
|
$backend = $this->getMock('OC_User_Dummy'); |
|
|
|
$backend = $this->getMock('OC_User_Dummy'); |
|
|
|
|
|
|
|
|
|
|
|
$user = $this->getMock('\OC\User\User', array(), array('foo', $backend)); |
|
|
|
$user = $this->getMock('\OC\User\User', array(), array('foo', $backend)); |
|
|
|
$user->expects($this->once()) |
|
|
|
|
|
|
|
->method('checkPassword') |
|
|
|
|
|
|
|
->with('bar') |
|
|
|
|
|
|
|
->will($this->returnValue(true)); |
|
|
|
|
|
|
|
$user->expects($this->once()) |
|
|
|
$user->expects($this->once()) |
|
|
|
->method('isEnabled') |
|
|
|
->method('isEnabled') |
|
|
|
->will($this->returnValue(true)); |
|
|
|
->will($this->returnValue(true)); |
|
|
@ -73,8 +69,8 @@ class Session extends \PHPUnit_Framework_TestCase { |
|
|
|
->will($this->returnValue('foo')); |
|
|
|
->will($this->returnValue('foo')); |
|
|
|
|
|
|
|
|
|
|
|
$manager->expects($this->once()) |
|
|
|
$manager->expects($this->once()) |
|
|
|
->method('get') |
|
|
|
->method('checkPassword') |
|
|
|
->with('foo') |
|
|
|
->with('foo', 'bar') |
|
|
|
->will($this->returnValue($user)); |
|
|
|
->will($this->returnValue($user)); |
|
|
|
|
|
|
|
|
|
|
|
$userSession = new \OC\User\Session($manager, $session); |
|
|
|
$userSession = new \OC\User\Session($manager, $session); |
|
|
@ -92,17 +88,13 @@ class Session extends \PHPUnit_Framework_TestCase { |
|
|
|
$backend = $this->getMock('OC_User_Dummy'); |
|
|
|
$backend = $this->getMock('OC_User_Dummy'); |
|
|
|
|
|
|
|
|
|
|
|
$user = $this->getMock('\OC\User\User', array(), array('foo', $backend)); |
|
|
|
$user = $this->getMock('\OC\User\User', array(), array('foo', $backend)); |
|
|
|
$user->expects($this->once()) |
|
|
|
|
|
|
|
->method('checkPassword') |
|
|
|
|
|
|
|
->with('bar') |
|
|
|
|
|
|
|
->will($this->returnValue(true)); |
|
|
|
|
|
|
|
$user->expects($this->once()) |
|
|
|
$user->expects($this->once()) |
|
|
|
->method('isEnabled') |
|
|
|
->method('isEnabled') |
|
|
|
->will($this->returnValue(false)); |
|
|
|
->will($this->returnValue(false)); |
|
|
|
|
|
|
|
|
|
|
|
$manager->expects($this->once()) |
|
|
|
$manager->expects($this->once()) |
|
|
|
->method('get') |
|
|
|
->method('checkPassword') |
|
|
|
->with('foo') |
|
|
|
->with('foo', 'bar') |
|
|
|
->will($this->returnValue($user)); |
|
|
|
->will($this->returnValue($user)); |
|
|
|
|
|
|
|
|
|
|
|
$userSession = new \OC\User\Session($manager, $session); |
|
|
|
$userSession = new \OC\User\Session($manager, $session); |
|
|
@ -119,17 +111,13 @@ class Session extends \PHPUnit_Framework_TestCase { |
|
|
|
$backend = $this->getMock('OC_User_Dummy'); |
|
|
|
$backend = $this->getMock('OC_User_Dummy'); |
|
|
|
|
|
|
|
|
|
|
|
$user = $this->getMock('\OC\User\User', array(), array('foo', $backend)); |
|
|
|
$user = $this->getMock('\OC\User\User', array(), array('foo', $backend)); |
|
|
|
$user->expects($this->once()) |
|
|
|
|
|
|
|
->method('checkPassword') |
|
|
|
|
|
|
|
->with('bar') |
|
|
|
|
|
|
|
->will($this->returnValue(false)); |
|
|
|
|
|
|
|
$user->expects($this->never()) |
|
|
|
$user->expects($this->never()) |
|
|
|
->method('isEnabled'); |
|
|
|
->method('isEnabled'); |
|
|
|
|
|
|
|
|
|
|
|
$manager->expects($this->once()) |
|
|
|
$manager->expects($this->once()) |
|
|
|
->method('get') |
|
|
|
->method('checkPassword') |
|
|
|
->with('foo') |
|
|
|
->with('foo', 'bar') |
|
|
|
->will($this->returnValue($user)); |
|
|
|
->will($this->returnValue(false)); |
|
|
|
|
|
|
|
|
|
|
|
$userSession = new \OC\User\Session($manager, $session); |
|
|
|
$userSession = new \OC\User\Session($manager, $session); |
|
|
|
$userSession->login('foo', 'bar'); |
|
|
|
$userSession->login('foo', 'bar'); |
|
|
@ -145,9 +133,9 @@ class Session extends \PHPUnit_Framework_TestCase { |
|
|
|
$backend = $this->getMock('OC_User_Dummy'); |
|
|
|
$backend = $this->getMock('OC_User_Dummy'); |
|
|
|
|
|
|
|
|
|
|
|
$manager->expects($this->once()) |
|
|
|
$manager->expects($this->once()) |
|
|
|
->method('get') |
|
|
|
->method('checkPassword') |
|
|
|
->with('foo') |
|
|
|
->with('foo', 'bar') |
|
|
|
->will($this->returnValue(null)); |
|
|
|
->will($this->returnValue(false)); |
|
|
|
|
|
|
|
|
|
|
|
$userSession = new \OC\User\Session($manager, $session); |
|
|
|
$userSession = new \OC\User\Session($manager, $session); |
|
|
|
$userSession->login('foo', 'bar'); |
|
|
|
$userSession->login('foo', 'bar'); |
|
|
|