Move Access to PSR-4

This commit is contained in:
Joas Schilling 2016-05-12 16:42:57 +02:00
parent 02d5b75fb4
commit c807a26bd8
No known key found for this signature in database
GPG Key ID: 70A0B324C41C0946
14 changed files with 25 additions and 33 deletions

View File

@ -58,7 +58,7 @@ $userManager = new \OCA\User_LDAP\User\Manager(
\OC::$server->getDatabaseConnection(),
\OC::$server->getUserManager());
$access = new \OCA\user_ldap\lib\Access($con, $ldapWrapper, $userManager);
$access = new \OCA\User_LDAP\Access($con, $ldapWrapper, $userManager);
$wizard = new \OCA\User_LDAP\Wizard($configuration, $ldapWrapper, $access);

View File

@ -42,7 +42,7 @@ if(count($configPrefixes) === 1) {
\OC::$server->getUserManager()
);
$connector = new OCA\User_LDAP\Connection($ldapWrapper, $configPrefixes[0]);
$ldapAccess = new OCA\user_ldap\lib\Access($connector, $ldapWrapper, $userManager);
$ldapAccess = new OCA\User_LDAP\Access($connector, $ldapWrapper, $userManager);
$ldapAccess->setUserMapper(new OCA\User_LDAP\Mapping\UserMapping($dbc));
$ldapAccess->setGroupMapper(new OCA\User_LDAP\Mapping\GroupMapping($dbc));

View File

