|
|
|
@ -25,21 +25,20 @@ |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
namespace OCA\user_ldap\tests; |
|
|
|
|
namespace OCA\User_LDAP\Tests; |
|
|
|
|
|
|
|
|
|
use \OCA\user_ldap\USER_LDAP as UserLDAP; |
|
|
|
|
use \OCA\user_ldap\lib\Access; |
|
|
|
|
use \OCA\user_ldap\lib\Connection; |
|
|
|
|
use \OCA\user_ldap\lib\ILDAPWrapper; |
|
|
|
|
use OCA\User_LDAP\User_LDAP as UserLDAP; |
|
|
|
|
use \OCA\User_LDAP\Access; |
|
|
|
|
use \OCA\User_LDAP\Connection; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Class Test_User_Ldap_Direct |
|
|
|
|
* |
|
|
|
|
* @group DB |
|
|
|
|
* |
|
|
|
|
* @package OCA\user_ldap\tests |
|
|
|
|
* @package OCA\User_LDAP\Tests |
|
|
|
|
*/ |
|
|
|
|
class Test_User_Ldap_Direct extends \Test\TestCase { |
|
|
|
|
class User_LDAPTest extends \Test\TestCase { |
|
|
|
|
protected $backend; |
|
|
|
|
protected $access; |
|
|
|
|
protected $configMock; |
|
|
|
@ -57,31 +56,31 @@ class Test_User_Ldap_Direct extends \Test\TestCase { |
|
|
|
|
static $uMethods; |
|
|
|
|
|
|
|
|
|
if(is_null($conMethods) || is_null($accMethods)) { |
|
|
|
|
$conMethods = get_class_methods('\OCA\user_ldap\lib\Connection'); |
|
|
|
|
$accMethods = get_class_methods('\OCA\user_ldap\lib\Access'); |
|
|
|
|
$conMethods = get_class_methods('\OCA\User_LDAP\Connection'); |
|
|
|
|
$accMethods = get_class_methods('\OCA\User_LDAP\Access'); |
|
|
|
|
unset($accMethods[array_search('getConnection', $accMethods)]); |
|
|
|
|
$uMethods = get_class_methods('\OCA\user_ldap\lib\user\User'); |
|
|
|
|
$uMethods = get_class_methods('\OCA\User_LDAP\User\User'); |
|
|
|
|
unset($uMethods[array_search('getUsername', $uMethods)]); |
|
|
|
|
unset($uMethods[array_search('getDN', $uMethods)]); |
|
|
|
|
unset($uMethods[array_search('__construct', $uMethods)]); |
|
|
|
|
} |
|
|
|
|
$lw = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper'); |
|
|
|
|
$connector = $this->getMock('\OCA\user_ldap\lib\Connection', |
|
|
|
|
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper'); |
|
|
|
|
$connector = $this->getMock('\OCA\User_LDAP\Connection', |
|
|
|
|
$conMethods, |
|
|
|
|
array($lw, null, null)); |
|
|
|
|
|
|
|
|
|
$this->configMock = $this->getMock('\OCP\IConfig'); |
|
|
|
|
|
|
|
|
|
$offlineUser = $this->getMockBuilder('\OCA\user_ldap\lib\user\OfflineUser') |
|
|
|
|
$offlineUser = $this->getMockBuilder('\OCA\User_LDAP\User\OfflineUser') |
|
|
|
|
->disableOriginalConstructor() |
|
|
|
|
->getMock(); |
|
|
|
|
|
|
|
|
|
$um = $this->getMockBuilder('\OCA\user_ldap\lib\user\Manager') |
|
|
|
|
$um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager') |
|
|
|
|
->setMethods(['getDeletedUser']) |
|
|
|
|
->setConstructorArgs([ |
|
|
|
|
$this->configMock, |
|
|
|
|
$this->getMock('\OCA\user_ldap\lib\FilesystemHelper'), |
|
|
|
|
$this->getMock('\OCA\user_ldap\lib\LogWrapper'), |
|
|
|
|
$this->getMock('\OCA\User_LDAP\FilesystemHelper'), |
|
|
|
|
$this->getMock('\OCA\User_LDAP\LogWrapper'), |
|
|
|
|
$this->getMock('\OCP\IAvatarManager'), |
|
|
|
|
$this->getMock('\OCP\Image'), |
|
|
|
|
$this->getMock('\OCP\IDBConnection'), |
|
|
|
@ -93,7 +92,7 @@ class Test_User_Ldap_Direct extends \Test\TestCase { |
|
|
|
|
->method('getDeletedUser') |
|
|
|
|
->will($this->returnValue($offlineUser)); |
|
|
|
|
|
|
|
|
|
$access = $this->getMock('\OCA\user_ldap\lib\Access', |
|
|
|
|
$access = $this->getMock('\OCA\User_LDAP\Access', |
|
|
|
|
$accMethods, |
|
|
|
|
array($connector, $lw, $um)); |
|
|
|
|
|
|
|
|
@ -127,8 +126,8 @@ class Test_User_Ldap_Direct extends \Test\TestCase { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Prepares the Access mock for checkPassword tests |
|
|
|
|
* @param \OCA\user_ldap\lib\Access $access mock |
|
|
|
|
* @param bool noDisplayName |
|
|
|
|
* @param \OCA\User_LDAP\Access $access mock |
|
|
|
|
* @param bool $noDisplayName |
|
|
|
|
* @return void |
|
|
|
|
*/ |
|
|
|
|
private function prepareAccessForCheckPassword(&$access, $noDisplayName = false) { |
|
|
|
@ -296,7 +295,7 @@ class Test_User_Ldap_Direct extends \Test\TestCase { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Prepares the Access mock for getUsers tests |
|
|
|
|
* @param \OCA\user_ldap\lib\Access $access mock |
|
|
|
|
* @param \OCA\User_LDAP\Access $access mock |
|
|
|
|
* @return void |
|
|
|
|
*/ |
|
|
|
|
private function prepareAccessForGetUsers(&$access) { |