summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/tests
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/tests')
-rw-r--r--apps/user_ldap/tests/AccessTest.php9
-rw-r--r--apps/user_ldap/tests/ConfigurationTest.php1
-rw-r--r--apps/user_ldap/tests/ConnectionTest.php3
-rw-r--r--apps/user_ldap/tests/Group_LDAPTest.php35
-rw-r--r--apps/user_ldap/tests/Integration/AbstractIntegrationTest.php11
-rw-r--r--apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php8
-rw-r--r--apps/user_ldap/tests/Integration/Lib/IntegrationTestFetchUsersByLoginName.php1
-rw-r--r--apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php4
-rw-r--r--apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php2
-rw-r--r--apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php2
-rw-r--r--apps/user_ldap/tests/Integration/setup-scripts/createExplicitGroups.php2
-rw-r--r--apps/user_ldap/tests/Integration/setup-scripts/createExplicitGroupsDifferentOU.php2
-rw-r--r--apps/user_ldap/tests/Integration/setup-scripts/createExplicitUsers.php2
-rw-r--r--apps/user_ldap/tests/Integration/setup-scripts/createUsersWithoutDisplayName.php2
-rw-r--r--apps/user_ldap/tests/Jobs/CleanUpTest.php1
-rw-r--r--apps/user_ldap/tests/Jobs/SyncTest.php21
-rw-r--r--apps/user_ldap/tests/LDAPGroupPluginDummy.php2
-rw-r--r--apps/user_ldap/tests/LDAPProviderTest.php6
-rw-r--r--apps/user_ldap/tests/LDAPTest.php3
-rw-r--r--apps/user_ldap/tests/LDAPUserPluginDummy.php2
-rw-r--r--apps/user_ldap/tests/Mapping/AbstractMappingTest.php18
-rw-r--r--apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php1
-rw-r--r--apps/user_ldap/tests/Migration/UUIDFixGroupTest.php1
-rw-r--r--apps/user_ldap/tests/Settings/AdminTest.php2
-rw-r--r--apps/user_ldap/tests/User/DeletedUsersIndexTest.php4
-rw-r--r--apps/user_ldap/tests/User/ManagerTest.php1
-rw-r--r--apps/user_ldap/tests/User/UserTest.php67
-rw-r--r--apps/user_ldap/tests/User_LDAPTest.php160
-rw-r--r--apps/user_ldap/tests/User_ProxyTest.php5
-rw-r--r--apps/user_ldap/tests/WizardTest.php72
30 files changed, 214 insertions, 236 deletions
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php
index a805f387086..73fd35b8960 100644
--- a/apps/user_ldap/tests/AccessTest.php
+++ b/apps/user_ldap/tests/AccessTest.php
@@ -238,7 +238,7 @@ class AccessTest extends TestCase {
$lw->expects($this->exactly(1))
->method('explodeDN')
->willReturnCallback(function ($dn) use ($case) {
- if($dn === $case['input']) {
+ if ($dn === $case['input']) {
return $case['interResult'];
}
return null;
@@ -258,7 +258,7 @@ class AccessTest extends TestCase {
$lw = new LDAP();
$access = new Access($con, $lw, $um, $helper, $config, $this->ncUserManager);
- if(!function_exists('ldap_explode_dn')) {
+ if (!function_exists('ldap_explode_dn')) {
$this->markTestSkipped('LDAP Module not available');
}
@@ -539,7 +539,7 @@ class AccessTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($key) use ($base) {
- if(stripos($key, 'base') !== false) {
+ if (stripos($key, 'base') !== false) {
return $base;
}
return null;
@@ -661,7 +661,7 @@ class AccessTest extends TestCase {
* @param $expected
*/
public function testSanitizeUsername($name, $expected) {
- if($expected === null) {
+ if ($expected === null) {
$this->expectException(\InvalidArgumentException::class);
}
$sanitizedName = $this->access->sanitizeUsername($name);
@@ -703,5 +703,4 @@ class AccessTest extends TestCase {
];
$this->access->nextcloudUserNames($records);
}
-
}
diff --git a/apps/user_ldap/tests/ConfigurationTest.php b/apps/user_ldap/tests/ConfigurationTest.php
index fee92a523c9..db119eb3bfe 100644
--- a/apps/user_ldap/tests/ConfigurationTest.php
+++ b/apps/user_ldap/tests/ConfigurationTest.php
@@ -139,5 +139,4 @@ class ConfigurationTest extends \Test\TestCase {
// so far the only thing that can get resolved :)
$this->assertSame($expected, $this->configuration->resolveRule('avatar'));
}
-
}
diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php
index 8a4ec38e4bd..721966025f0 100644
--- a/apps/user_ldap/tests/ConnectionTest.php
+++ b/apps/user_ldap/tests/ConnectionTest.php
@@ -135,7 +135,7 @@ class ConnectionTest extends \Test\TestCase {
$this->ldap->expects($this->exactly(3))
->method('bind')
->willReturnCallback(function () use (&$isThrown) {
- if(!$isThrown) {
+ if (!$isThrown) {
$isThrown = true;
throw new \OC\ServerNotAvailableException();
}
@@ -288,5 +288,4 @@ class ConnectionTest extends \Test\TestCase {
$this->connection->init();
}
-
}
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php
index 305df690358..ae637e0e584 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -57,7 +57,7 @@ class Group_LDAPTest extends TestCase {
static $conMethods;
static $accMethods;
- if(is_null($conMethods) || is_null($accMethods)) {
+ if (is_null($conMethods) || is_null($accMethods)) {
$conMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
}
@@ -89,7 +89,7 @@ class Group_LDAPTest extends TestCase {
$access->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapDynamicGroupMemberURL') {
+ if ($name === 'ldapDynamicGroupMemberURL') {
return '';
}
return 1;
@@ -110,7 +110,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($dn) use ($groupDN) {
- if($dn === $groupDN) {
+ if ($dn === $groupDN) {
return [
'uid=u11,ou=users,dc=foo,dc=bar',
'uid=u22,ou=users,dc=foo,dc=bar',
@@ -154,7 +154,7 @@ class Group_LDAPTest extends TestCase {
//something that is neither null or false, but once an array
//with the users in the group – so we do so all other times for
//simplicicity.
- if(strpos($name, 'u') === 0) {
+ if (strpos($name, 'u') === 0) {
return strpos($name, '3');
}
return ['u11', 'u22', 'u33', 'u34'];
@@ -521,9 +521,9 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($dn, $attr) {
- if($attr === 'primaryGroupToken') {
+ if ($attr === 'primaryGroupToken') {
return [1337];
- } elseif($attr === 'gidNumber') {
+ } elseif ($attr === 'gidNumber') {
return [4211];
}
return [];
@@ -558,7 +558,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($dn, $attr) {
- if($attr === 'primaryGroupToken') {
+ if ($attr === 'primaryGroupToken') {
return [1337];
}
return [];
@@ -594,7 +594,7 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($dn, $attr) {
- if($attr === 'primaryGroupToken') {
+ if ($attr === 'primaryGroupToken') {
return [1337];
}
return [];
@@ -655,9 +655,9 @@ class Group_LDAPTest extends TestCase {
$access->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'useMemberOfToDetectMembership') {
+ if ($name === 'useMemberOfToDetectMembership') {
return 0;
- } elseif($name === 'ldapDynamicGroupMemberURL') {
+ } elseif ($name === 'ldapDynamicGroupMemberURL') {
return '';
}
return 1;
@@ -693,7 +693,7 @@ class Group_LDAPTest extends TestCase {
$access->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- switch($name) {
+ switch ($name) {
case 'useMemberOfToDetectMembership':
return 0;
case 'ldapDynamicGroupMemberURL':
@@ -1031,18 +1031,18 @@ class Group_LDAPTest extends TestCase {
$access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($group) use ($groupDN, $expectedMembers, $groupsInfo) {
- if(isset($groupsInfo[$group])) {
+ if (isset($groupsInfo[$group])) {
return $groupsInfo[$group];
}
return [];
});
$access->connection = $this->createMock(Connection::class);
- if(count($groupsInfo) > 1) {
+ if (count($groupsInfo) > 1) {
$access->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapNestedGroups') {
+ if ($name === 'ldapNestedGroups') {
return 1;
}
return null;
@@ -1080,11 +1080,11 @@ class Group_LDAPTest extends TestCase {
$access->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapGroupMemberAssocAttr') {
+ if ($name === 'ldapGroupMemberAssocAttr') {
return 'member';
- } elseif($name === 'ldapGroupFilter') {
+ } elseif ($name === 'ldapGroupFilter') {
return 'objectclass=nextcloudGroup';
- } elseif($name === 'ldapGroupDisplayName') {
+ } elseif ($name === 'ldapGroupDisplayName') {
return 'cn';
}
return null;
@@ -1096,5 +1096,4 @@ class Group_LDAPTest extends TestCase {
$ldap = new GroupLDAP($access, $pluginManager);
$this->assertSame($expected, $ldap->getDisplayName($gid));
}
-
}
diff --git a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
index 77aeddf94f5..e6d9ddece55 100644
--- a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
+++ b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
@@ -83,7 +83,6 @@ abstract class AbstractIntegrationTest {
$this->initUserManager();
$this->initHelper();
$this->initAccess();
-
}
/**
@@ -151,23 +150,23 @@ abstract class AbstractIntegrationTest {
public function run() {
$methods = get_class_methods($this);
$atLeastOneCaseRan = false;
- foreach($methods as $method) {
- if(strpos($method, 'case') === 0) {
+ foreach ($methods as $method) {
+ if (strpos($method, 'case') === 0) {
print("running $method " . PHP_EOL);
try {
- if(!$this->$method()) {
+ if (!$this->$method()) {
print(PHP_EOL . '>>> !!! Test ' . $method . ' FAILED !!! <<<' . PHP_EOL . PHP_EOL);
exit(1);
}
$atLeastOneCaseRan = true;
- } catch(\Exception $e) {
+ } catch (\Exception $e) {
print(PHP_EOL . '>>> !!! Test ' . $method . ' RAISED AN EXCEPTION !!! <<<' . PHP_EOL);
print($e->getMessage() . PHP_EOL . PHP_EOL);
exit(1);
}
}
}
- if($atLeastOneCaseRan) {
+ if ($atLeastOneCaseRan) {
print('Tests succeeded' . PHP_EOL);
} else {
print('No Test was available.' . PHP_EOL);
diff --git a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php
index 33eb1c70d6f..e78208e579c 100644
--- a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php
+++ b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php
@@ -113,7 +113,7 @@ class ExceptionOnLostConnection {
* restores original state of the LDAP proxy, if necessary
*/
public function cleanUp() {
- if($this->originalProxyState === true) {
+ if ($this->originalProxyState === true) {
$this->setProxyState(true);
}
}
@@ -123,7 +123,7 @@ class ExceptionOnLostConnection {
* fail
*/
public function run() {
- if($this->originalProxyState === false) {
+ if ($this->originalProxyState === false) {
$this->setProxyState(true);
}
//host contains port, 2nd parameter will be ignored
@@ -152,7 +152,7 @@ class ExceptionOnLostConnection {
* @throws \Exception
*/
private function checkCurlResult($ch, $result) {
- if($result === false) {
+ if ($result === false) {
$error = curl_error($ch);
curl_close($ch);
throw new \Exception($error);
@@ -166,7 +166,7 @@ class ExceptionOnLostConnection {
* @throws \Exception
*/
private function setProxyState($isEnabled) {
- if(!is_bool($isEnabled)) {
+ if (!is_bool($isEnabled)) {
throw new \InvalidArgumentException('Bool expected');
}
$postData = json_encode(['enabled' => $isEnabled]);
diff --git a/apps/user_ldap/tests/Integration/Lib/IntegrationTestFetchUsersByLoginName.php b/apps/user_ldap/tests/Integration/Lib/IntegrationTestFetchUsersByLoginName.php
index 6048d42a4a6..01ac243729b 100644
--- a/apps/user_ldap/tests/Integration/Lib/IntegrationTestFetchUsersByLoginName.php
+++ b/apps/user_ldap/tests/Integration/Lib/IntegrationTestFetchUsersByLoginName.php
@@ -73,7 +73,6 @@ class IntegrationTestFetchUsersByLoginName extends AbstractIntegrationTest {
$result = $this->access->fetchUsersByLoginName('alice');
return count($result) === 1;
}
-
}
/** @var string $host */
diff --git a/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php b/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php
index 893efeaf495..ba8a3657edc 100644
--- a/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php
+++ b/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php
@@ -74,12 +74,12 @@ class IntegrationTestPaging extends AbstractIntegrationTest {
// the result will be 4, because the highest possible paging size
// is 2 (as configured).
// But also with more than one search base, the limit can be outpaced.
- if(count($result) !== 4) {
+ if (count($result) !== 4) {
return false;
}
$result = $this->access->searchUsers($filter, $attributes);
- if(count($result) !== 7) {
+ if (count($result) !== 7) {
return false;
}
diff --git a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php
index 87f25b19394..d1065337816 100644
--- a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php
+++ b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php
@@ -77,7 +77,7 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
\OC_Util::setupFS($username);
\OC::$server->getUserFolder($username);
\OC::$server->getConfig()->deleteUserValue($username, 'user_ldap', User::USER_PREFKEY_LASTREFRESH);
- if(\OC::$server->getAvatarManager()->getAvatar($username)->exists()) {
+ if (\OC::$server->getAvatarManager()->getAvatar($username)->exists()) {
\OC::$server->getAvatarManager()->getAvatar($username)->remove();
}
diff --git a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php
index b656b50ef50..84920d5950d 100644
--- a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php
+++ b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php
@@ -84,7 +84,7 @@ class IntegrationTestUserCleanUp extends AbstractIntegrationTest {
// it is deleted from the LDAP server. The instance will be returned
// from cache and may false-positively confirm the correctness.
$user = \OC::$server->getUserManager()->get($username);
- if($user === null) {
+ if ($user === null) {
return false;
}
$user->delete();
diff --git a/apps/user_ldap/tests/Integration/setup-scripts/createExplicitGroups.php b/apps/user_ldap/tests/Integration/setup-scripts/createExplicitGroups.php
index ebfbd339654..ac5346fe025 100644
--- a/apps/user_ldap/tests/Integration/setup-scripts/createExplicitGroups.php
+++ b/apps/user_ldap/tests/Integration/setup-scripts/createExplicitGroups.php
@@ -20,7 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-if(php_sapi_name() !== 'cli') {
+if (php_sapi_name() !== 'cli') {
print('Only via CLI, please.');
exit(1);
}
diff --git a/apps/user_ldap/tests/Integration/setup-scripts/createExplicitGroupsDifferentOU.php b/apps/user_ldap/tests/Integration/setup-scripts/createExplicitGroupsDifferentOU.php
index 74783bff251..4bf26b81a4b 100644
--- a/apps/user_ldap/tests/Integration/setup-scripts/createExplicitGroupsDifferentOU.php
+++ b/apps/user_ldap/tests/Integration/setup-scripts/createExplicitGroupsDifferentOU.php
@@ -20,7 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-if(php_sapi_name() !== 'cli') {
+if (php_sapi_name() !== 'cli') {
print('Only via CLI, please.');
exit(1);
}
diff --git a/apps/user_ldap/tests/Integration/setup-scripts/createExplicitUsers.php b/apps/user_ldap/tests/Integration/setup-scripts/createExplicitUsers.php
index aaba2d0bf85..f2cfad251de 100644
--- a/apps/user_ldap/tests/Integration/setup-scripts/createExplicitUsers.php
+++ b/apps/user_ldap/tests/Integration/setup-scripts/createExplicitUsers.php
@@ -20,7 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-if(php_sapi_name() !== 'cli') {
+if (php_sapi_name() !== 'cli') {
print('Only via CLI, please.');
exit(1);
}
diff --git a/apps/user_ldap/tests/Integration/setup-scripts/createUsersWithoutDisplayName.php b/apps/user_ldap/tests/Integration/setup-scripts/createUsersWithoutDisplayName.php
index 42ada041457..6ef4c745c26 100644
--- a/apps/user_ldap/tests/Integration/setup-scripts/createUsersWithoutDisplayName.php
+++ b/apps/user_ldap/tests/Integration/setup-scripts/createUsersWithoutDisplayName.php
@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-if(php_sapi_name() !== 'cli') {
+if (php_sapi_name() !== 'cli') {
print('Only via CLI, please.');
exit(1);
}
diff --git a/apps/user_ldap/tests/Jobs/CleanUpTest.php b/apps/user_ldap/tests/Jobs/CleanUpTest.php
index bf4c8b75bac..73d246ac4e2 100644
--- a/apps/user_ldap/tests/Jobs/CleanUpTest.php
+++ b/apps/user_ldap/tests/Jobs/CleanUpTest.php
@@ -152,5 +152,4 @@ class CleanUpTest extends \Test\TestCase {
$result = $bgJob->isOffsetResetNecessary($bgJob->getChunkSize());
$this->assertSame(false, $result);
}
-
}
diff --git a/apps/user_ldap/tests/Jobs/SyncTest.php b/apps/user_ldap/tests/Jobs/SyncTest.php
index 1cdbefb289c..e79fa58e019 100644
--- a/apps/user_ldap/tests/Jobs/SyncTest.php
+++ b/apps/user_ldap/tests/Jobs/SyncTest.php
@@ -175,7 +175,7 @@ class SyncTest extends TestCase {
$connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($key) use ($pagingSize) {
- if($key === 'ldapPagingSize') {
+ if ($key === 'ldapPagingSize') {
return $pagingSize;
}
return null;
@@ -221,7 +221,7 @@ class SyncTest extends TestCase {
->with(true)
->willReturn($prefixes);
- if(is_array($expectedCycle)) {
+ if (is_array($expectedCycle)) {
$this->config->expects($this->exactly(2))
->method('setAppValue')
->withConsecutive(
@@ -236,7 +236,7 @@ class SyncTest extends TestCase {
$this->sync->setArgument($this->arguments);
$nextCycle = $this->sync->determineNextCycle($cycleData);
- if($expectedCycle === null) {
+ if ($expectedCycle === null) {
$this->assertNull($nextCycle);
} else {
$this->assertSame($expectedCycle['prefix'], $nextCycle['prefix']);
@@ -295,23 +295,23 @@ class SyncTest extends TestCase {
$this->config->expects($this->any())
->method('getAppValue')
->willReturnCallback(function ($app, $key, $default) use ($runData) {
- if($app === 'core' && $key === 'backgroundjobs_mode') {
+ if ($app === 'core' && $key === 'backgroundjobs_mode') {
return 'cron';
}
- if($app = 'user_ldap') {
+ if ($app = 'user_ldap') {
// for getCycle()
- if($key === 'background_sync_prefix') {
+ if ($key === 'background_sync_prefix') {
return $runData['scheduledCycle']['prefix'];
}
- if($key === 'background_sync_offset') {
+ if ($key === 'background_sync_offset') {
return $runData['scheduledCycle']['offset'];
}
// for qualifiesToRun()
- if($key === $runData['scheduledCycle']['prefix'] . '_lastChange') {
+ if ($key === $runData['scheduledCycle']['prefix'] . '_lastChange') {
return time() - 60*40;
}
// for getMinPagingSize
- if($key === $runData['scheduledCycle']['prefix'] . 'ldap_paging_size') {
+ if ($key === $runData['scheduledCycle']['prefix'] . 'ldap_paging_size') {
return $runData['pagingSize'];
}
}
@@ -342,7 +342,7 @@ class SyncTest extends TestCase {
$connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($key) use ($runData) {
- if($key === 'ldapPagingSize') {
+ if ($key === 'ldapPagingSize') {
return $runData['pagingSize'];
}
return null;
@@ -367,5 +367,4 @@ class SyncTest extends TestCase {
$this->sync->run($this->arguments);
}
-
}
diff --git a/apps/user_ldap/tests/LDAPGroupPluginDummy.php b/apps/user_ldap/tests/LDAPGroupPluginDummy.php
index 996f6f4a3f0..7ff5cd8ac69 100644
--- a/apps/user_ldap/tests/LDAPGroupPluginDummy.php
+++ b/apps/user_ldap/tests/LDAPGroupPluginDummy.php
@@ -26,8 +26,6 @@ namespace OCA\User_LDAP\Tests;
use OCA\User_LDAP\ILDAPGroupPlugin;
class LDAPGroupPluginDummy implements ILDAPGroupPlugin {
-
-
public function respondToActions() {
return null;
}
diff --git a/apps/user_ldap/tests/LDAPProviderTest.php b/apps/user_ldap/tests/LDAPProviderTest.php
index 4433ed08baa..a8910c4a272 100644
--- a/apps/user_ldap/tests/LDAPProviderTest.php
+++ b/apps/user_ldap/tests/LDAPProviderTest.php
@@ -47,7 +47,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
* @package OCA\User_LDAP\Tests
*/
class LDAPProviderTest extends \Test\TestCase {
-
protected function setUp(): void {
parent::setUp();
}
@@ -358,7 +357,7 @@ class LDAPProviderTest extends \Test\TestCase {
$connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($key) use ($bases) {
- switch($key) {
+ switch ($key) {
case 'ldapBaseUsers':
return $bases;
}
@@ -420,7 +419,7 @@ class LDAPProviderTest extends \Test\TestCase {
$connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($key) use ($bases) {
- switch($key) {
+ switch ($key) {
case 'ldapBaseGroups':
return $bases;
}
@@ -697,5 +696,4 @@ class LDAPProviderTest extends \Test\TestCase {
$ldapProvider = $this->getLDAPProvider($server);
$this->assertEquals('assoc_type', $ldapProvider->getLDAPGroupMemberAssoc('existing_group'));
}
-
}
diff --git a/apps/user_ldap/tests/LDAPTest.php b/apps/user_ldap/tests/LDAPTest.php
index 8dd7122b4e1..5df6b118487 100644
--- a/apps/user_ldap/tests/LDAPTest.php
+++ b/apps/user_ldap/tests/LDAPTest.php
@@ -29,7 +29,7 @@ namespace OCA\User_LDAP\Tests;
use OCA\User_LDAP\LDAP;
use Test\TestCase;
-class LDAPTest extends TestCase {
+class LDAPTest extends TestCase {
/** @var LDAP|\PHPUnit_Framework_MockObject_MockObject */
private $ldap;
@@ -58,7 +58,6 @@ class LDAPTest extends TestCase {
* @dataProvider errorProvider
*/
public function testSearchWithErrorHandler(string $errorMessage, bool $passThrough) {
-
$wasErrorHandlerCalled = false;
$errorHandler = function ($number, $message, $file, $line) use (&$wasErrorHandlerCalled) {
$wasErrorHandlerCalled = true;
diff --git a/apps/user_ldap/tests/LDAPUserPluginDummy.php b/apps/user_ldap/tests/LDAPUserPluginDummy.php
index 609742d872d..a3bcc252fbe 100644
--- a/apps/user_ldap/tests/LDAPUserPluginDummy.php
+++ b/apps/user_ldap/tests/LDAPUserPluginDummy.php
@@ -26,7 +26,6 @@ namespace OCA\User_LDAP\Tests;
use OCA\User_LDAP\ILDAPUserPlugin;
class LDAPUserPluginDummy implements ILDAPUserPlugin {
-
public function respondToActions() {
return null;
}
@@ -58,5 +57,4 @@ class LDAPUserPluginDummy implements ILDAPUserPlugin {
public function countUsers() {
return null;
}
-
}
diff --git a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php
index a298c8b4bce..079c2e21b10 100644
--- a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php
+++ b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php
@@ -77,7 +77,7 @@ abstract class AbstractMappingTest extends \Test\TestCase {
* @param array $data
*/
protected function mapEntries($mapper, $data) {
- foreach($data as $entry) {
+ foreach ($data as $entry) {
$done = $mapper->map($entry['dn'], $entry['name'], $entry['uuid']);
$this->assertTrue($done);
}
@@ -111,9 +111,9 @@ abstract class AbstractMappingTest extends \Test\TestCase {
// test that mapping will not happen when it shall not
$tooLongDN = 'uid=joann,ou=Secret Small Specialized Department,ou=Some Tremendously Important Department,ou=Another Very Important Department,ou=Pretty Meaningful Derpartment,ou=Quite Broad And General Department,ou=The Topmost Department,dc=hugelysuccessfulcompany,dc=com';
$paramKeys = ['', 'dn', 'name', 'uuid', $tooLongDN];
- foreach($paramKeys as $key) {
+ foreach ($paramKeys as $key) {
$failEntry = $data[0];
- if(!empty($key)) {
+ if (!empty($key)) {
$failEntry[$key] = 'do-not-get-mapped';
}
$isMapped = $mapper->map($failEntry['dn'], $failEntry['name'], $failEntry['uuid']);
@@ -128,7 +128,7 @@ abstract class AbstractMappingTest extends \Test\TestCase {
public function testUnmap() {
list($mapper, $data) = $this->initTest();
- foreach($data as $entry) {
+ foreach ($data as $entry) {
$result = $mapper->unmap($entry['name']);
$this->assertTrue($result);
}
@@ -144,21 +144,21 @@ abstract class AbstractMappingTest extends \Test\TestCase {
public function testGetMethods() {
list($mapper, $data) = $this->initTest();
- foreach($data as $entry) {
+ foreach ($data as $entry) {
$fdn = $mapper->getDNByName($entry['name']);
$this->assertSame($fdn, $entry['dn']);
}
$fdn = $mapper->getDNByName('nosuchname');
$this->assertFalse($fdn);
- foreach($data as $entry) {
+ foreach ($data as $entry) {
$name = $mapper->getNameByDN($entry['dn']);
$this->assertSame($name, $entry['name']);
}
$name = $mapper->getNameByDN('nosuchdn');
$this->assertFalse($name);
- foreach($data as $entry) {
+ foreach ($data as $entry) {
$name = $mapper->getNameByUUID($entry['uuid']);
$this->assertSame($name, $entry['name']);
}
@@ -229,7 +229,7 @@ abstract class AbstractMappingTest extends \Test\TestCase {
$done = $mapper->clear();
$this->assertTrue($done);
- foreach($data as $entry) {
+ foreach ($data as $entry) {
$name = $mapper->getNameByUUID($entry['uuid']);
$this->assertFalse($name);
}
@@ -252,7 +252,7 @@ abstract class AbstractMappingTest extends \Test\TestCase {
$done = $mapper->clearCb($callback, $callback);
$this->assertTrue($done);
$this->assertSame(count($data) * 2, $callbackCalls);
- foreach($data as $entry) {
+ foreach ($data as $entry) {
$name = $mapper->getNameByUUID($entry['uuid']);
$this->assertFalse($name);
}
diff --git a/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php b/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php
index 47a6a091ae2..a1048609e69 100644
--- a/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php
+++ b/apps/user_ldap/tests/Migration/AbstractUUIDFixTest.php
@@ -194,5 +194,4 @@ abstract class AbstractUUIDFixTest extends TestCase {
$this->job->run($args);
}
-
}
diff --git a/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php b/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php
index 82afd8f19d8..a1f04d44670 100644
--- a/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php
+++ b/apps/user_ldap/tests/Migration/UUIDFixGroupTest.php
@@ -47,5 +47,4 @@ class UUIDFixGroupTest extends AbstractUUIDFixTest {
$this->mockProxy(Group_Proxy::class);
$this->instantiateJob(UUIDFixGroup::class);
}
-
}
diff --git a/apps/user_ldap/tests/Settings/AdminTest.php b/apps/user_ldap/tests/Settings/AdminTest.php
index 8f3a699af5d..c9119cffae4 100644
--- a/apps/user_ldap/tests/Settings/AdminTest.php
+++ b/apps/user_ldap/tests/Settings/AdminTest.php
@@ -72,7 +72,7 @@ class AdminTest extends TestCase {
// assign default values
$config = new Configuration('', false);
$defaults = $config->getDefaults();
- foreach($defaults as $key => $default) {
+ foreach ($defaults as $key => $default) {
$parameters[$key.'_default'] = $default;
}
diff --git a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php
index 57abbf2bf62..af1d86c6df7 100644
--- a/apps/user_ldap/tests/User/DeletedUsersIndexTest.php
+++ b/apps/user_ldap/tests/User/DeletedUsersIndexTest.php
@@ -88,7 +88,7 @@ class DeletedUsersIndexTest extends \Test\TestCase {
$this->assertSame(2, count($deletedUsers));
// ensure the different uids were used
- foreach($deletedUsers as $deletedUser) {
+ foreach ($deletedUsers as $deletedUser) {
$this->assertTrue(in_array($deletedUser->getOCName(), $uids));
$i = array_search($deletedUser->getOCName(), $uids);
$this->assertNotFalse($i);
@@ -117,6 +117,4 @@ class DeletedUsersIndexTest extends \Test\TestCase {
$this->assertNotSame($testUser->getOCName(), $deletedUser->getOCName());
}
}
-
-
}
diff --git a/apps/user_ldap/tests/User/ManagerTest.php b/apps/user_ldap/tests/User/ManagerTest.php
index f71f50377fb..98365bbfdb5 100644
--- a/apps/user_ldap/tests/User/ManagerTest.php
+++ b/apps/user_ldap/tests/User/ManagerTest.php
@@ -251,5 +251,4 @@ class ManagerTest extends \Test\TestCase {
$valueCounts = array_count_values($attributes);
$this->assertSame(1, $valueCounts['mail']);
}
-
}
diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php
index 7453b31e338..8de71b182ba 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -607,13 +607,11 @@ class UserTest extends \Test\TestCase {
$this->access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($dn, $attr) {
- if($dn === $this->dn
- && $attr === 'jpegphoto')
- {
+ if ($dn === $this->dn
+ && $attr === 'jpegphoto') {
return false;
- } elseif($dn === $this->dn
- && $attr === 'thumbnailphoto')
- {
+ } elseif ($dn === $this->dn
+ && $attr === 'thumbnailphoto') {
return ['this is a photo'];
}
return null;
@@ -672,13 +670,11 @@ class UserTest extends \Test\TestCase {
$this->access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($dn, $attr) {
- if($dn === $this->dn
- && $attr === 'jpegphoto')
- {
+ if ($dn === $this->dn
+ && $attr === 'jpegphoto') {
return false;
- } elseif($dn === $this->dn
- && $attr === 'thumbnailphoto')
- {
+ } elseif ($dn === $this->dn
+ && $attr === 'thumbnailphoto') {
return ['this is a photo'];
}
return null;
@@ -725,13 +721,11 @@ class UserTest extends \Test\TestCase {
$this->access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($dn, $attr) {
- if($dn === $this->dn
- && $attr === 'jpegphoto')
- {
+ if ($dn === $this->dn
+ && $attr === 'jpegphoto') {
return false;
- } elseif($dn === $this->dn
- && $attr === 'thumbnailphoto')
- {
+ } elseif ($dn === $this->dn
+ && $attr === 'thumbnailphoto') {
return ['this is a photo'];
}
return null;
@@ -790,13 +784,11 @@ class UserTest extends \Test\TestCase {
$this->access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($dn, $attr) {
- if($dn === $this->dn
- && $attr === 'jpegPhoto')
- {
+ if ($dn === $this->dn
+ && $attr === 'jpegPhoto') {
return false;
- } elseif($dn === $this->dn
- && $attr === 'thumbnailPhoto')
- {
+ } elseif ($dn === $this->dn
+ && $attr === 'thumbnailPhoto') {
return false;
}
return null;
@@ -895,7 +887,7 @@ class UserTest extends \Test\TestCase {
* @dataProvider extStorageHomeDataProvider
*/
public function testUpdateExtStorageHome(string $expected, string $valueFromLDAP = null, bool $isSet = true) {
- if($valueFromLDAP === null) {
+ if ($valueFromLDAP === null) {
$this->connection->expects($this->once())
->method('__get')
->willReturnMap([
@@ -903,7 +895,7 @@ class UserTest extends \Test\TestCase {
]);
$return = [];
- if($isSet) {
+ if ($isSet) {
$return[] = $expected;
}
$this->access->expects($this->once())
@@ -912,7 +904,7 @@ class UserTest extends \Test\TestCase {
->willReturn($return);
}
- if($expected !== '') {
+ if ($expected !== '') {
$this->config->expects($this->once())
->method('setUserValue')
->with($this->uid, 'user_ldap', 'extStorageHome', $expected);
@@ -924,7 +916,6 @@ class UserTest extends \Test\TestCase {
$actual = $this->user->updateExtStorageHome($valueFromLDAP);
$this->assertSame($expected, $actual);
-
}
public function testUpdateNoRefresh() {
@@ -1039,7 +1030,7 @@ class UserTest extends \Test\TestCase {
$this->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'homeFolderNamingRule') {
+ if ($name === 'homeFolderNamingRule') {
return 'attr:homeDirectory';
}
return $name;
@@ -1060,7 +1051,7 @@ class UserTest extends \Test\TestCase {
'jpegphoto' => ['here be an image']
];
- foreach($requiredMethods as $method) {
+ foreach ($requiredMethods as $method) {
$userMock->expects($this->once())
->method($method);
}
@@ -1194,10 +1185,10 @@ class UserTest extends \Test\TestCase {
$this->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapDefaultPPolicyDN') {
+ if ($name === 'ldapDefaultPPolicyDN') {
return 'cn=default,ou=policies,dc=foo,dc=bar';
}
- if($name === 'turnOnPasswordChange') {
+ if ($name === 'turnOnPasswordChange') {
return '1';
}
return $name;
@@ -1206,7 +1197,7 @@ class UserTest extends \Test\TestCase {
$this->access->expects($this->any())
->method('search')
->willReturnCallback(function ($filter, $base) {
- if($base === [$this->dn]) {
+ if ($base === [$this->dn]) {
return [
[
'pwdchangedtime' => [(new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis').'Z'],
@@ -1214,7 +1205,7 @@ class UserTest extends \Test\TestCase {
],
];
}
- if($base === ['cn=default,ou=policies,dc=foo,dc=bar']) {
+ if ($base === ['cn=default,ou=policies,dc=foo,dc=bar']) {
return [
[
'pwdmaxage' => ['2592000'],
@@ -1257,10 +1248,10 @@ class UserTest extends \Test\TestCase {
$this->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapDefaultPPolicyDN') {
+ if ($name === 'ldapDefaultPPolicyDN') {
return 'cn=default,ou=policies,dc=foo,dc=bar';
}
- if($name === 'turnOnPasswordChange') {
+ if ($name === 'turnOnPasswordChange') {
return '1';
}
return $name;
@@ -1269,7 +1260,7 @@ class UserTest extends \Test\TestCase {
$this->access->expects($this->any())
->method('search')
->willReturnCallback(function ($filter, $base) {
- if($base === [$this->dn]) {
+ if ($base === [$this->dn]) {
return [
[
'pwdpolicysubentry' => ['cn=custom,ou=policies,dc=foo,dc=bar'],
@@ -1278,7 +1269,7 @@ class UserTest extends \Test\TestCase {
]
];
}
- if($base === ['cn=custom,ou=policies,dc=foo,dc=bar']) {
+ if ($base === ['cn=custom,ou=policies,dc=foo,dc=bar']) {
return [
[
'pwdmaxage' => ['2592000'],
diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php
index 2b0fcd681f9..00ca6737175 100644
--- a/apps/user_ldap/tests/User_LDAPTest.php
+++ b/apps/user_ldap/tests/User_LDAPTest.php
@@ -109,7 +109,7 @@ class User_LDAPTest extends TestCase {
$this->access->expects($this->any())
->method('username2dn')
->willReturnCallback(function ($uid) {
- switch ($uid) {
+ switch ($uid) {
case 'gunslinger':
return 'dnOfRoland,dc=test';
break;
@@ -140,31 +140,31 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapLoginFilter') {
- return '%uid';
- }
- return null;
+ if ($name === 'ldapLoginFilter') {
+ return '%uid';
+ }
+ return null;
});
$this->access->expects($this->any())
->method('fetchListOfUsers')
->willReturnCallback(function ($filter) {
- if($filter === 'roland') {
- return [['dn' => ['dnOfRoland,dc=test']]];
- }
- return [];
+ if ($filter === 'roland') {
+ return [['dn' => ['dnOfRoland,dc=test']]];
+ }
+ return [];
});
$this->access->expects($this->any())
->method('fetchUsersByLoginName')
->willReturnCallback(function ($uid) {
- if($uid === 'roland') {
+ if ($uid === 'roland') {
return [['dn' => ['dnOfRoland,dc=test']]];
}
return [];
});
$retVal = 'gunslinger';
- if($noDisplayName === true) {
+ if ($noDisplayName === true) {
$retVal = false;
}
$this->access->expects($this->any())
@@ -178,10 +178,10 @@ class User_LDAPTest extends TestCase {
$this->access->expects($this->any())
->method('areCredentialsValid')
->willReturnCallback(function ($dn, $pwd) {
- if($pwd === 'dt19') {
- return true;
- }
- return false;
+ if ($pwd === 'dt19') {
+ return true;
+ }
+ return false;
});
}
@@ -364,36 +364,36 @@ class User_LDAPTest extends TestCase {
$this->access->expects($this->once())
->method('escapeFilterPart')
->willReturnCallback(function ($search) {
- return $search;
+ return $search;
});
$this->access->expects($this->any())
->method('getFilterPartForUserSearch')
->willReturnCallback(function ($search) {
- return $search;
+ return $search;
});
$this->access->expects($this->any())
->method('combineFilterWithAnd')
->willReturnCallback(function ($param) {
- return $param[2];
+ return $param[2];
});
$this->access->expects($this->any())
->method('fetchListOfUsers')
->willReturnCallback(function ($search, $a, $l, $o) {
- $users = ['gunslinger', 'newyorker', 'ladyofshadows'];
- if(empty($search)) {
- $result = $users;
- } else {
- $result = [];
- foreach($users as $user) {
- if(stripos($user, $search) !== false) {
- $result[] = $user;
- }
- }
- }
- if(!is_null($l) || !is_null($o)) {
- $result = array_slice($result, $o, $l);
- }
- return $result;
+ $users = ['gunslinger', 'newyorker', 'ladyofshadows'];
+ if (empty($search)) {
+ $result = $users;
+ } else {
+ $result = [];
+ foreach ($users as $user) {
+ if (stripos($user, $search) !== false) {
+ $result[] = $user;
+ }
+ }
+ }
+ if (!is_null($l) || !is_null($o)) {
+ $result = array_slice($result, $o, $l);
+ }
+ return $result;
});
$this->access->expects($this->any())
->method('nextcloudUserNames')
@@ -545,7 +545,7 @@ class User_LDAPTest extends TestCase {
$this->access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($dn) {
- if($dn === 'dnOfRoland,dc=test') {
+ if ($dn === 'dnOfRoland,dc=test') {
return [];
}
return false;
@@ -570,7 +570,7 @@ class User_LDAPTest extends TestCase {
$this->access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($dn) {
- if($dn === 'dnOfRoland,dc=test') {
+ if ($dn === 'dnOfRoland,dc=test') {
return [];
}
return false;
@@ -602,7 +602,7 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'homeFolderNamingRule') {
+ if ($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
@@ -613,7 +613,7 @@ class User_LDAPTest extends TestCase {
->willReturnCallback(function ($dn, $attr) {
switch ($dn) {
case 'dnOfRoland,dc=test':
- if($attr === 'testAttribute') {
+ if ($attr === 'testAttribute') {
return ['/tmp/rolandshome/'];
}
return [];
@@ -654,7 +654,7 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'homeFolderNamingRule') {
+ if ($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
@@ -665,7 +665,7 @@ class User_LDAPTest extends TestCase {
->willReturnCallback(function ($dn, $attr) {
switch ($dn) {
case 'dnOfLadyOfShadows,dc=test':
- if($attr === 'testAttribute') {
+ if ($attr === 'testAttribute') {
return ['susannah/'];
}
return [];
@@ -705,7 +705,7 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'homeFolderNamingRule') {
+ if ($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
@@ -721,7 +721,7 @@ class User_LDAPTest extends TestCase {
$this->access->connection->expects($this->any())
->method('getFromCache')
->willReturnCallback(function ($key) {
- if($key === 'userExistsnewyorker') {
+ if ($key === 'userExistsnewyorker') {
return true;
}
return null;
@@ -753,7 +753,7 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'homeFolderNamingRule') {
+ if ($name === 'homeFolderNamingRule') {
return 'attr:testAttribute';
}
return null;
@@ -810,18 +810,18 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapUserDisplayName') {
- return 'displayname';
- }
- return null;
+ if ($name === 'ldapUserDisplayName') {
+ return 'displayname';
+ }
+ return null;
});
$this->access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($dn, $attr) {
- switch ($dn) {
+ switch ($dn) {
case 'dnOfRoland,dc=test':
- if($attr === 'displayname') {
+ if ($attr === 'displayname') {
return ['Roland Deschain'];
}
return [];
@@ -864,14 +864,16 @@ 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) {
- if($uid === 'gunslinger') {
+ if ($uid === 'gunslinger') {
return $user1;
- } elseif($uid === 'newyorker') {
+ } elseif ($uid === 'newyorker') {
return $user2;
}
return null;
@@ -881,7 +883,9 @@ 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');
@@ -943,14 +947,16 @@ 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) {
- if($uid === 'gunslinger') {
+ if ($uid === 'gunslinger') {
return $user1;
- } elseif($uid === 'newyorker') {
+ } elseif ($uid === 'newyorker') {
return $user2;
}
return null;
@@ -960,7 +966,9 @@ 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();
@@ -1136,35 +1144,35 @@ class User_LDAPTest extends TestCase {
$this->connection->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) use (&$enablePasswordChange) {
- if($name === 'ldapLoginFilter') {
- return '%uid';
- }
- if($name === 'turnOnPasswordChange') {
- return $enablePasswordChange?1:0;
- }
- return null;
+ if ($name === 'ldapLoginFilter') {
+ return '%uid';
+ }
+ if ($name === 'turnOnPasswordChange') {
+ return $enablePasswordChange?1:0;
+ }
+ return null;
});
$this->connection->expects($this->any())
->method('getFromCache')
->willReturnCallback(function ($uid) {
- if($uid === 'userExists'.'roland') {
- return true;
- }
- return null;
+ if ($uid === 'userExists'.'roland') {
+ return true;
+ }
+ return null;
});
$this->access->expects($this->any())
->method('fetchListOfUsers')
->willReturnCallback(function ($filter) {
- if($filter === 'roland') {
- return [['dn' => ['dnOfRoland,dc=test']]];
- }
- return [];
+ if ($filter === 'roland') {
+ return [['dn' => ['dnOfRoland,dc=test']]];
+ }
+ return [];
});
$this->access->expects($this->any())
->method('fetchUsersByLoginName')
->willReturnCallback(function ($uid) {
- if($uid === 'roland') {
+ if ($uid === 'roland') {
return [['dn' => ['dnOfRoland,dc=test']]];
}
return [];
@@ -1180,10 +1188,10 @@ class User_LDAPTest extends TestCase {
$this->access->expects($this->any())
->method('setPassword')
->willReturnCallback(function ($uid, $password) {
- if(strlen($password) <= 5) {
- throw new HintException('Password fails quality checking policy', '', 19);
- }
- return true;
+ if (strlen($password) <= 5) {
+ throw new HintException('Password fails quality checking policy', '', 19);
+ }
+ return true;
});
}
diff --git a/apps/user_ldap/tests/User_ProxyTest.php b/apps/user_ldap/tests/User_ProxyTest.php
index 0a073b3948e..83755abe078 100644
--- a/apps/user_ldap/tests/User_ProxyTest.php
+++ b/apps/user_ldap/tests/User_ProxyTest.php
@@ -35,7 +35,7 @@ use OCP\IUserSession;
use OCP\Notification\IManager as INotificationManager;
use Test\TestCase;
-class User_ProxyTest extends TestCase {
+class User_ProxyTest extends TestCase {
/** @var ILDAPWrapper|\PHPUnit_Framework_MockObject_MockObject */
private $ldapWrapper;
/** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
@@ -87,7 +87,8 @@ class User_ProxyTest extends TestCase {
->with('MyUid', 'setDisplayName', ['MyUid', 'MyPassword'])
->willReturn(true);
- $this->assertTrue($this->proxy->setDisplayName('MyUid', 'MyPassword')); }
+ $this->assertTrue($this->proxy->setDisplayName('MyUid', 'MyPassword'));
+ }
public function testCreateUser() {
$this->proxy
diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php
index 67af7e9b177..5595ff30440 100644
--- a/apps/user_ldap/tests/WizardTest.php
+++ b/apps/user_ldap/tests/WizardTest.php
@@ -50,8 +50,8 @@ class WizardTest extends TestCase {
//on systems without php5_ldap
$ldapConsts = ['LDAP_OPT_PROTOCOL_VERSION',
'LDAP_OPT_REFERRALS', 'LDAP_OPT_NETWORK_TIMEOUT'];
- foreach($ldapConsts as $const) {
- if(!defined($const)) {
+ foreach ($ldapConsts as $const) {
+ if (!defined($const)) {
define($const, 42);
}
}
@@ -62,7 +62,7 @@ class WizardTest extends TestCase {
static $connMethods;
static $accMethods;
- if(is_null($confMethods)) {
+ 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\Access');
@@ -95,7 +95,6 @@ class WizardTest extends TestCase {
$ldap->expects($this->once())
->method('bind')
->willReturn(true);
-
}
public function testCumulativeSearchOnAttributeLimited() {
@@ -104,11 +103,11 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapBase') {
- return ['base'];
- }
- return null;
- });
+ if ($name === 'ldapBase') {
+ return ['base'];
+ }
+ return null;
+ });
$this->prepareLdapWrapperForConnections($ldap);
@@ -164,21 +163,21 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapBase') {
- return ['base'];
- }
- return null;
- });
+ if ($name === 'ldapBase') {
+ return ['base'];
+ }
+ return null;
+ });
$this->prepareLdapWrapperForConnections($ldap);
$ldap->expects($this->any())
->method('isResource')
->willReturnCallback(function ($r) {
- if($r === true) {
+ if ($r === true) {
return true;
}
- if($r % 24 === 0) {
+ if ($r % 24 === 0) {
global $uidnumber;
$uidnumber++;
return false;
@@ -241,7 +240,7 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapEmailAttribute') {
+ if ($name === 'ldapEmailAttribute') {
return 'myEmailAttribute';
} else {
//for requirement checks
@@ -263,7 +262,7 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapEmailAttribute') {
+ if ($name === 'ldapEmailAttribute') {
return 'myEmailAttribute';
} else {
//for requirement checks
@@ -280,11 +279,11 @@ class WizardTest extends TestCase {
$access->expects($this->exactly(3))
->method('countUsers')
->willReturnCallback(function ($filter) {
- if($filter === 'myEmailAttribute') {
+ if ($filter === 'myEmailAttribute') {
return 0;
- } elseif($filter === 'mail') {
+ } elseif ($filter === 'mail') {
return 3;
- } elseif($filter === 'mailPrimaryAddress') {
+ } elseif ($filter === 'mailPrimaryAddress') {
return 17;
}
throw new \Exception('Untested filter: ' . $filter);
@@ -302,7 +301,7 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapEmailAttribute') {
+ if ($name === 'ldapEmailAttribute') {
return '';
} else {
//for requirement checks
@@ -319,11 +318,11 @@ class WizardTest extends TestCase {
$access->expects($this->exactly(2))
->method('countUsers')
->willReturnCallback(function ($filter) {
- if($filter === 'myEmailAttribute') {
+ if ($filter === 'myEmailAttribute') {
return 0;
- } elseif($filter === 'mail') {
+ } elseif ($filter === 'mail') {
return 3;
- } elseif($filter === 'mailPrimaryAddress') {
+ } elseif ($filter === 'mailPrimaryAddress') {
return 17;
}
throw new \Exception('Untested filter: ' . $filter);
@@ -341,7 +340,7 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapEmailAttribute') {
+ if ($name === 'ldapEmailAttribute') {
return 'myEmailAttribute';
} else {
//for requirement checks
@@ -358,11 +357,11 @@ class WizardTest extends TestCase {
$access->expects($this->exactly(3))
->method('countUsers')
->willReturnCallback(function ($filter) {
- if($filter === 'myEmailAttribute') {
+ if ($filter === 'myEmailAttribute') {
return 0;
- } elseif($filter === 'mail') {
+ } elseif ($filter === 'mail') {
return 0;
- } elseif($filter === 'mailPrimaryAddress') {
+ } elseif ($filter === 'mailPrimaryAddress') {
return 0;
}
throw new \Exception('Untested filter: ' . $filter);
@@ -380,11 +379,11 @@ class WizardTest extends TestCase {
$configuration->expects($this->any())
->method('__get')
->willReturnCallback(function ($name) {
- if($name === 'ldapBase') {
- return ['base'];
- }
- return null;
- });
+ if ($name === 'ldapBase') {
+ return ['base'];
+ }
+ return null;
+ });
$this->prepareLdapWrapperForConnections($ldap);
@@ -418,11 +417,11 @@ class WizardTest extends TestCase {
//dummy value, usually invalid
->willReturnCallback(function ($a, $prev) {
$current = $prev + 1;
- if($current === 7) {
+ if ($current === 7) {
return false;
}
global $mark;
- if($prev === 4 && !$mark) {
+ if ($prev === 4 && !$mark) {
$mark = true;
return 4;
}
@@ -449,5 +448,4 @@ class WizardTest extends TestCase {
$this->assertSame(6, count($resultArray));
unset($mark);
}
-
}