From e4225175e1f0f5f939373987868e32ab795e43ff Mon Sep 17 00:00:00 2001 From: Parajuli Kiran Date: Mon, 25 May 2020 17:10:37 +0545 Subject: [PATCH 1/2] Removed unused variable from exception message --- .../features/bootstrap/UserLdapGeneralContext.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php b/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php index 4c7473c52..187bf1f18 100644 --- a/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php +++ b/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php @@ -135,7 +135,8 @@ public function ldapUserIsSynced($user) { ['user:sync', 'OCA\User_LDAP\User_Proxy', '-u', $user, '-m', 'remove'] ); if ($this->featureContext->getExitStatusCodeOfOccCommand() !== 0) { - throw new \Exception("could not sync LDAP user {$user} " . $occResult['stdErr']); + throw new \Exception("could not sync LDAP user {$user} " . + $this->featureContext->getStdErrOfOccCommand()); } } @@ -148,7 +149,7 @@ public function ldapUserIsSynced($user) { public function theAdminListsTheEnabledBackendsUsingTheOccCommand() { $this->featureContext->runOcc(["user:sync -l"]); } - + /** * @When the administrator sets the ldap attribute :attribute of the entry :entry to :value * @@ -209,7 +210,7 @@ public function theLdapAttributeOfTheEntryToContentOfFile( $attribute, $entry, $filename ) { $value = \file_get_contents(\getenv("FILES_FOR_UPLOAD") . $filename); - + $this->setTheLdapAttributeOfTheEntryTo( $attribute, $entry, $value ); @@ -306,12 +307,12 @@ public function createLDAPUsers($amount, $prefix, $ou) { $ldap->add($ouDN, $entry); $this->featureContext->setToDeleteDNs($ouDN); } - + $lenOfSuffix = \strlen((string)$amount); for ($i = 0; $i < $amount; $i++) { $uid = $prefix . \str_pad($i, $lenOfSuffix, '0', STR_PAD_LEFT); $newDN = 'uid=' . $uid . ',ou=' . $ou . ',' . $this->featureContext->getLdapBaseDN(); - + $entry = []; $entry['cn'] = $uid; $entry['sn'] = $i; @@ -322,7 +323,7 @@ public function createLDAPUsers($amount, $prefix, $ou) { $entry['displayName'] = $uid; $entry['gidNumber'] = 5000; $entry['uidNumber'] = $maxUidNumber + $i + 1; - + $ldap->add($newDN, $entry); $this->featureContext->addUserToCreatedUsersList( $uid, $uid, $uid, null, false From 145e5d54286ae069ab45c9c410e0a8b03877aafa Mon Sep 17 00:00:00 2001 From: Parajuli Kiran Date: Mon, 25 May 2020 17:38:09 +0545 Subject: [PATCH 2/2] Php style fix --- .../features/bootstrap/UserLdapGeneralContext.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php b/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php index 187bf1f18..da34cfe4a 100644 --- a/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php +++ b/tests/acceptance/features/bootstrap/UserLdapGeneralContext.php @@ -135,8 +135,10 @@ public function ldapUserIsSynced($user) { ['user:sync', 'OCA\User_LDAP\User_Proxy', '-u', $user, '-m', 'remove'] ); if ($this->featureContext->getExitStatusCodeOfOccCommand() !== 0) { - throw new \Exception("could not sync LDAP user {$user} " . - $this->featureContext->getStdErrOfOccCommand()); + throw new \Exception( + "could not sync LDAP user {$user} " . + $this->featureContext->getStdErrOfOccCommand() + ); } }