@@ -108,7 +108,7 @@ |
||
108 | 108 | ]; |
109 | 109 | $this->initialState->expects($this->exactly(10)) |
110 | 110 | ->method('provideInitialState') |
111 | - ->willReturnCallback(function () use (&$calls): void { |
|
111 | + ->willReturnCallback(function() use (&$calls): void { |
|
112 | 112 | $expected = array_shift($calls); |
113 | 113 | $this->assertSame($expected, func_get_args()); |
114 | 114 | }); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | ->willReturn($groupDN); |
65 | 65 | $this->access->expects($this->any()) |
66 | 66 | ->method('readAttribute') |
67 | - ->willReturnCallback(function ($dn) use ($groupDN) { |
|
67 | + ->willReturnCallback(function($dn) use ($groupDN) { |
|
68 | 68 | if ($dn === $groupDN) { |
69 | 69 | return [ |
70 | 70 | 'uid=u11,ou=users,dc=foo,dc=bar', |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | private function enableGroups(): void { |
113 | 113 | $this->access->connection->expects($this->any()) |
114 | 114 | ->method('__get') |
115 | - ->willReturnCallback(function ($name) { |
|
115 | + ->willReturnCallback(function($name) { |
|
116 | 116 | if ($name === 'ldapDynamicGroupMemberURL') { |
117 | 117 | return ''; |
118 | 118 | } elseif ($name === 'ldapBaseGroups') { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | ->willReturn([]); |
134 | 134 | $this->access->expects($this->any()) |
135 | 135 | ->method('readAttribute') |
136 | - ->willReturnCallback(function ($name) { |
|
136 | + ->willReturnCallback(function($name) { |
|
137 | 137 | //the search operation will call readAttribute, thus we need |
138 | 138 | //to analyze the "dn". All other times we just need to return |
139 | 139 | //something that is neither null or false, but once an array |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | }); |
147 | 147 | $this->access->expects($this->any()) |
148 | 148 | ->method('dn2username') |
149 | - ->willReturnCallback(function () { |
|
150 | - return 'foobar' . Server::get(ISecureRandom::class)->generate(7); |
|
149 | + ->willReturnCallback(function() { |
|
150 | + return 'foobar'.Server::get(ISecureRandom::class)->generate(7); |
|
151 | 151 | }); |
152 | 152 | $this->access->expects($this->any()) |
153 | 153 | ->method('isDNPartOfBase') |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $connection = $this->access->connection; |
288 | 288 | $connection->expects($this->once()) |
289 | 289 | ->method('getFromCache') |
290 | - ->with('primaryGroupIDtoName_' . $gid) |
|
290 | + ->with('primaryGroupIDtoName_'.$gid) |
|
291 | 291 | ->willReturn('MyGroup'); |
292 | 292 | |
293 | 293 | $this->access->expects($this->never()) |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | |
447 | 447 | $uid = 'someUser'; |
448 | 448 | $gid = 'someGroup'; |
449 | - $cacheKey = 'inGroup' . $uid . ':' . $gid; |
|
449 | + $cacheKey = 'inGroup'.$uid.':'.$gid; |
|
450 | 450 | |
451 | 451 | $this->access->connection->expects($this->once()) |
452 | 452 | ->method('getFromCache') |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | |
483 | 483 | $this->access->connection->expects($this->any()) |
484 | 484 | ->method('__get') |
485 | - ->willReturnCallback(function ($name) { |
|
485 | + ->willReturnCallback(function($name) { |
|
486 | 486 | switch ($name) { |
487 | 487 | case 'ldapGroupMemberAssocAttr': |
488 | 488 | return 'member'; |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | |
522 | 522 | $this->access->connection->expects($this->any()) |
523 | 523 | ->method('__get') |
524 | - ->willReturnCallback(function ($name) { |
|
524 | + ->willReturnCallback(function($name) { |
|
525 | 525 | switch ($name) { |
526 | 526 | case 'ldapGroupMemberAssocAttr': |
527 | 527 | return 'member'; |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | |
568 | 568 | $this->access->connection->expects($this->any()) |
569 | 569 | ->method('__get') |
570 | - ->willReturnCallback(function ($name) { |
|
570 | + ->willReturnCallback(function($name) { |
|
571 | 571 | switch ($name) { |
572 | 572 | case 'ldapGroupMemberAssocAttr': |
573 | 573 | return 'memberUid'; |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | ->willReturn(null); |
637 | 637 | $this->access->expects($this->any()) |
638 | 638 | ->method('readAttribute') |
639 | - ->willReturnCallback(function ($dn, $attr) { |
|
639 | + ->willReturnCallback(function($dn, $attr) { |
|
640 | 640 | if ($attr === 'primaryGroupToken') { |
641 | 641 | return [1337]; |
642 | 642 | } elseif ($attr === 'gidNumber') { |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | ->willReturn(null); |
680 | 680 | $this->access->expects($this->any()) |
681 | 681 | ->method('readAttribute') |
682 | - ->willReturnCallback(function ($dn, $attr) { |
|
682 | + ->willReturnCallback(function($dn, $attr) { |
|
683 | 683 | if ($attr === 'primaryGroupToken') { |
684 | 684 | return [1337]; |
685 | 685 | } |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | |
722 | 722 | $this->access->expects($this->any()) |
723 | 723 | ->method('readAttribute') |
724 | - ->willReturnCallback(function ($dn, $attr) { |
|
724 | + ->willReturnCallback(function($dn, $attr) { |
|
725 | 725 | if ($attr === 'primaryGroupToken') { |
726 | 726 | return [1337]; |
727 | 727 | } |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | public function testGetUserGroupsMemberOfDisabled(): void { |
786 | 786 | $this->access->connection->expects($this->any()) |
787 | 787 | ->method('__get') |
788 | - ->willReturnCallback(function ($name) { |
|
788 | + ->willReturnCallback(function($name) { |
|
789 | 789 | if ($name === 'useMemberOfToDetectMembership') { |
790 | 790 | return 0; |
791 | 791 | } elseif ($name === 'ldapDynamicGroupMemberURL') { |
@@ -945,14 +945,14 @@ discard block |
||
945 | 945 | $groupFilter = '(&(objectclass=nextcloudGroup)(nextcloudEnabled=TRUE))'; |
946 | 946 | $this->access->connection->expects($this->any()) |
947 | 947 | ->method('__get') |
948 | - ->willReturnCallback(function (string $name) use ($nestedGroups, $groupFilter) { |
|
948 | + ->willReturnCallback(function(string $name) use ($nestedGroups, $groupFilter) { |
|
949 | 949 | switch ($name) { |
950 | 950 | case 'useMemberOfToDetectMembership': |
951 | 951 | return 0; |
952 | 952 | case 'ldapDynamicGroupMemberURL': |
953 | 953 | return ''; |
954 | 954 | case 'ldapNestedGroups': |
955 | - return (int)$nestedGroups; |
|
955 | + return (int) $nestedGroups; |
|
956 | 956 | case 'ldapGroupMemberAssocAttr': |
957 | 957 | return 'member'; |
958 | 958 | case 'ldapGroupFilter': |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | ->willReturn([]); |
979 | 979 | $this->access->expects($this->any()) |
980 | 980 | ->method('combineFilterWithAnd') |
981 | - ->willReturnCallback(function (array $filterParts) { |
|
981 | + ->willReturnCallback(function(array $filterParts) { |
|
982 | 982 | // ⚠ returns a pseudo-filter only, not real LDAP Filter syntax |
983 | 983 | return implode('&', $filterParts); |
984 | 984 | }); |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | ->willReturn($expectedGroupsNames); |
1009 | 1009 | $this->access->expects($nestedGroups ? $this->atLeastOnce() : $this->once()) |
1010 | 1010 | ->method('fetchListOfGroups') |
1011 | - ->willReturnCallback(function ($filter, $attr, $limit, $offset) use ($nestedGroups, $groupFilter, $group1, $group2, $group3, $dn) { |
|
1011 | + ->willReturnCallback(function($filter, $attr, $limit, $offset) use ($nestedGroups, $groupFilter, $group1, $group2, $group3, $dn) { |
|
1012 | 1012 | static $firstRun = true; |
1013 | 1013 | if (!$nestedGroups) { |
1014 | 1014 | // When nested groups are enabled, groups cannot be filtered early as it would |
@@ -1016,10 +1016,10 @@ discard block |
||
1016 | 1016 | $this->assertTrue(str_contains($filter, $groupFilter)); |
1017 | 1017 | } |
1018 | 1018 | [$memberFilter] = explode('&', $filter); |
1019 | - if ($memberFilter === 'member=' . $dn) { |
|
1019 | + if ($memberFilter === 'member='.$dn) { |
|
1020 | 1020 | return [$group1, $group2]; |
1021 | 1021 | return []; |
1022 | - } elseif ($memberFilter === 'member=' . $group2['dn'][0]) { |
|
1022 | + } elseif ($memberFilter === 'member='.$group2['dn'][0]) { |
|
1023 | 1023 | return [$group3]; |
1024 | 1024 | } else { |
1025 | 1025 | return []; |
@@ -1027,12 +1027,12 @@ discard block |
||
1027 | 1027 | }); |
1028 | 1028 | $this->access->expects($this->any()) |
1029 | 1029 | ->method('dn2groupname') |
1030 | - ->willReturnCallback(function (string $dn) { |
|
1030 | + ->willReturnCallback(function(string $dn) { |
|
1031 | 1031 | return ldap_explode_dn($dn, 1)[0]; |
1032 | 1032 | }); |
1033 | 1033 | $this->access->expects($this->any()) |
1034 | 1034 | ->method('groupname2dn') |
1035 | - ->willReturnCallback(function (string $gid) use ($group1, $group2, $group3) { |
|
1035 | + ->willReturnCallback(function(string $gid) use ($group1, $group2, $group3) { |
|
1036 | 1036 | if ($gid === $group1['cn']) { |
1037 | 1037 | return $group1['dn'][0]; |
1038 | 1038 | } |
@@ -1248,11 +1248,11 @@ discard block |
||
1248 | 1248 | $base = 'dc=species,dc=earth'; |
1249 | 1249 | |
1250 | 1250 | $birdsDn = [ |
1251 | - 'uid=3723,' . $base, |
|
1252 | - 'uid=8372,' . $base, |
|
1253 | - 'uid=8427,' . $base, |
|
1254 | - 'uid=2333,' . $base, |
|
1255 | - 'uid=4754,' . $base, |
|
1251 | + 'uid=3723,'.$base, |
|
1252 | + 'uid=8372,'.$base, |
|
1253 | + 'uid=8427,'.$base, |
|
1254 | + 'uid=2333,'.$base, |
|
1255 | + 'uid=4754,'.$base, |
|
1256 | 1256 | ]; |
1257 | 1257 | $birdsUid = [ |
1258 | 1258 | '3723', |
@@ -1262,51 +1262,51 @@ discard block |
||
1262 | 1262 | '4754', |
1263 | 1263 | ]; |
1264 | 1264 | $animalsDn = [ |
1265 | - 'uid=lion,' . $base, |
|
1266 | - 'uid=tiger,' . $base, |
|
1265 | + 'uid=lion,'.$base, |
|
1266 | + 'uid=tiger,'.$base, |
|
1267 | 1267 | ]; |
1268 | 1268 | $plantsDn = [ |
1269 | - 'uid=flower,' . $base, |
|
1270 | - 'uid=tree,' . $base, |
|
1269 | + 'uid=flower,'.$base, |
|
1270 | + 'uid=tree,'.$base, |
|
1271 | 1271 | ]; |
1272 | 1272 | $thingsDn = [ |
1273 | - 'uid=thing1,' . $base, |
|
1274 | - 'uid=thing2,' . $base, |
|
1273 | + 'uid=thing1,'.$base, |
|
1274 | + 'uid=thing2,'.$base, |
|
1275 | 1275 | ]; |
1276 | 1276 | |
1277 | 1277 | return [ |
1278 | - [ #0 – test DNs |
|
1279 | - ['cn=Birds,' . $base => $birdsDn], |
|
1280 | - ['cn=Birds,' . $base => $birdsDn] |
|
1278 | + [#0 – test DNs |
|
1279 | + ['cn=Birds,'.$base => $birdsDn], |
|
1280 | + ['cn=Birds,'.$base => $birdsDn] |
|
1281 | 1281 | ], |
1282 | - [ #1 – test uids |
|
1283 | - ['cn=Birds,' . $base => $birdsUid], |
|
1284 | - ['cn=Birds,' . $base => $birdsUid] |
|
1282 | + [#1 – test uids |
|
1283 | + ['cn=Birds,'.$base => $birdsUid], |
|
1284 | + ['cn=Birds,'.$base => $birdsUid] |
|
1285 | 1285 | ], |
1286 | - [ #2 – test simple nested group |
|
1287 | - ['cn=Animals,' . $base => array_merge($birdsDn, $animalsDn)], |
|
1286 | + [#2 – test simple nested group |
|
1287 | + ['cn=Animals,'.$base => array_merge($birdsDn, $animalsDn)], |
|
1288 | 1288 | [ |
1289 | - 'cn=Animals,' . $base => array_merge(['cn=Birds,' . $base], $animalsDn), |
|
1290 | - 'cn=Birds,' . $base => $birdsDn, |
|
1289 | + 'cn=Animals,'.$base => array_merge(['cn=Birds,'.$base], $animalsDn), |
|
1290 | + 'cn=Birds,'.$base => $birdsDn, |
|
1291 | 1291 | ] |
1292 | 1292 | ], |
1293 | - [ #3 – test recursive nested group |
|
1293 | + [#3 – test recursive nested group |
|
1294 | 1294 | [ |
1295 | - 'cn=Animals,' . $base => array_merge($birdsDn, $animalsDn), |
|
1296 | - 'cn=Birds,' . $base => array_merge($birdsDn, $animalsDn), |
|
1295 | + 'cn=Animals,'.$base => array_merge($birdsDn, $animalsDn), |
|
1296 | + 'cn=Birds,'.$base => array_merge($birdsDn, $animalsDn), |
|
1297 | 1297 | ], |
1298 | 1298 | [ |
1299 | - 'cn=Animals,' . $base => array_merge(['cn=Birds,' . $base,'cn=Birds,' . $base,'cn=Animals,' . $base], $animalsDn), |
|
1300 | - 'cn=Birds,' . $base => array_merge(['cn=Animals,' . $base,'cn=Birds,' . $base], $birdsDn), |
|
1299 | + 'cn=Animals,'.$base => array_merge(['cn=Birds,'.$base, 'cn=Birds,'.$base, 'cn=Animals,'.$base], $animalsDn), |
|
1300 | + 'cn=Birds,'.$base => array_merge(['cn=Animals,'.$base, 'cn=Birds,'.$base], $birdsDn), |
|
1301 | 1301 | ] |
1302 | 1302 | ], |
1303 | - [ #4 – Complicated nested group |
|
1304 | - ['cn=Things,' . $base => array_merge($birdsDn, $animalsDn, $thingsDn, $plantsDn)], |
|
1303 | + [#4 – Complicated nested group |
|
1304 | + ['cn=Things,'.$base => array_merge($birdsDn, $animalsDn, $thingsDn, $plantsDn)], |
|
1305 | 1305 | [ |
1306 | - 'cn=Animals,' . $base => array_merge(['cn=Birds,' . $base], $animalsDn), |
|
1307 | - 'cn=Birds,' . $base => $birdsDn, |
|
1308 | - 'cn=Plants,' . $base => $plantsDn, |
|
1309 | - 'cn=Things,' . $base => array_merge(['cn=Animals,' . $base,'cn=Plants,' . $base], $thingsDn), |
|
1306 | + 'cn=Animals,'.$base => array_merge(['cn=Birds,'.$base], $animalsDn), |
|
1307 | + 'cn=Birds,'.$base => $birdsDn, |
|
1308 | + 'cn=Plants,'.$base => $plantsDn, |
|
1309 | + 'cn=Things,'.$base => array_merge(['cn=Animals,'.$base, 'cn=Plants,'.$base], $thingsDn), |
|
1310 | 1310 | ] |
1311 | 1311 | ], |
1312 | 1312 | ]; |
@@ -1316,7 +1316,7 @@ discard block |
||
1316 | 1316 | public function testGroupMembers(array $expectedResult, array $groupsInfo): void { |
1317 | 1317 | $this->access->expects($this->any()) |
1318 | 1318 | ->method('readAttribute') |
1319 | - ->willReturnCallback(function ($group) use ($groupsInfo) { |
|
1319 | + ->willReturnCallback(function($group) use ($groupsInfo) { |
|
1320 | 1320 | if (isset($groupsInfo[$group])) { |
1321 | 1321 | return $groupsInfo[$group]; |
1322 | 1322 | } |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | |
1326 | 1326 | $this->access->connection->expects($this->any()) |
1327 | 1327 | ->method('__get') |
1328 | - ->willReturnCallback(function (string $name) { |
|
1328 | + ->willReturnCallback(function(string $name) { |
|
1329 | 1329 | if ($name === 'ldapNestedGroups') { |
1330 | 1330 | return 1; |
1331 | 1331 | } elseif ($name === 'ldapGroupMemberAssocAttr') { |
@@ -1352,7 +1352,7 @@ discard block |
||
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | #[\PHPUnit\Framework\Attributes\DataProvider('displayNameProvider')] |
1355 | - public function testGetDisplayName(string $expected, bool|array $ldapResult): void { |
|
1355 | + public function testGetDisplayName(string $expected, bool | array $ldapResult): void { |
|
1356 | 1356 | $gid = 'graphic_novelists'; |
1357 | 1357 | |
1358 | 1358 | $this->access->expects($this->atLeastOnce()) |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | |
1362 | 1362 | $this->access->connection->expects($this->any()) |
1363 | 1363 | ->method('__get') |
1364 | - ->willReturnCallback(function ($name) { |
|
1364 | + ->willReturnCallback(function($name) { |
|
1365 | 1365 | if ($name === 'ldapGroupMemberAssocAttr') { |
1366 | 1366 | return 'member'; |
1367 | 1367 | } elseif ($name === 'ldapGroupFilter') { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | } |
221 | 221 | |
222 | 222 | #[\PHPUnit\Framework\Attributes\DataProvider('dnInputDataProvider')] |
223 | - public function testStringResemblesDN(string $input, array|bool $interResult, bool $expectedResult): void { |
|
223 | + public function testStringResemblesDN(string $input, array | bool $interResult, bool $expectedResult): void { |
|
224 | 224 | [$lw, $con, $um, $helper] = $this->getConnectorAndLdapMock(); |
225 | 225 | /** @var IConfig&MockObject $config */ |
226 | 226 | $config = $this->createMock(IConfig::class); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | $lw->expects($this->exactly(1)) |
230 | 230 | ->method('explodeDN') |
231 | - ->willReturnCallback(function ($dn) use ($input, $interResult) { |
|
231 | + ->willReturnCallback(function($dn) use ($input, $interResult) { |
|
232 | 232 | if ($dn === $input) { |
233 | 233 | return $interResult; |
234 | 234 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | |
241 | 241 | #[\PHPUnit\Framework\Attributes\DataProvider('dnInputDataProvider')] |
242 | - public function testStringResemblesDNLDAPmod(string $input, array|bool $interResult, bool $expectedResult): void { |
|
242 | + public function testStringResemblesDNLDAPmod(string $input, array | bool $interResult, bool $expectedResult): void { |
|
243 | 243 | [, $con, $um, $helper] = $this->getConnectorAndLdapMock(); |
244 | 244 | /** @var IConfig&MockObject $config */ |
245 | 245 | $config = $this->createMock(IConfig::class); |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | ->willReturn($fakeConnection); |
518 | 518 | $this->connection->expects($this->any()) |
519 | 519 | ->method('__get') |
520 | - ->willReturnCallback(function ($key) use ($base) { |
|
520 | + ->willReturnCallback(function($key) use ($base) { |
|
521 | 521 | if (stripos($key, 'base') !== false) { |
522 | 522 | return [$base]; |
523 | 523 | } |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $this->ldap |
528 | 528 | ->expects($this->any()) |
529 | 529 | ->method('isResource') |
530 | - ->willReturnCallback(function ($resource) { |
|
530 | + ->willReturnCallback(function($resource) { |
|
531 | 531 | return is_object($resource); |
532 | 532 | }); |
533 | 533 | $this->ldap |
@@ -558,10 +558,10 @@ discard block |
||
558 | 558 | $fakeLdapEntries = [ |
559 | 559 | 'count' => 2, |
560 | 560 | [ |
561 | - 'dn' => 'uid=sgarth,' . $base, |
|
561 | + 'dn' => 'uid=sgarth,'.$base, |
|
562 | 562 | ], |
563 | 563 | [ |
564 | - 'dn' => 'uid=wwilson,' . $base, |
|
564 | + 'dn' => 'uid=wwilson,'.$base, |
|
565 | 565 | ] |
566 | 566 | ]; |
567 | 567 | |
@@ -585,18 +585,18 @@ discard block |
||
585 | 585 | $fakeLdapEntries = [ |
586 | 586 | 'count' => 2, |
587 | 587 | [ |
588 | - 'dn' => 'uid=sgarth,' . $base, |
|
589 | - 'uid' => [ 'sgarth' ], |
|
588 | + 'dn' => 'uid=sgarth,'.$base, |
|
589 | + 'uid' => ['sgarth'], |
|
590 | 590 | ], |
591 | 591 | [ |
592 | - 'dn' => 'uid=wwilson,' . $base, |
|
593 | - 'uid' => [ 'wwilson' ], |
|
592 | + 'dn' => 'uid=wwilson,'.$base, |
|
593 | + 'uid' => ['wwilson'], |
|
594 | 594 | ] |
595 | 595 | ]; |
596 | 596 | $expected = $fakeLdapEntries; |
597 | 597 | unset($expected['count']); |
598 | - array_walk($expected, function (&$v): void { |
|
599 | - $v['dn'] = [$v['dn']]; // dn is translated into an array internally for consistency |
|
598 | + array_walk($expected, function(&$v): void { |
|
599 | + $v['dn'] = [$v['dn']]; // dn is translated into an array internally for consistency |
|
600 | 600 | }); |
601 | 601 | |
602 | 602 | $this->prepareMocksForSearchTests($base, $fakeConnection, $fakeSearchResultResource, $fakeLdapEntries); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | |
609 | 609 | $this->userMapper->expects($this->exactly($fakeLdapEntries['count'])) |
610 | 610 | ->method('getNameByDN') |
611 | - ->willReturnCallback(function ($fdn) { |
|
611 | + ->willReturnCallback(function($fdn) { |
|
612 | 612 | $parts = ldap_explode_dn($fdn, 0); |
613 | 613 | return $parts[0]; |
614 | 614 | }); |
@@ -628,11 +628,11 @@ discard block |
||
628 | 628 | $fakeLdapEntries = [ |
629 | 629 | 'count' => 2, |
630 | 630 | [ |
631 | - 'dn' => 'cn=Good Team,' . $base, |
|
631 | + 'dn' => 'cn=Good Team,'.$base, |
|
632 | 632 | 'cn' => ['Good Team'], |
633 | 633 | ], |
634 | 634 | [ |
635 | - 'dn' => 'cn=Another Good Team,' . $base, |
|
635 | + 'dn' => 'cn=Another Good Team,'.$base, |
|
636 | 636 | 'cn' => ['Another Good Team'], |
637 | 637 | ] |
638 | 638 | ]; |
@@ -642,8 +642,8 @@ discard block |
||
642 | 642 | $this->groupMapper->expects($this->any()) |
643 | 643 | ->method('getListOfIdsByDn') |
644 | 644 | ->willReturn([ |
645 | - 'cn=Good Team,' . $base => 'Good_Team', |
|
646 | - 'cn=Another Good Team,' . $base => 'Another_Good_Team', |
|
645 | + 'cn=Good Team,'.$base => 'Good_Team', |
|
646 | + 'cn=Another Good Team,'.$base => 'Another_Good_Team', |
|
647 | 647 | ]); |
648 | 648 | $this->groupMapper->expects($this->never()) |
649 | 649 | ->method('getNameByDN'); |
@@ -711,8 +711,8 @@ discard block |
||
711 | 711 | $this->connection->expects($this->any()) |
712 | 712 | ->method('__get') |
713 | 713 | ->willReturnMap([ |
714 | - [ 'ldapUserDisplayName', 'displayName' ], |
|
715 | - [ 'ldapUserDisplayName2', null], |
|
714 | + ['ldapUserDisplayName', 'displayName'], |
|
715 | + ['ldapUserDisplayName2', null], |
|
716 | 716 | ]); |
717 | 717 | |
718 | 718 | $offlineUserMock = $this->createMock(OfflineUser::class); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | #[\PHPUnit\Framework\Attributes\DataProvider('errorProvider')] |
37 | 37 | public function testSearchWithErrorHandler(string $errorMessage, bool $passThrough): void { |
38 | 38 | $wasErrorHandlerCalled = false; |
39 | - $errorHandler = function ($number, $message, $file, $line) use (&$wasErrorHandlerCalled): void { |
|
39 | + $errorHandler = function($number, $message, $file, $line) use (&$wasErrorHandlerCalled): void { |
|
40 | 40 | $wasErrorHandlerCalled = true; |
41 | 41 | }; |
42 | 42 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ->expects($this->once()) |
47 | 47 | ->method('invokeLDAPMethod') |
48 | 48 | ->with('search', $this->anything(), $this->anything(), $this->anything(), $this->anything(), $this->anything()) |
49 | - ->willReturnCallback(function () use ($errorMessage): void { |
|
49 | + ->willReturnCallback(function() use ($errorMessage): void { |
|
50 | 50 | trigger_error($errorMessage); |
51 | 51 | }); |
52 | 52 |
@@ -87,7 +87,7 @@ |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | #[\PHPUnit\Framework\Attributes\DataProvider('configurationDataProvider')] |
90 | - public function testSetValue(string $key, string|array $input, string|array $expected): void { |
|
90 | + public function testSetValue(string $key, string | array $input, string | array $expected): void { |
|
91 | 91 | $this->configuration->setConfiguration([$key => $input]); |
92 | 92 | $this->assertSame($this->configuration->$key, $expected); |
93 | 93 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | private function prepareMockForUserExists(): void { |
85 | 85 | $this->access->expects($this->any()) |
86 | 86 | ->method('username2dn') |
87 | - ->willReturnCallback(function ($uid) { |
|
87 | + ->willReturnCallback(function($uid) { |
|
88 | 88 | switch ($uid) { |
89 | 89 | case 'gunslinger': |
90 | 90 | return 'dnOfRoland,dc=test'; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | private function prepareAccessForCheckPassword(bool $noDisplayName = false): void { |
114 | 114 | $this->connection->expects($this->any()) |
115 | 115 | ->method('__get') |
116 | - ->willReturnCallback(function ($name) { |
|
116 | + ->willReturnCallback(function($name) { |
|
117 | 117 | if ($name === 'ldapLoginFilter') { |
118 | 118 | return '%uid'; |
119 | 119 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | $this->access->expects($this->any()) |
124 | 124 | ->method('fetchListOfUsers') |
125 | - ->willReturnCallback(function ($filter) { |
|
125 | + ->willReturnCallback(function($filter) { |
|
126 | 126 | if ($filter === 'roland') { |
127 | 127 | return [['dn' => ['dnOfRoland,dc=test']]]; |
128 | 128 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | }); |
131 | 131 | $this->access->expects($this->any()) |
132 | 132 | ->method('fetchUsersByLoginName') |
133 | - ->willReturnCallback(function ($uid) { |
|
133 | + ->willReturnCallback(function($uid) { |
|
134 | 134 | if ($uid === 'roland') { |
135 | 135 | return [['dn' => ['dnOfRoland,dc=test']]]; |
136 | 136 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ->willReturn(true); |
156 | 156 | $this->access->expects($this->any()) |
157 | 157 | ->method('areCredentialsValid') |
158 | - ->willReturnCallback(function ($dn, $pwd) { |
|
158 | + ->willReturnCallback(function($dn, $pwd) { |
|
159 | 159 | if ($pwd === 'dt19') { |
160 | 160 | return true; |
161 | 161 | } |
@@ -349,22 +349,22 @@ discard block |
||
349 | 349 | private function prepareAccessForGetUsers() { |
350 | 350 | $this->access->expects($this->once()) |
351 | 351 | ->method('escapeFilterPart') |
352 | - ->willReturnCallback(function ($search) { |
|
352 | + ->willReturnCallback(function($search) { |
|
353 | 353 | return $search; |
354 | 354 | }); |
355 | 355 | $this->access->expects($this->any()) |
356 | 356 | ->method('getFilterPartForUserSearch') |
357 | - ->willReturnCallback(function ($search) { |
|
357 | + ->willReturnCallback(function($search) { |
|
358 | 358 | return $search; |
359 | 359 | }); |
360 | 360 | $this->access->expects($this->any()) |
361 | 361 | ->method('combineFilterWithAnd') |
362 | - ->willReturnCallback(function ($param) { |
|
362 | + ->willReturnCallback(function($param) { |
|
363 | 363 | return $param[2]; |
364 | 364 | }); |
365 | 365 | $this->access->expects($this->any()) |
366 | 366 | ->method('fetchListOfUsers') |
367 | - ->willReturnCallback(function ($search, $a, $l, $o) { |
|
367 | + ->willReturnCallback(function($search, $a, $l, $o) { |
|
368 | 368 | $users = ['gunslinger', 'newyorker', 'ladyofshadows']; |
369 | 369 | if (empty($search)) { |
370 | 370 | $result = $users; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | |
435 | 435 | private function getUsers($search = '', $limit = null, $offset = null) { |
436 | 436 | $users = Server::get(IUserManager::class)->search($search, $limit, $offset); |
437 | - $uids = array_map(function (IUser $user) { |
|
437 | + $uids = array_map(function(IUser $user) { |
|
438 | 438 | return $user->getUID(); |
439 | 439 | }, $users); |
440 | 440 | return $uids; |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | |
537 | 537 | $this->access->expects($this->any()) |
538 | 538 | ->method('readAttribute') |
539 | - ->willReturnCallback(function ($dn) { |
|
539 | + ->willReturnCallback(function($dn) { |
|
540 | 540 | if ($dn === 'dnOfRoland,dc=test') { |
541 | 541 | return []; |
542 | 542 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | |
562 | 562 | $this->access->expects($this->any()) |
563 | 563 | ->method('readAttribute') |
564 | - ->willReturnCallback(function ($dn) { |
|
564 | + ->willReturnCallback(function($dn) { |
|
565 | 565 | if ($dn === 'dnOfRoland,dc=test') { |
566 | 566 | return []; |
567 | 567 | } |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | |
597 | 597 | $this->connection->expects($this->any()) |
598 | 598 | ->method('__get') |
599 | - ->willReturnCallback(function ($name) { |
|
599 | + ->willReturnCallback(function($name) { |
|
600 | 600 | if ($name === 'homeFolderNamingRule') { |
601 | 601 | return 'attr:testAttribute'; |
602 | 602 | } |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | |
606 | 606 | $this->access->expects($this->any()) |
607 | 607 | ->method('readAttribute') |
608 | - ->willReturnCallback(function ($dn, $attr) { |
|
608 | + ->willReturnCallback(function($dn, $attr) { |
|
609 | 609 | switch ($dn) { |
610 | 610 | case 'dnOfRoland,dc=test': |
611 | 611 | if ($attr === 'testAttribute') { |
@@ -649,11 +649,11 @@ discard block |
||
649 | 649 | $this->prepareMockForUserExists(); |
650 | 650 | |
651 | 651 | $dataDir = Server::get(IConfig::class)->getSystemValue( |
652 | - 'datadirectory', \OC::$SERVERROOT . '/data'); |
|
652 | + 'datadirectory', \OC::$SERVERROOT.'/data'); |
|
653 | 653 | |
654 | 654 | $this->connection->expects($this->any()) |
655 | 655 | ->method('__get') |
656 | - ->willReturnCallback(function ($name) { |
|
656 | + ->willReturnCallback(function($name) { |
|
657 | 657 | if ($name === 'homeFolderNamingRule') { |
658 | 658 | return 'attr:testAttribute'; |
659 | 659 | } |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | |
663 | 663 | $this->access->expects($this->any()) |
664 | 664 | ->method('readAttribute') |
665 | - ->willReturnCallback(function ($dn, $attr) { |
|
665 | + ->willReturnCallback(function($dn, $attr) { |
|
666 | 666 | switch ($dn) { |
667 | 667 | case 'dnOfLadyOfShadows,dc=test': |
668 | 668 | if ($attr === 'testAttribute') { |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | ->willReturn('dnOfLadyOfShadows,dc=test'); |
685 | 685 | $user->expects($this->any()) |
686 | 686 | ->method('getHomePath') |
687 | - ->willReturn($dataDir . '/susannah/'); |
|
687 | + ->willReturn($dataDir.'/susannah/'); |
|
688 | 688 | |
689 | 689 | $this->userManager->expects($this->atLeastOnce()) |
690 | 690 | ->method('get') |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | |
697 | 697 | /** @noinspection PhpUnhandledExceptionInspection */ |
698 | 698 | $result = $backend->getHome('ladyofshadows'); |
699 | - $this->assertEquals($dataDir . '/susannah/', $result); |
|
699 | + $this->assertEquals($dataDir.'/susannah/', $result); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | |
709 | 709 | $this->connection->expects($this->any()) |
710 | 710 | ->method('__get') |
711 | - ->willReturnCallback(function ($name) { |
|
711 | + ->willReturnCallback(function($name) { |
|
712 | 712 | if ($name === 'homeFolderNamingRule') { |
713 | 713 | return 'attr:testAttribute'; |
714 | 714 | } |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | }); |
717 | 717 | $this->access->expects($this->any()) |
718 | 718 | ->method('readAttribute') |
719 | - ->willReturnCallback(function ($dn, $attr) { |
|
719 | + ->willReturnCallback(function($dn, $attr) { |
|
720 | 720 | switch ($dn) { |
721 | 721 | default: |
722 | 722 | return false; |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | |
754 | 754 | $this->connection->expects($this->any()) |
755 | 755 | ->method('__get') |
756 | - ->willReturnCallback(function ($name) { |
|
756 | + ->willReturnCallback(function($name) { |
|
757 | 757 | if ($name === 'homeFolderNamingRule') { |
758 | 758 | return 'attr:testAttribute'; |
759 | 759 | } |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | |
801 | 801 | $this->connection->expects($this->any()) |
802 | 802 | ->method('getFromCache') |
803 | - ->willReturnCallback(function ($uid) { |
|
803 | + ->willReturnCallback(function($uid) { |
|
804 | 804 | return true; |
805 | 805 | }); |
806 | 806 | |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | private function prepareAccessForGetDisplayName() { |
812 | 812 | $this->connection->expects($this->any()) |
813 | 813 | ->method('__get') |
814 | - ->willReturnCallback(function ($name) { |
|
814 | + ->willReturnCallback(function($name) { |
|
815 | 815 | if ($name === 'ldapUserDisplayName') { |
816 | 816 | return 'displayname'; |
817 | 817 | } elseif ($name === 'ldapUserDisplayName2') { |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | |
823 | 823 | $this->access->expects($this->any()) |
824 | 824 | ->method('readAttribute') |
825 | - ->willReturnCallback(function ($dn, $attr) { |
|
825 | + ->willReturnCallback(function($dn, $attr) { |
|
826 | 826 | switch ($dn) { |
827 | 827 | case 'dnOfRoland,dc=test': |
828 | 828 | if ($attr === 'displayname') { |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | |
847 | 847 | $this->connection->expects($this->any()) |
848 | 848 | ->method('getConnectionResource') |
849 | - ->willReturnCallback(function () { |
|
849 | + ->willReturnCallback(function() { |
|
850 | 850 | return true; |
851 | 851 | }); |
852 | 852 | |
@@ -868,13 +868,13 @@ discard block |
||
868 | 868 | $mapper = $this->createMock(UserMapping::class); |
869 | 869 | $mapper->expects($this->any()) |
870 | 870 | ->method('getUUIDByDN') |
871 | - ->willReturnCallback(function ($dn) { |
|
871 | + ->willReturnCallback(function($dn) { |
|
872 | 872 | return $dn; |
873 | 873 | }); |
874 | 874 | |
875 | 875 | $this->userManager->expects($this->any()) |
876 | 876 | ->method('get') |
877 | - ->willReturnCallback(function ($uid) use ($user1, $user2) { |
|
877 | + ->willReturnCallback(function($uid) use ($user1, $user2) { |
|
878 | 878 | if ($uid === 'gunslinger') { |
879 | 879 | return $user1; |
880 | 880 | } elseif ($uid === 'newyorker') { |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | }); |
885 | 885 | $this->userManager->expects($this->any()) |
886 | 886 | ->method('exists') |
887 | - ->willReturnCallback(function ($uid) use ($user1, $user2) { |
|
887 | + ->willReturnCallback(function($uid) use ($user1, $user2) { |
|
888 | 888 | if ($uid === 'gunslinger') { |
889 | 889 | return true; |
890 | 890 | } elseif ($uid === 'newyorker') { |
@@ -897,8 +897,8 @@ discard block |
||
897 | 897 | ->willReturn($mapper); |
898 | 898 | $this->access->expects($this->any()) |
899 | 899 | ->method('getUserDnByUuid') |
900 | - ->willReturnCallback(function ($uuid) { |
|
901 | - return $uuid . '1'; |
|
900 | + ->willReturnCallback(function($uuid) { |
|
901 | + return $uuid.'1'; |
|
902 | 902 | }); |
903 | 903 | |
904 | 904 | //with displayName |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | public function testGetDisplayNamePublicAPI(): void { |
914 | 914 | $this->access->expects($this->any()) |
915 | 915 | ->method('username2dn') |
916 | - ->willReturnCallback(function ($uid) { |
|
916 | + ->willReturnCallback(function($uid) { |
|
917 | 917 | switch ($uid) { |
918 | 918 | case 'gunslinger': |
919 | 919 | return 'dnOfRoland,dc=test'; |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | |
938 | 938 | $this->connection->expects($this->any()) |
939 | 939 | ->method('getConnectionResource') |
940 | - ->willReturnCallback(function () { |
|
940 | + ->willReturnCallback(function() { |
|
941 | 941 | return true; |
942 | 942 | }); |
943 | 943 | |
@@ -961,13 +961,13 @@ discard block |
||
961 | 961 | $mapper = $this->createMock(UserMapping::class); |
962 | 962 | $mapper->expects($this->any()) |
963 | 963 | ->method('getUUIDByDN') |
964 | - ->willReturnCallback(function ($dn) { |
|
964 | + ->willReturnCallback(function($dn) { |
|
965 | 965 | return $dn; |
966 | 966 | }); |
967 | 967 | |
968 | 968 | $this->userManager->expects($this->any()) |
969 | 969 | ->method('get') |
970 | - ->willReturnCallback(function ($uid) use ($user1, $user2) { |
|
970 | + ->willReturnCallback(function($uid) use ($user1, $user2) { |
|
971 | 971 | if ($uid === 'gunslinger') { |
972 | 972 | return $user1; |
973 | 973 | } elseif ($uid === 'newyorker') { |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | }); |
978 | 978 | $this->userManager->expects($this->any()) |
979 | 979 | ->method('exists') |
980 | - ->willReturnCallback(function ($uid) use ($user1, $user2) { |
|
980 | + ->willReturnCallback(function($uid) use ($user1, $user2) { |
|
981 | 981 | if ($uid === 'gunslinger') { |
982 | 982 | return true; |
983 | 983 | } elseif ($uid === 'newyorker') { |
@@ -990,8 +990,8 @@ discard block |
||
990 | 990 | ->willReturn($mapper); |
991 | 991 | $this->access->expects($this->any()) |
992 | 992 | ->method('getUserDnByUuid') |
993 | - ->willReturnCallback(function ($uuid) { |
|
994 | - return $uuid . '1'; |
|
993 | + ->willReturnCallback(function($uuid) { |
|
994 | + return $uuid.'1'; |
|
995 | 995 | }); |
996 | 996 | |
997 | 997 | //with displayName |
@@ -1073,11 +1073,11 @@ discard block |
||
1073 | 1073 | |
1074 | 1074 | $this->connection->expects($this->exactly(2)) |
1075 | 1075 | ->method('getFromCache') |
1076 | - ->with($this->equalTo('loginName2UserName-' . $loginName)) |
|
1076 | + ->with($this->equalTo('loginName2UserName-'.$loginName)) |
|
1077 | 1077 | ->willReturnOnConsecutiveCalls(null, $username); |
1078 | 1078 | $this->connection->expects($this->once()) |
1079 | 1079 | ->method('writeToCache') |
1080 | - ->with($this->equalTo('loginName2UserName-' . $loginName), $this->equalTo($username)); |
|
1080 | + ->with($this->equalTo('loginName2UserName-'.$loginName), $this->equalTo($username)); |
|
1081 | 1081 | |
1082 | 1082 | $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
1083 | 1083 | $user = $this->createMock(User::class); |
@@ -1116,11 +1116,11 @@ discard block |
||
1116 | 1116 | |
1117 | 1117 | $this->connection->expects($this->exactly(2)) |
1118 | 1118 | ->method('getFromCache') |
1119 | - ->with($this->equalTo('loginName2UserName-' . $loginName)) |
|
1119 | + ->with($this->equalTo('loginName2UserName-'.$loginName)) |
|
1120 | 1120 | ->willReturnOnConsecutiveCalls(null, false); |
1121 | 1121 | $this->connection->expects($this->once()) |
1122 | 1122 | ->method('writeToCache') |
1123 | - ->with($this->equalTo('loginName2UserName-' . $loginName), false); |
|
1123 | + ->with($this->equalTo('loginName2UserName-'.$loginName), false); |
|
1124 | 1124 | |
1125 | 1125 | $this->userManager->expects($this->any()) |
1126 | 1126 | ->method('getAttributes') |
@@ -1149,11 +1149,11 @@ discard block |
||
1149 | 1149 | |
1150 | 1150 | $this->connection->expects($this->exactly(2)) |
1151 | 1151 | ->method('getFromCache') |
1152 | - ->with($this->equalTo('loginName2UserName-' . $loginName)) |
|
1152 | + ->with($this->equalTo('loginName2UserName-'.$loginName)) |
|
1153 | 1153 | ->willReturnOnConsecutiveCalls(null, false); |
1154 | 1154 | $this->connection->expects($this->once()) |
1155 | 1155 | ->method('writeToCache') |
1156 | - ->with($this->equalTo('loginName2UserName-' . $loginName), $this->equalTo(false)); |
|
1156 | + ->with($this->equalTo('loginName2UserName-'.$loginName), $this->equalTo(false)); |
|
1157 | 1157 | |
1158 | 1158 | $this->userManager->expects($this->any()) |
1159 | 1159 | ->method('get') |
@@ -1177,19 +1177,19 @@ discard block |
||
1177 | 1177 | private function prepareAccessForSetPassword($enablePasswordChange = true) { |
1178 | 1178 | $this->connection->expects($this->any()) |
1179 | 1179 | ->method('__get') |
1180 | - ->willReturnCallback(function ($name) use (&$enablePasswordChange) { |
|
1180 | + ->willReturnCallback(function($name) use (&$enablePasswordChange) { |
|
1181 | 1181 | if ($name === 'ldapLoginFilter') { |
1182 | 1182 | return '%uid'; |
1183 | 1183 | } |
1184 | 1184 | if ($name === 'turnOnPasswordChange') { |
1185 | - return $enablePasswordChange?1:0; |
|
1185 | + return $enablePasswordChange ? 1 : 0; |
|
1186 | 1186 | } |
1187 | 1187 | return null; |
1188 | 1188 | }); |
1189 | 1189 | $this->connection->expects($this->any()) |
1190 | 1190 | ->method('getFromCache') |
1191 | - ->willReturnCallback(function ($uid) { |
|
1192 | - if ($uid === 'userExists' . 'roland') { |
|
1191 | + ->willReturnCallback(function($uid) { |
|
1192 | + if ($uid === 'userExists'.'roland') { |
|
1193 | 1193 | return true; |
1194 | 1194 | } |
1195 | 1195 | return null; |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | $this->access->expects($this->any()) |
1199 | 1199 | ->method('fetchListOfUsers') |
1200 | - ->willReturnCallback(function ($filter) { |
|
1200 | + ->willReturnCallback(function($filter) { |
|
1201 | 1201 | if ($filter === 'roland') { |
1202 | 1202 | return [['dn' => ['dnOfRoland,dc=test']]]; |
1203 | 1203 | } |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | }); |
1206 | 1206 | $this->access->expects($this->any()) |
1207 | 1207 | ->method('fetchUsersByLoginName') |
1208 | - ->willReturnCallback(function ($uid) { |
|
1208 | + ->willReturnCallback(function($uid) { |
|
1209 | 1209 | if ($uid === 'roland') { |
1210 | 1210 | return [['dn' => ['dnOfRoland,dc=test']]]; |
1211 | 1211 | } |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | ->willReturn(true); |
1222 | 1222 | $this->access->expects($this->any()) |
1223 | 1223 | ->method('setPassword') |
1224 | - ->willReturnCallback(function ($uid, $password) { |
|
1224 | + ->willReturnCallback(function($uid, $password) { |
|
1225 | 1225 | if (strlen($password) <= 5) { |
1226 | 1226 | throw new HintException('Password fails quality checking policy', '', 19); |
1227 | 1227 | } |
@@ -1319,15 +1319,15 @@ discard block |
||
1319 | 1319 | |
1320 | 1320 | public static function avatarDataProvider(): array { |
1321 | 1321 | return [ |
1322 | - [ 'validImageData', false ], |
|
1323 | - [ 'corruptImageData', true ], |
|
1324 | - [ false, true] |
|
1322 | + ['validImageData', false], |
|
1323 | + ['corruptImageData', true], |
|
1324 | + [false, true] |
|
1325 | 1325 | ]; |
1326 | 1326 | } |
1327 | 1327 | |
1328 | 1328 | #[\PHPUnit\Framework\Attributes\DataProvider('avatarDataProvider')] |
1329 | - public function testCanChangeAvatar(string|bool $imageData, bool $expected): void { |
|
1330 | - $isValidImage = str_starts_with((string)$imageData, 'valid'); |
|
1329 | + public function testCanChangeAvatar(string | bool $imageData, bool $expected): void { |
|
1330 | + $isValidImage = str_starts_with((string) $imageData, 'valid'); |
|
1331 | 1331 | |
1332 | 1332 | $user = $this->createMock(User::class); |
1333 | 1333 | $user->expects($this->once()) |
@@ -1442,16 +1442,16 @@ discard block |
||
1442 | 1442 | |
1443 | 1443 | public static function actionProvider(): array { |
1444 | 1444 | return [ |
1445 | - [ 'ldapUserAvatarRule', 'default', Backend::PROVIDE_AVATAR, true], |
|
1446 | - [ 'ldapUserAvatarRule', 'data:selfiePhoto', Backend::PROVIDE_AVATAR, true], |
|
1447 | - [ 'ldapUserAvatarRule', 'none', Backend::PROVIDE_AVATAR, false], |
|
1448 | - [ 'turnOnPasswordChange', 0, Backend::SET_PASSWORD, false], |
|
1449 | - [ 'turnOnPasswordChange', 1, Backend::SET_PASSWORD, true], |
|
1445 | + ['ldapUserAvatarRule', 'default', Backend::PROVIDE_AVATAR, true], |
|
1446 | + ['ldapUserAvatarRule', 'data:selfiePhoto', Backend::PROVIDE_AVATAR, true], |
|
1447 | + ['ldapUserAvatarRule', 'none', Backend::PROVIDE_AVATAR, false], |
|
1448 | + ['turnOnPasswordChange', 0, Backend::SET_PASSWORD, false], |
|
1449 | + ['turnOnPasswordChange', 1, Backend::SET_PASSWORD, true], |
|
1450 | 1450 | ]; |
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | #[\PHPUnit\Framework\Attributes\DataProvider('actionProvider')] |
1454 | - public function testImplementsAction(string $configurable, string|int $value, int $actionCode, bool $expected): void { |
|
1454 | + public function testImplementsAction(string $configurable, string | int $value, int $actionCode, bool $expected): void { |
|
1455 | 1455 | $this->pluginManager->expects($this->once()) |
1456 | 1456 | ->method('getImplementedActions') |
1457 | 1457 | ->willReturn(0); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | 0, 1000, 750 |
89 | 89 | ], |
90 | 90 | [ |
91 | - 22, 0, 50 |
|
91 | + 22, 0, 50 |
|
92 | 92 | ], |
93 | 93 | [ |
94 | 94 | 500, 500, 500 |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $this->config->expects($this->once()) |
108 | 108 | ->method('setAppValue') |
109 | 109 | ->with('user_ldap', 'background_sync_interval', $this->anything()) |
110 | - ->willReturnCallback(function ($a, $k, $interval) { |
|
110 | + ->willReturnCallback(function($a, $k, $interval) { |
|
111 | 111 | $this->assertTrue($interval >= SYNC::MIN_INTERVAL); |
112 | 112 | $this->assertTrue($interval <= SYNC::MAX_INTERVAL); |
113 | 113 | return true; |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | |
136 | 136 | public static function moreResultsProvider(): array { |
137 | 137 | return [ |
138 | - [ 3, 3, true ], |
|
139 | - [ 3, 5, true ], |
|
140 | - [ 3, 2, false], |
|
141 | - [ 0, 4, false], |
|
142 | - [ null, 4, false] |
|
138 | + [3, 3, true], |
|
139 | + [3, 5, true], |
|
140 | + [3, 2, false], |
|
141 | + [0, 4, false], |
|
142 | + [null, 4, false] |
|
143 | 143 | ]; |
144 | 144 | } |
145 | 145 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ->willReturn($connection); |
156 | 156 | $connection->expects($this->any()) |
157 | 157 | ->method('__get') |
158 | - ->willReturnCallback(function ($key) use ($pagingSize) { |
|
158 | + ->willReturnCallback(function($key) use ($pagingSize) { |
|
159 | 159 | if ($key === 'ldapPagingSize') { |
160 | 160 | return $pagingSize; |
161 | 161 | } |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | $lastCycle = ['prefix' => 's01', 'offset' => 1000]; |
192 | 192 | $lastCycle2 = ['prefix' => '', 'offset' => 1000]; |
193 | 193 | return [ |
194 | - [ null, ['s01'], ['prefix' => 's01', 'offset' => 0] ], |
|
195 | - [ null, [''], ['prefix' => '', 'offset' => 0] ], |
|
196 | - [ $lastCycle, ['s01', 's02'], ['prefix' => 's02', 'offset' => 0] ], |
|
197 | - [ $lastCycle, [''], ['prefix' => '', 'offset' => 0] ], |
|
198 | - [ $lastCycle2, ['', 's01'], ['prefix' => 's01', 'offset' => 0] ], |
|
199 | - [ $lastCycle, [], null ], |
|
194 | + [null, ['s01'], ['prefix' => 's01', 'offset' => 0]], |
|
195 | + [null, [''], ['prefix' => '', 'offset' => 0]], |
|
196 | + [$lastCycle, ['s01', 's02'], ['prefix' => 's02', 'offset' => 0]], |
|
197 | + [$lastCycle, [''], ['prefix' => '', 'offset' => 0]], |
|
198 | + [$lastCycle2, ['', 's01'], ['prefix' => 's01', 'offset' => 0]], |
|
199 | + [$lastCycle, [], null], |
|
200 | 200 | ]; |
201 | 201 | } |
202 | 202 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | ]; |
215 | 215 | $this->config->expects($this->exactly(2)) |
216 | 216 | ->method('setAppValue') |
217 | - ->willReturnCallback(function () use (&$calls): void { |
|
217 | + ->willReturnCallback(function() use (&$calls): void { |
|
218 | 218 | $expected = array_shift($calls); |
219 | 219 | $this->assertEquals($expected, func_get_args()); |
220 | 220 | }); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | public function testRun(array $runData): void { |
283 | 283 | $this->config->expects($this->any()) |
284 | 284 | ->method('getAppValue') |
285 | - ->willReturnCallback(function ($app, $key, $default) use ($runData) { |
|
285 | + ->willReturnCallback(function($app, $key, $default) use ($runData) { |
|
286 | 286 | if ($app === 'core' && $key === 'backgroundjobs_mode') { |
287 | 287 | return 'cron'; |
288 | 288 | } |
@@ -295,11 +295,11 @@ discard block |
||
295 | 295 | return $runData['scheduledCycle']['offset']; |
296 | 296 | } |
297 | 297 | // for qualifiesToRun() |
298 | - if ($key === $runData['scheduledCycle']['prefix'] . '_lastChange') { |
|
298 | + if ($key === $runData['scheduledCycle']['prefix'].'_lastChange') { |
|
299 | 299 | return time() - 60 * 40; |
300 | 300 | } |
301 | 301 | // for getMinPagingSize |
302 | - if ($key === $runData['scheduledCycle']['prefix'] . 'ldap_paging_size') { |
|
302 | + if ($key === $runData['scheduledCycle']['prefix'].'ldap_paging_size') { |
|
303 | 303 | return $runData['pagingSize']; |
304 | 304 | } |
305 | 305 | } |
@@ -314,14 +314,14 @@ discard block |
||
314 | 314 | ]; |
315 | 315 | $this->config->expects($this->exactly(3)) |
316 | 316 | ->method('setAppValue') |
317 | - ->willReturnCallback(function () use (&$calls): void { |
|
317 | + ->willReturnCallback(function() use (&$calls): void { |
|
318 | 318 | $expected = array_shift($calls); |
319 | 319 | $this->assertEquals($expected, func_get_args()); |
320 | 320 | }); |
321 | 321 | $this->config->expects($this->any()) |
322 | 322 | ->method('getAppKeys') |
323 | 323 | ->with('user_ldap') |
324 | - ->willReturn([$runData['scheduledCycle']['prefix'] . 'ldap_paging_size']); |
|
324 | + ->willReturn([$runData['scheduledCycle']['prefix'].'ldap_paging_size']); |
|
325 | 325 | |
326 | 326 | $this->helper->expects($this->any()) |
327 | 327 | ->method('getServerConfigurationPrefixes') |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | ->willReturn($connection); |
339 | 339 | $connection->expects($this->any()) |
340 | 340 | ->method('__get') |
341 | - ->willReturnCallback(function ($key) use ($runData) { |
|
341 | + ->willReturnCallback(function($key) use ($runData) { |
|
342 | 342 | if ($key === 'ldapPagingSize') { |
343 | 343 | return $runData['pagingSize']; |
344 | 344 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $shareAttributes = $this->createMock(IShareAttributes::class); |
64 | 64 | $shareAttributes->method('toArray')->willReturn($attrs); |
65 | 65 | $shareAttributes->method('getAttribute')->willReturnCallback( |
66 | - function ($scope, $key) use ($attrs) { |
|
66 | + function($scope, $key) use ($attrs) { |
|
67 | 67 | $result = null; |
68 | 68 | foreach ($attrs as $attr) { |
69 | 69 | if ($attr['key'] === $key && $attr['scope'] === $scope) { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ->method('getShareTime') |
101 | 101 | ->willReturn( |
102 | 102 | // compute share time based on id, simulating share order |
103 | - new \DateTime('@' . (1469193980 + 1000 * $id)) |
|
103 | + new \DateTime('@'.(1469193980 + 1000 * $id)) |
|
104 | 104 | ); |
105 | 105 | return $share; |
106 | 106 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | $this->shareManager->expects($this->any()) |
157 | 157 | ->method('newShare') |
158 | - ->willReturnCallback(function () use ($rootFolder, $userManager) { |
|
158 | + ->willReturnCallback(function() use ($rootFolder, $userManager) { |
|
159 | 159 | return new Share($rootFolder, $userManager); |
160 | 160 | }); |
161 | 161 | |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | $rootFolder = $this->createMock(IRootFolder::class); |
344 | 344 | $userManager = $this->createMock(IUserManager::class); |
345 | 345 | |
346 | - $userShares = array_map(function ($shareSpec) { |
|
346 | + $userShares = array_map(function($shareSpec) { |
|
347 | 347 | return $this->makeMockShare($shareSpec[0], $shareSpec[1], $shareSpec[2], $shareSpec[3], $shareSpec[4], $shareSpec[5]); |
348 | 348 | }, $userShares); |
349 | - $groupShares = array_map(function ($shareSpec) { |
|
349 | + $groupShares = array_map(function($shareSpec) { |
|
350 | 350 | return $this->makeMockShare($shareSpec[0], $shareSpec[1], $shareSpec[2], $shareSpec[3], $shareSpec[4], $shareSpec[5]); |
351 | 351 | }, $groupShares); |
352 | 352 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | |
373 | 373 | $this->shareManager->expects($this->any()) |
374 | 374 | ->method('newShare') |
375 | - ->willReturnCallback(function () use ($rootFolder, $userManager) { |
|
375 | + ->willReturnCallback(function() use ($rootFolder, $userManager) { |
|
376 | 376 | return new Share($rootFolder, $userManager); |
377 | 377 | }); |
378 | 378 |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | if (isset($storage['files_count'])) { |
88 | 88 | for ($i = 0; $i < $storage['files_count']; $i++) { |
89 | 89 | $filesQuery->setParameter('storage', $storage['numeric_id']); |
90 | - $filesQuery->setParameter('path', 'file' . $i); |
|
91 | - $filesQuery->setParameter('path_hash', md5('file' . $i)); |
|
90 | + $filesQuery->setParameter('path', 'file'.$i); |
|
91 | + $filesQuery->setParameter('path_hash', md5('file'.$i)); |
|
92 | 92 | $filesQuery->executeStatement(); |
93 | 93 | } |
94 | 94 | } |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | $output |
170 | 170 | ->expects($this->any()) |
171 | 171 | ->method('writeln') |
172 | - ->willReturnCallback(function (string $text) use (&$outputCalls): void { |
|
172 | + ->willReturnCallback(function(string $text) use (&$outputCalls): void { |
|
173 | 173 | $outputCalls[] = $text; |
174 | 174 | }); |
175 | 175 | |
176 | 176 | $this->cloudIdManager |
177 | 177 | ->expects($this->any()) |
178 | 178 | ->method('getCloudId') |
179 | - ->willReturnCallback(function (string $user, string $remote) { |
|
179 | + ->willReturnCallback(function(string $user, string $remote) { |
|
180 | 180 | $cloudIdMock = $this->createMock(ICloudId::class); |
181 | 181 | |
182 | 182 | // The remotes are already sanitized in the original data, so |