@ -35,11 +35,8 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
use OCA\User_LDAP\Connection;
use OCA\User_LDAP\ILDAPWrapper;
use OCA\User_LDAP\LDAPUtility;
use OCA\User_LDAP\User\IUserTools;
use OCA\User_LDAP\User\Manager;
use OCA\User_LDAP\User\OfflineUser;
@ -47,7 +44,7 @@ use OCA\User_LDAP\Mapping\AbstractMapping;
/**
* Class Access
* @package OCA\user_ldap\lib
* @package OCA\User_LDAP
*/
class Access extends LDAPUtility implements IUserTools {
/**

View File

@ -24,8 +24,6 @@
namespace OCA\User_LDAP;
use OCA\user_ldap\lib\Access;
abstract class BackendUtility {
protected $access;

View File

@ -34,7 +34,6 @@
namespace OCA\User_LDAP;
use OCA\user_ldap\lib\Access;
class Group_LDAP extends BackendUtility implements \OCP\GroupInterface {
protected $enabled = false;

View File

@ -28,7 +28,6 @@
namespace OCA\User_LDAP;
use OCA\user_ldap\lib\Access;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\Mapping\GroupMapping;

View File

@ -32,7 +32,6 @@
namespace OCA\User_LDAP;
use OC\User\NoUserException;
use OCA\user_ldap\lib\Access;
use OCA\User_LDAP\User\OfflineUser;
use OCA\User_LDAP\User\User;
use OCP\IConfig;
@ -45,7 +44,7 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
protected $ocConfig;
/**
* @param \OCA\user_ldap\lib\Access $access
* @param Access $access
* @param \OCP\IConfig $ocConfig
*/
public function __construct(Access $access, IConfig $ocConfig) {

View File

@ -32,7 +32,6 @@
namespace OCA\User_LDAP;
use OC\ServerNotAvailableException;
use OCA\user_ldap\lib\Access;
class Wizard extends LDAPUtility {
static protected $l;
@ -59,6 +58,7 @@ class Wizard extends LDAPUtility {
* Constructor
* @param Configuration $configuration an instance of Configuration
* @param ILDAPWrapper $ldap an instance of ILDAPWrapper
* @param Access $access
*/
public function __construct(Configuration $configuration, ILDAPWrapper $ldap, Access $access) {
parent::__construct($ldap);

View File

@ -27,8 +27,8 @@
namespace OCA\User_LDAP\Tests;
use OCA\User_LDAP\Group_LDAP as GroupLDAP;
use \OCA\user_ldap\lib\Access;
use \OCA\User_LDAP\Connection;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
/**
* Class GroupLDAPTest
@ -44,7 +44,7 @@ class GroupLDAPTest extends \Test\TestCase {
if(is_null($conMethods) || is_null($accMethods)) {
$conMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\user_ldap\lib\Access');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
}
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
$connector = $this->getMock('\OCA\User_LDAP\Connection',
@ -53,7 +53,7 @@ class GroupLDAPTest extends \Test\TestCase {
$um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
->disableOriginalConstructor()
->getMock();
$access = $this->getMock('\OCA\user_ldap\lib\Access',
$access = $this->getMock('\OCA\User_LDAP\Access',
$accMethods,
array($connector, $lw, $um));

View File

@ -56,7 +56,7 @@ class UserTest extends \Test\TestCase {
if(is_null($conMethods) || is_null($accMethods)) {
$conMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\user_ldap\lib\Access');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
//getConnection shall not be replaced
unset($accMethods[array_search('getConnection', $accMethods)]);
$umMethods = get_class_methods('\OCA\User_LDAP\User\Manager');
@ -70,7 +70,7 @@ class UserTest extends \Test\TestCase {
$umMethods, array($cfMock, $fsMock, $logMock, $avaMgr, $im, $dbc, $userMgr));
$connector = $this->getMock('\OCA\User_LDAP\Connection',
$conMethods, array($lw, null, null));
$access = $this->getMock('\OCA\user_ldap\lib\Access',
$access = $this->getMock('\OCA\User_LDAP\Access',
$accMethods, array($connector, $lw, $um));
return array($access, $connector);

View File

@ -28,7 +28,7 @@
namespace OCA\User_LDAP\Tests;
use OCA\User_LDAP\User_LDAP as UserLDAP;
use \OCA\user_ldap\lib\Access;
use \OCA\User_LDAP\Access;
use \OCA\User_LDAP\Connection;
/**
@ -57,7 +57,7 @@ class User_LDAPTest extends \Test\TestCase {
if(is_null($conMethods) || is_null($accMethods)) {
$conMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\user_ldap\lib\Access');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
unset($accMethods[array_search('getConnection', $accMethods)]);
$uMethods = get_class_methods('\OCA\User_LDAP\User\User');
unset($uMethods[array_search('getUsername', $uMethods)]);
@ -92,7 +92,7 @@ class User_LDAPTest 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));
@ -126,8 +126,8 @@ class User_LDAPTest 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) {
@ -295,7 +295,7 @@ class User_LDAPTest 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) {

View File

@ -28,7 +28,7 @@ namespace OCA\User_LDAP\tests;
use \OCA\User_LDAP\Wizard;
// use \OCA\User_LDAP\User_LDAP as UserLDAP;
// use \OCA\user_ldap\lib\Access;
// use \OCA\User_LDAP\Access;
// use \OCA\User_LDAP\Configuration;
// use \OCA\User_LDAP\ILDAPWrapper;
@ -61,7 +61,7 @@ class WizardTest extends \Test\TestCase {
if(is_null($confMethods)) {
$confMethods = get_class_methods('\OCA\User_LDAP\Configuration');
$connMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\user_ldap\lib\Access');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
}
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
$conf = $this->getMock('\OCA\User_LDAP\Configuration',
@ -73,7 +73,7 @@ class WizardTest extends \Test\TestCase {
$um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
->disableOriginalConstructor()
->getMock();
$access = $this->getMock('\OCA\user_ldap\lib\Access',
$access = $this->getMock('\OCA\User_LDAP\Access',
$accMethods, array($connector, $lw, $um));
return array(new Wizard($conf, $lw, $access), $conf, $lw, $access);

View File

@ -25,8 +25,8 @@
namespace OCA\user_ldap\tests;
use \OCA\user_ldap\lib\Access;
use \OCA\User_LDAP\Connection;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
/**
* Class Test_Access
@ -43,7 +43,7 @@ class Test_Access extends \Test\TestCase {
if(is_null($conMethods) || is_null($accMethods)) {
$conMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\user_ldap\lib\Access');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
$umMethods = get_class_methods('\OCA\User_LDAP\User\Manager');
}
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');

View File

@ -21,7 +21,7 @@
namespace OCA\user_ldap\tests\integration;
use OCA\user_ldap\lib\Access;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
use OCA\User_LDAP\LDAP;
use OCA\User_LDAP\User\Manager;