|
|
|
@ -550,23 +550,9 @@ class Test_User_Ldap_Direct extends \PHPUnit_Framework_TestCase { |
|
|
|
|
public function testCountUsers() { |
|
|
|
|
$access = $this->getAccessMock(); |
|
|
|
|
|
|
|
|
|
$access->connection->expects($this->once()) |
|
|
|
|
->method('__get') |
|
|
|
|
->will($this->returnCallback(function($name) { |
|
|
|
|
if($name === 'ldapLoginFilter') { |
|
|
|
|
return 'uid=%uid'; |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
$access->expects($this->once()) |
|
|
|
|
->method('countUsers') |
|
|
|
|
->will($this->returnCallback(function($filter, $a, $b, $c) { |
|
|
|
|
if($filter !== 'uid=*') { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return 5; |
|
|
|
|
})); |
|
|
|
|
->will($this->returnValue(5)); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($access); |
|
|
|
|
|
|
|
|
@ -577,23 +563,9 @@ class Test_User_Ldap_Direct extends \PHPUnit_Framework_TestCase { |
|
|
|
|
public function testCountUsersFailing() { |
|
|
|
|
$access = $this->getAccessMock(); |
|
|
|
|
|
|
|
|
|
$access->connection->expects($this->once()) |
|
|
|
|
->method('__get') |
|
|
|
|
->will($this->returnCallback(function($name) { |
|
|
|
|
if($name === 'ldapLoginFilter') { |
|
|
|
|
return 'invalidFilter'; |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
$access->expects($this->once()) |
|
|
|
|
->method('countUsers') |
|
|
|
|
->will($this->returnCallback(function($filter, $a, $b, $c) { |
|
|
|
|
if($filter !== 'uid=*') { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return 5; |
|
|
|
|
})); |
|
|
|
|
->will($this->returnValue(false)); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($access); |
|
|
|
|
|
|
|
|
|