diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/user_ldap/tests/User | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/user_ldap/tests/User')
-rw-r--r-- | apps/user_ldap/tests/User/DeletedUsersIndexTest.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/tests/User/ManagerTest.php | 1 | ||||
-rw-r--r-- | apps/user_ldap/tests/User/UserTest.php | 67 |
3 files changed, 30 insertions, 42 deletions
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'], |