From c807a26bd843d899614d99ffa7f5d854429eecb4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 12 May 2016 16:42:57 +0200 Subject: [PATCH] Move Access to PSR-4 --- apps/user_ldap/ajax/wizard.php | 2 +- apps/user_ldap/appinfo/app.php | 2 +- apps/user_ldap/lib/{access.php => Access.php} | 7 ++----- apps/user_ldap/lib/BackendUtility.php | 2 -- apps/user_ldap/lib/Group_LDAP.php | 1 - apps/user_ldap/lib/Proxy.php | 1 - apps/user_ldap/lib/User_LDAP.php | 3 +-- apps/user_ldap/lib/Wizard.php | 2 +- apps/user_ldap/tests/GroupLDAPTest.php | 8 ++++---- apps/user_ldap/tests/User/UserTest.php | 4 ++-- apps/user_ldap/tests/User_LDAPTest.php | 12 ++++++------ apps/user_ldap/tests/WizardTest.php | 6 +++--- apps/user_ldap/tests/access.php | 6 +++--- .../tests/integration/abstractintegrationtest.php | 2 +- 14 files changed, 25 insertions(+), 33 deletions(-) rename apps/user_ldap/lib/{access.php => Access.php} (99%) diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php index 6a67e2a1fd0..656c9d51575 100644 --- a/apps/user_ldap/ajax/wizard.php +++ b/apps/user_ldap/ajax/wizard.php @@ -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); diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php index 98eb10080d7..a80088bdd20 100644 --- a/apps/user_ldap/appinfo/app.php +++ b/apps/user_ldap/appinfo/app.php @@ -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)); diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/Access.php similarity index 99% rename from apps/user_ldap/lib/access.php rename to apps/user_ldap/lib/Access.php index 025f5710862..8137deb023d 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/Access.php @@ -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 { /** diff --git a/apps/user_ldap/lib/BackendUtility.php b/apps/user_ldap/lib/BackendUtility.php index e00a0e8888a..fc4efe28924 100644 --- a/apps/user_ldap/lib/BackendUtility.php +++ b/apps/user_ldap/lib/BackendUtility.php @@ -24,8 +24,6 @@ namespace OCA\User_LDAP; -use OCA\user_ldap\lib\Access; - abstract class BackendUtility { protected $access; diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index d389610b641..39b2e9ff446 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -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; diff --git a/apps/user_ldap/lib/Proxy.php b/apps/user_ldap/lib/Proxy.php index d263e9a4383..ce1a67b29de 100644 --- a/apps/user_ldap/lib/Proxy.php +++ b/apps/user_ldap/lib/Proxy.php @@ -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; diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 185e522b529..1000f3ba530 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -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) { diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index c63bf903d82..f8c82a29701 100644 --- a/apps/user_ldap/lib/Wizard.php +++ b/apps/user_ldap/lib/Wizard.php @@ -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); diff --git a/apps/user_ldap/tests/GroupLDAPTest.php b/apps/user_ldap/tests/GroupLDAPTest.php index b8aa4ff5591..57c22f8bda1 100644 --- a/apps/user_ldap/tests/GroupLDAPTest.php +++ b/apps/user_ldap/tests/GroupLDAPTest.php @@ -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)); diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index 9d165c7f29e..12ebc7227a1 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -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); diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 748b8f83706..b4d346470d3 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -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) { diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php index d962e057911..d6ee5a473b2 100644 --- a/apps/user_ldap/tests/WizardTest.php +++ b/apps/user_ldap/tests/WizardTest.php @@ -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); diff --git a/apps/user_ldap/tests/access.php b/apps/user_ldap/tests/access.php index 1578e0ffad2..b1401b7c9bb 100644 --- a/apps/user_ldap/tests/access.php +++ b/apps/user_ldap/tests/access.php @@ -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'); diff --git a/apps/user_ldap/tests/integration/abstractintegrationtest.php b/apps/user_ldap/tests/integration/abstractintegrationtest.php index e5ecad75ba0..7b3d7b171c4 100644 --- a/apps/user_ldap/tests/integration/abstractintegrationtest.php +++ b/apps/user_ldap/tests/integration/abstractintegrationtest.php @@ -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; -- 2.39.5