diff options
Diffstat (limited to 'apps/user_ldap/tests/user_ldap.php')
-rw-r--r-- | apps/user_ldap/tests/user_ldap.php | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/apps/user_ldap/tests/user_ldap.php b/apps/user_ldap/tests/user_ldap.php index c89edc33fa9..33cec0247b6 100644 --- a/apps/user_ldap/tests/user_ldap.php +++ b/apps/user_ldap/tests/user_ldap.php @@ -27,11 +27,13 @@ use \OCA\user_ldap\lib\Access; use \OCA\user_ldap\lib\Connection; use \OCA\user_ldap\lib\ILDAPWrapper; -class Test_User_Ldap_Direct extends \PHPUnit_Framework_TestCase { +class Test_User_Ldap_Direct extends \Test\TestCase { protected $backend; protected $access; - public function setUp() { + protected function setUp() { + parent::setUp(); + \OC_User::clearBackends(); \OC_Group::clearBackends(); } @@ -550,23 +552,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 +565,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); |