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