diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2020-04-09 16:53:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-09 16:53:09 +0300 |
commit | c56a273b39186c509c57ef6bec221d3c4e3d81d3 (patch) | |
tree | b2e4095e763874699646c2c90e41785c99b6f247 /apps/user_ldap | |
parent | f0dd71ccd266ede38114d25be035abb3f2661fc8 (diff) | |
parent | afbd9c4e6ed834e713039f2cff88ba3eec03dadb (diff) |
Merge pull request #20383 from nextcloud/techdebt/function-spacing
Unify function spacing to PSR2 recommendation
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/appinfo/app.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/lib/Access.php | 8 | ||||
-rw-r--r-- | apps/user_ldap/lib/AppInfo/Application.php | 6 | ||||
-rw-r--r-- | apps/user_ldap/lib/Group_LDAP.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/lib/Jobs/Sync.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/Jobs/UpdateGroups.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/lib/LDAP.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/User/Manager.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/User_LDAP.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/Wizard.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/tests/AccessTest.php | 6 | ||||
-rw-r--r-- | apps/user_ldap/tests/Group_LDAPTest.php | 24 | ||||
-rw-r--r-- | apps/user_ldap/tests/HelperTest.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/tests/Integration/AbstractIntegrationTest.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/tests/Jobs/SyncTest.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/tests/LDAPTest.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/tests/User/UserTest.php | 18 | ||||
-rw-r--r-- | apps/user_ldap/tests/User_LDAPTest.php | 74 | ||||
-rw-r--r-- | apps/user_ldap/tests/WizardTest.php | 24 |
19 files changed, 99 insertions, 99 deletions
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php index 2971bcfc3f8..3cbae3f4743 100644 --- a/apps/user_ldap/appinfo/app.php +++ b/apps/user_ldap/appinfo/app.php @@ -27,10 +27,10 @@ * */ -\OC::$server->registerService('LDAPUserPluginManager', function() { +\OC::$server->registerService('LDAPUserPluginManager', function () { return new OCA\User_LDAP\UserPluginManager(); }); -\OC::$server->registerService('LDAPGroupPluginManager', function() { +\OC::$server->registerService('LDAPGroupPluginManager', function () { return new OCA\User_LDAP\GroupPluginManager(); }); diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index e23aa6b4549..81e467cb639 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -919,7 +919,7 @@ class Access extends LDAPUtility { if(!$forceApplyAttributes) { $isBackgroundJobModeAjax = $this->config ->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax'; - $recordsToUpdate = array_filter($ldapRecords, function($record) use ($isBackgroundJobModeAjax) { + $recordsToUpdate = array_filter($ldapRecords, function ($record) use ($isBackgroundJobModeAjax) { $newlyMapped = false; $uid = $this->dn2ocname($record['dn'][0], null, true, $newlyMapped, $record); if(is_string($uid)) { @@ -940,7 +940,7 @@ class Access extends LDAPUtility { * @param array $ldapRecords * @throws \Exception */ - public function batchApplyUserAttributes(array $ldapRecords){ + public function batchApplyUserAttributes(array $ldapRecords) { $displayNameAttribute = strtolower($this->connection->ldapUserDisplayName); foreach($ldapRecords as $userRecord) { if(!isset($userRecord[$displayNameAttribute])) { @@ -973,7 +973,7 @@ class Access extends LDAPUtility { */ public function fetchListOfGroups($filter, $attr, $limit = null, $offset = null) { $groupRecords = $this->searchGroups($filter, $attr, $limit, $offset); - array_walk($groupRecords, function($record) { + array_walk($groupRecords, function ($record) { $newlyMapped = false; $gid = $this->dn2ocname($record['dn'][0], null, false, $newlyMapped, $record); if(!$newlyMapped && is_string($gid)) { @@ -993,7 +993,7 @@ class Access extends LDAPUtility { if($manyAttributes) { return $list; } else { - $list = array_reduce($list, function($carry, $item) { + $list = array_reduce($list, function ($carry, $item) { $attribute = array_keys($item)[0]; $carry[] = $item[$attribute][0]; return $carry; diff --git a/apps/user_ldap/lib/AppInfo/Application.php b/apps/user_ldap/lib/AppInfo/Application.php index 8e2ed30c396..ae8114d1705 100644 --- a/apps/user_ldap/lib/AppInfo/Application.php +++ b/apps/user_ldap/lib/AppInfo/Application.php @@ -35,14 +35,14 @@ use OCP\AppFramework\IAppContainer; use OCP\IL10N; class Application extends App { - public function __construct () { + public function __construct() { parent::__construct('user_ldap'); $container = $this->getContainer(); /** * Controller */ - $container->registerService('RenewPasswordController', function(IAppContainer $c) { + $container->registerService('RenewPasswordController', function (IAppContainer $c) { /** @var \OC\Server $server */ $server = $c->query('ServerContainer'); @@ -67,7 +67,7 @@ class Application extends App { $container->getServer()->getEventDispatcher()->addListener( 'OCA\\Files_External::loadAdditionalBackends', - function() use ($container) { + function () use ($container) { $storagesBackendService = $container->query(BackendService::class); $storagesBackendService->registerConfigHandler('home', function () use ($container) { return $container->query(ExtStorageConfigHandler::class); diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index a55a285dde3..c166ad5ebef 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -236,7 +236,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD $seen[$dnGroup] = 1; $members = $this->access->readAttribute($dnGroup, $this->access->connection->ldapGroupMemberAssocAttr); if (is_array($members)) { - $fetcher = function($memberDN, &$seen) { + $fetcher = function ($memberDN, &$seen) { return $this->_groupMembers($memberDN, $seen); }; $allMembers = $this->walkNestedGroups($dnGroup, $fetcher, $members); @@ -260,7 +260,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD return []; } - $fetcher = function($groupDN) { + $fetcher = function ($groupDN) { if (isset($this->cachedNestedGroups[$groupDN])) { $nestedGroups = $this->cachedNestedGroups[$groupDN]; } else { diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php index 02b50c83a66..e095ba41bef 100644 --- a/apps/user_ldap/lib/Jobs/Sync.php +++ b/apps/user_ldap/lib/Jobs/Sync.php @@ -103,7 +103,7 @@ class Sync extends TimedJob { */ protected function getMinPagingSize() { $configKeys = $this->config->getAppKeys('user_ldap'); - $configKeys = array_filter($configKeys, function($key) { + $configKeys = array_filter($configKeys, function ($key) { return strpos($key, 'ldap_paging_size') !== false; }); $minPagingSize = null; diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php index 35edaccc6a0..71a2ea8c69e 100644 --- a/apps/user_ldap/lib/Jobs/UpdateGroups.php +++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php @@ -50,14 +50,14 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob { static private $groupBE; - public function __construct(){ + public function __construct() { $this->interval = self::getRefreshInterval(); } /** * @param mixed $argument */ - public function run($argument){ + public function run($argument) { self::updateGroups(); } diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php index 7b6b5206202..f346272a18b 100644 --- a/apps/user_ldap/lib/LDAP.php +++ b/apps/user_ldap/lib/LDAP.php @@ -194,7 +194,7 @@ class LDAP implements ILDAPWrapper { * @throws \Exception */ public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0) { - $oldHandler = set_error_handler(function($no, $message, $file, $line) use (&$oldHandler) { + $oldHandler = set_error_handler(function ($no, $message, $file, $line) use (&$oldHandler) { if(strpos($message, 'Partial search results returned: Sizelimit exceeded') !== false) { return true; } diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php index d4d389ff760..3f3e8cd3be3 100644 --- a/apps/user_ldap/lib/User/Manager.php +++ b/apps/user_ldap/lib/User/Manager.php @@ -195,7 +195,7 @@ class Manager { } $attributes = array_reduce($attributes, - function($list, $attribute) { + function ($list, $attribute) { $attribute = strtolower(trim((string)$attribute)); if(!empty($attribute) && !in_array($attribute, $list)) { $list[] = $attribute; diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 917a2aaf84c..08b0464cc50 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -571,7 +571,7 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn * Backend name to be shown in user management * @return string the name of the backend to be shown */ - public function getBackendName(){ + public function getBackendName() { return 'LDAP'; } diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index 71000cf88c5..839578cd606 100644 --- a/apps/user_ldap/lib/Wizard.php +++ b/apps/user_ldap/lib/Wizard.php @@ -79,7 +79,7 @@ class Wizard extends LDAPUtility { $this->result = new WizardResult(); } - public function __destruct() { + public function __destruct() { if($this->result->hasChanges()) { $this->configuration->saveConfiguration(); } diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index 35d38b24920..a805f387086 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -538,7 +538,7 @@ class AccessTest extends TestCase { ->willReturn($fakeConnection); $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($key) use ($base) { + ->willReturnCallback(function ($key) use ($base) { if(stripos($key, 'base') !== false) { return $base; } @@ -616,7 +616,7 @@ class AccessTest extends TestCase { ]; $expected = $fakeLdapEntries; unset($expected['count']); - array_walk($expected, function(&$v) { + array_walk($expected, function (&$v) { $v['dn'] = [$v['dn']]; // dn is translated into an array internally for consistency }); @@ -628,7 +628,7 @@ class AccessTest extends TestCase { $this->userMapper->expects($this->exactly($fakeLdapEntries['count'])) ->method('getNameByDN') - ->willReturnCallback(function($fdn) { + ->willReturnCallback(function ($fdn) { $parts = ldap_explode_dn($fdn, false); return $parts[0]; }); diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php index fb5840f0ddb..a81255c10a9 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -88,7 +88,7 @@ class Group_LDAPTest extends TestCase { $access->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapDynamicGroupMemberURL') { return ''; } @@ -109,7 +109,7 @@ class Group_LDAPTest extends TestCase { $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn) use ($groupDN) { + ->willReturnCallback(function ($dn) use ($groupDN) { if($dn === $groupDN) { return [ 'uid=u11,ou=users,dc=foo,dc=bar', @@ -148,7 +148,7 @@ class Group_LDAPTest extends TestCase { $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { //the search operation will call readAttribute, thus we need //to anaylze the "dn". All other times we just need to return //something that is neither null or false, but once an array @@ -162,7 +162,7 @@ class Group_LDAPTest extends TestCase { $access->expects($this->any()) ->method('dn2username') - ->willReturnCallback(function() { + ->willReturnCallback(function () { return 'foobar' . \OC::$server->getSecureRandom()->generate(7); }); @@ -520,7 +520,7 @@ class Group_LDAPTest extends TestCase { ->willReturn(null); $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($attr === 'primaryGroupToken') { return [1337]; } else if($attr === 'gidNumber') { @@ -557,7 +557,7 @@ class Group_LDAPTest extends TestCase { ->willReturn(null); $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($attr === 'primaryGroupToken') { return [1337]; } @@ -593,7 +593,7 @@ class Group_LDAPTest extends TestCase { $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($attr === 'primaryGroupToken') { return [1337]; } @@ -654,7 +654,7 @@ class Group_LDAPTest extends TestCase { $access->connection = $this->createMock(Connection::class); $access->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'useMemberOfToDetectMembership') { return 0; } else if($name === 'ldapDynamicGroupMemberURL') { @@ -692,7 +692,7 @@ class Group_LDAPTest extends TestCase { $access->connection = $this->createMock(Connection::class); $access->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { switch($name) { case 'useMemberOfToDetectMembership': return 0; @@ -1030,7 +1030,7 @@ class Group_LDAPTest extends TestCase { $access = $this->getAccessMock(); $access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($group) use ($groupDN, $expectedMembers, $groupsInfo) { + ->willReturnCallback(function ($group) use ($groupDN, $expectedMembers, $groupsInfo) { if(isset($groupsInfo[$group])) { return $groupsInfo[$group]; } @@ -1041,7 +1041,7 @@ class Group_LDAPTest extends TestCase { if(count($groupsInfo) > 1) { $access->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapNestedGroups') { return 1; } @@ -1079,7 +1079,7 @@ class Group_LDAPTest extends TestCase { $access->connection = $this->createMock(Connection::class); $access->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapGroupMemberAssocAttr') { return 'member'; } else if($name === 'ldapGroupFilter') { diff --git a/apps/user_ldap/tests/HelperTest.php b/apps/user_ldap/tests/HelperTest.php index a803e5d284a..5aace2c5c91 100644 --- a/apps/user_ldap/tests/HelperTest.php +++ b/apps/user_ldap/tests/HelperTest.php @@ -67,7 +67,7 @@ class HelperTest extends \Test\TestCase { ]); $this->config->method('getAppValue') - ->willReturnCallback(function($app, $key, $default) { + ->willReturnCallback(function ($app, $key, $default) { if ($app !== 'user_ldap') { $this->fail('wrong app'); } @@ -93,7 +93,7 @@ class HelperTest extends \Test\TestCase { ]); $this->config->method('getAppValue') - ->willReturnCallback(function($app, $key, $default) { + ->willReturnCallback(function ($app, $key, $default) { if ($app !== 'user_ldap') { $this->fail('wrong app'); } diff --git a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php index a3c4dd364fe..77aeddf94f5 100644 --- a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php +++ b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php @@ -71,10 +71,10 @@ abstract class AbstractIntegrationTest { * the LDAP backend. */ public function init() { - \OC::$server->registerService('LDAPUserPluginManager', function() { + \OC::$server->registerService('LDAPUserPluginManager', function () { return new \OCA\User_LDAP\UserPluginManager(); }); - \OC::$server->registerService('LDAPGroupPluginManager', function() { + \OC::$server->registerService('LDAPGroupPluginManager', function () { return new \OCA\User_LDAP\GroupPluginManager(); }); diff --git a/apps/user_ldap/tests/Jobs/SyncTest.php b/apps/user_ldap/tests/Jobs/SyncTest.php index 8cab95fc801..1cdbefb289c 100644 --- a/apps/user_ldap/tests/Jobs/SyncTest.php +++ b/apps/user_ldap/tests/Jobs/SyncTest.php @@ -128,7 +128,7 @@ class SyncTest extends TestCase { $this->config->expects($this->once()) ->method('setAppValue') ->with('user_ldap', 'background_sync_interval', $this->anything()) - ->willReturnCallback(function($a, $k, $interval) { + ->willReturnCallback(function ($a, $k, $interval) { $this->assertTrue($interval >= SYNC::MIN_INTERVAL); $this->assertTrue($interval <= SYNC::MAX_INTERVAL); return true; @@ -294,7 +294,7 @@ class SyncTest extends TestCase { public function testRun($runData) { $this->config->expects($this->any()) ->method('getAppValue') - ->willReturnCallback(function($app, $key, $default) use ($runData) { + ->willReturnCallback(function ($app, $key, $default) use ($runData) { if($app === 'core' && $key === 'backgroundjobs_mode') { return 'cron'; } diff --git a/apps/user_ldap/tests/LDAPTest.php b/apps/user_ldap/tests/LDAPTest.php index 56ee04906b7..8dd7122b4e1 100644 --- a/apps/user_ldap/tests/LDAPTest.php +++ b/apps/user_ldap/tests/LDAPTest.php @@ -60,7 +60,7 @@ class LDAPTest extends TestCase { public function testSearchWithErrorHandler(string $errorMessage, bool $passThrough) { $wasErrorHandlerCalled = false; - $errorHandler = function($number, $message, $file, $line) use (&$wasErrorHandlerCalled) { + $errorHandler = function ($number, $message, $file, $line) use (&$wasErrorHandlerCalled) { $wasErrorHandlerCalled = true; }; @@ -70,7 +70,7 @@ class LDAPTest extends TestCase { ->expects($this->once()) ->method('invokeLDAPMethod') ->with('search', $this->anything(), $this->anything(), $this->anything(), $this->anything(), $this->anything()) - ->willReturnCallback(function() use($errorMessage) { + ->willReturnCallback(function () use ($errorMessage) { trigger_error($errorMessage); }); diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index 4e8dacaeda1..7453b31e338 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -606,7 +606,7 @@ class UserTest extends \Test\TestCase { public function XtestUpdateAvatarThumbnailPhotoProvided() { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($dn === $this->dn && $attr === 'jpegphoto') { @@ -671,7 +671,7 @@ class UserTest extends \Test\TestCase { public function testUpdateAvatarCorruptPhotoProvided() { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($dn === $this->dn && $attr === 'jpegphoto') { @@ -724,7 +724,7 @@ class UserTest extends \Test\TestCase { public function XtestUpdateAvatarUnsupportedThumbnailPhotoProvided() { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($dn === $this->dn && $attr === 'jpegphoto') { @@ -789,7 +789,7 @@ class UserTest extends \Test\TestCase { public function testUpdateAvatarNotProvided() { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { if($dn === $this->dn && $attr === 'jpegPhoto') { @@ -1038,7 +1038,7 @@ class UserTest extends \Test\TestCase { ]); $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'homeFolderNamingRule') { return 'attr:homeDirectory'; } @@ -1193,7 +1193,7 @@ class UserTest extends \Test\TestCase { public function testHandlePasswordExpiryWarningDefaultPolicy() { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapDefaultPPolicyDN') { return 'cn=default,ou=policies,dc=foo,dc=bar'; } @@ -1205,7 +1205,7 @@ class UserTest extends \Test\TestCase { $this->access->expects($this->any()) ->method('search') - ->willReturnCallback(function($filter, $base) { + ->willReturnCallback(function ($filter, $base) { if($base === [$this->dn]) { return [ [ @@ -1256,7 +1256,7 @@ class UserTest extends \Test\TestCase { public function testHandlePasswordExpiryWarningCustomPolicy() { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapDefaultPPolicyDN') { return 'cn=default,ou=policies,dc=foo,dc=bar'; } @@ -1268,7 +1268,7 @@ class UserTest extends \Test\TestCase { $this->access->expects($this->any()) ->method('search') - ->willReturnCallback(function($filter, $base) { + ->willReturnCallback(function ($filter, $base) { if($base === [$this->dn]) { return [ [ diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 3f0259692ac..8dc699f371b 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -108,7 +108,7 @@ class User_LDAPTest extends TestCase { private function prepareMockForUserExists() { $this->access->expects($this->any()) ->method('username2dn') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { switch ($uid) { case 'gunslinger': return 'dnOfRoland,dc=test'; @@ -139,7 +139,7 @@ class User_LDAPTest extends TestCase { private function prepareAccessForCheckPassword($noDisplayName = false) { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapLoginFilter') { return '%uid'; } @@ -148,7 +148,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('fetchListOfUsers') - ->willReturnCallback(function($filter) { + ->willReturnCallback(function ($filter) { if($filter === 'roland') { return [['dn' => ['dnOfRoland,dc=test']]]; } @@ -156,7 +156,7 @@ class User_LDAPTest extends TestCase { }); $this->access->expects($this->any()) ->method('fetchUsersByLoginName') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { if($uid === 'roland') { return [['dn' => ['dnOfRoland,dc=test']]]; } @@ -177,7 +177,7 @@ class User_LDAPTest extends TestCase { ->willReturn(true); $this->access->expects($this->any()) ->method('areCredentialsValid') - ->willReturnCallback(function($dn, $pwd) { + ->willReturnCallback(function ($dn, $pwd) { if($pwd === 'dt19') { return true; } @@ -363,22 +363,22 @@ class User_LDAPTest extends TestCase { private function prepareAccessForGetUsers() { $this->access->expects($this->once()) ->method('escapeFilterPart') - ->willReturnCallback(function($search) { + ->willReturnCallback(function ($search) { return $search; }); $this->access->expects($this->any()) ->method('getFilterPartForUserSearch') - ->willReturnCallback(function($search) { + ->willReturnCallback(function ($search) { return $search; }); $this->access->expects($this->any()) ->method('combineFilterWithAnd') - ->willReturnCallback(function($param) { + ->willReturnCallback(function ($param) { return $param[2]; }); $this->access->expects($this->any()) ->method('fetchListOfUsers') - ->willReturnCallback(function($search, $a, $l, $o) { + ->willReturnCallback(function ($search, $a, $l, $o) { $users = ['gunslinger', 'newyorker', 'ladyofshadows']; if(empty($search)) { $result = $users; @@ -444,7 +444,7 @@ class User_LDAPTest extends TestCase { private function getUsers($search = '', $limit = null, $offset = null) { $users = \OC::$server->getUserManager()->search($search, $limit, $offset); - $uids = array_map(function(IUser $user) { + $uids = array_map(function (IUser $user) { return $user->getUID(); }, $users); return $uids; @@ -544,7 +544,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn) { + ->willReturnCallback(function ($dn) { if($dn === 'dnOfRoland,dc=test') { return []; } @@ -569,7 +569,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn) { + ->willReturnCallback(function ($dn) { if($dn === 'dnOfRoland,dc=test') { return []; } @@ -601,7 +601,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'homeFolderNamingRule') { return 'attr:testAttribute'; } @@ -610,7 +610,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { switch ($dn) { case 'dnOfRoland,dc=test': if($attr === 'testAttribute') { @@ -653,7 +653,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'homeFolderNamingRule') { return 'attr:testAttribute'; } @@ -662,7 +662,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { switch ($dn) { case 'dnOfLadyOfShadows,dc=test': if($attr === 'testAttribute') { @@ -704,7 +704,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'homeFolderNamingRule') { return 'attr:testAttribute'; } @@ -712,7 +712,7 @@ class User_LDAPTest extends TestCase { }); $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { switch ($dn) { default: return false; @@ -720,7 +720,7 @@ class User_LDAPTest extends TestCase { }); $this->access->connection->expects($this->any()) ->method('getFromCache') - ->willReturnCallback(function($key) { + ->willReturnCallback(function ($key) { if($key === 'userExistsnewyorker') { return true; } @@ -752,7 +752,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'homeFolderNamingRule') { return 'attr:testAttribute'; } @@ -798,7 +798,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('getFromCache') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { return true; }); @@ -809,7 +809,7 @@ class User_LDAPTest extends TestCase { private function prepareAccessForGetDisplayName() { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapUserDisplayName') { return 'displayname'; } @@ -818,7 +818,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('readAttribute') - ->willReturnCallback(function($dn, $attr) { + ->willReturnCallback(function ($dn, $attr) { switch ($dn) { case 'dnOfRoland,dc=test': if($attr === 'displayname') { @@ -842,7 +842,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('getConnectionResource') - ->willReturnCallback(function() { + ->willReturnCallback(function () { return true; }); @@ -864,11 +864,11 @@ class User_LDAPTest extends TestCase { $mapper = $this->createMock(UserMapping::class); $mapper->expects($this->any()) ->method('getUUIDByDN') - ->willReturnCallback(function($dn) { return $dn; }); + ->willReturnCallback(function ($dn) { return $dn; }); $this->userManager->expects($this->any()) ->method('get') - ->willReturnCallback(function($uid) use ($user1, $user2) { + ->willReturnCallback(function ($uid) use ($user1, $user2) { if($uid === 'gunslinger') { return $user1; } else if($uid === 'newyorker') { @@ -881,7 +881,7 @@ class User_LDAPTest extends TestCase { ->willReturn($mapper); $this->access->expects($this->any()) ->method('getUserDnByUuid') - ->willReturnCallback(function($uuid) { return $uuid . '1'; }); + ->willReturnCallback(function ($uuid) { return $uuid . '1'; }); //with displayName $result = $backend->getDisplayName('gunslinger'); @@ -895,7 +895,7 @@ class User_LDAPTest extends TestCase { public function testGetDisplayNamePublicAPI() { $this->access->expects($this->any()) ->method('username2dn') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { switch ($uid) { case 'gunslinger': return 'dnOfRoland,dc=test'; @@ -919,7 +919,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('getConnectionResource') - ->willReturnCallback(function() { + ->willReturnCallback(function () { return true; }); @@ -943,11 +943,11 @@ class User_LDAPTest extends TestCase { $mapper = $this->createMock(UserMapping::class); $mapper->expects($this->any()) ->method('getUUIDByDN') - ->willReturnCallback(function($dn) { return $dn; }); + ->willReturnCallback(function ($dn) { return $dn; }); $this->userManager->expects($this->any()) ->method('get') - ->willReturnCallback(function($uid) use ($user1, $user2) { + ->willReturnCallback(function ($uid) use ($user1, $user2) { if($uid === 'gunslinger') { return $user1; } else if($uid === 'newyorker') { @@ -960,7 +960,7 @@ class User_LDAPTest extends TestCase { ->willReturn($mapper); $this->access->expects($this->any()) ->method('getUserDnByUuid') - ->willReturnCallback(function($uuid) { return $uuid . '1'; }); + ->willReturnCallback(function ($uuid) { return $uuid . '1'; }); //with displayName $result = \OC::$server->getUserManager()->get('gunslinger')->getDisplayName(); @@ -1135,7 +1135,7 @@ class User_LDAPTest extends TestCase { private function prepareAccessForSetPassword($enablePasswordChange = true) { $this->connection->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) use (&$enablePasswordChange) { + ->willReturnCallback(function ($name) use (&$enablePasswordChange) { if($name === 'ldapLoginFilter') { return '%uid'; } @@ -1146,7 +1146,7 @@ class User_LDAPTest extends TestCase { }); $this->connection->expects($this->any()) ->method('getFromCache') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { if($uid === 'userExists'.'roland') { return true; } @@ -1155,7 +1155,7 @@ class User_LDAPTest extends TestCase { $this->access->expects($this->any()) ->method('fetchListOfUsers') - ->willReturnCallback(function($filter) { + ->willReturnCallback(function ($filter) { if($filter === 'roland') { return [['dn' => ['dnOfRoland,dc=test']]]; } @@ -1163,7 +1163,7 @@ class User_LDAPTest extends TestCase { }); $this->access->expects($this->any()) ->method('fetchUsersByLoginName') - ->willReturnCallback(function($uid) { + ->willReturnCallback(function ($uid) { if($uid === 'roland') { return [['dn' => ['dnOfRoland,dc=test']]]; } @@ -1179,7 +1179,7 @@ class User_LDAPTest extends TestCase { ->willReturn(true); $this->access->expects($this->any()) ->method('setPassword') - ->willReturnCallback(function($uid, $password) { + ->willReturnCallback(function ($uid, $password) { if(strlen($password) <= 5) { throw new HintException('Password fails quality checking policy', '', 19); } diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php index d3a988a06b7..0a94eb2a1f4 100644 --- a/apps/user_ldap/tests/WizardTest.php +++ b/apps/user_ldap/tests/WizardTest.php @@ -103,7 +103,7 @@ class WizardTest extends TestCase { $configuration->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapBase') { return ['base']; } @@ -147,7 +147,7 @@ class WizardTest extends TestCase { $ldap->expects($this->exactly(10)) ->method('getDN') //dummy value, usually invalid - ->willReturnCallback(function($a, $b) { + ->willReturnCallback(function ($a, $b) { global $uidnumber; return $uidnumber++; }); @@ -163,7 +163,7 @@ class WizardTest extends TestCase { $configuration->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapBase') { return ['base']; } @@ -174,7 +174,7 @@ class WizardTest extends TestCase { $ldap->expects($this->any()) ->method('isResource') - ->willReturnCallback(function($r) { + ->willReturnCallback(function ($r) { if($r === true) { return true; } @@ -200,7 +200,7 @@ class WizardTest extends TestCase { $ldap->expects($this->exactly(2)) ->method('firstEntry') //dummy value, usually invalid - ->willReturnCallback(function($r) { + ->willReturnCallback(function ($r) { global $uidnumber; return $uidnumber; }); @@ -208,7 +208,7 @@ class WizardTest extends TestCase { $ldap->expects($this->exactly(46)) ->method('nextEntry') //dummy value, usually invalid - ->willReturnCallback(function($r) { + ->willReturnCallback(function ($r) { global $uidnumber; return $uidnumber; }); @@ -223,7 +223,7 @@ class WizardTest extends TestCase { $ldap->expects($this->exactly(46)) ->method('getDN') //dummy value, usually invalid - ->willReturnCallback(function($a, $b) { + ->willReturnCallback(function ($a, $b) { global $uidnumber; return $uidnumber++; }); @@ -379,7 +379,7 @@ class WizardTest extends TestCase { $configuration->expects($this->any()) ->method('__get') - ->willReturnCallback(function($name) { + ->willReturnCallback(function ($name) { if($name === 'ldapBase') { return ['base']; } @@ -390,7 +390,7 @@ class WizardTest extends TestCase { $ldap->expects($this->any()) ->method('isResource') - ->willReturnCallback(function($res) { + ->willReturnCallback(function ($res) { return (bool)$res; }); @@ -416,7 +416,7 @@ class WizardTest extends TestCase { $ldap->expects($this->any()) ->method('nextEntry') //dummy value, usually invalid - ->willReturnCallback(function($a, $prev){ + ->willReturnCallback(function ($a, $prev) { $current = $prev + 1; if($current === 7) { return false; @@ -432,14 +432,14 @@ class WizardTest extends TestCase { $ldap->expects($this->any()) ->method('getAttributes') //dummy value, usually invalid - ->willReturnCallback(function($a, $entry) { + ->willReturnCallback(function ($a, $entry) { return ['cn' => [$entry], 'count' => 1]; }); $ldap->expects($this->any()) ->method('getDN') //dummy value, usually invalid - ->willReturnCallback(function($a, $b) { + ->willReturnCallback(function ($a, $b) { return $b; }); |