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/WizardTest.php | |
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/WizardTest.php')
-rw-r--r-- | apps/user_ldap/tests/WizardTest.php | 72 |
1 files changed, 35 insertions, 37 deletions
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); } - } |