Completed
Push — master ( ca1fc2...aba39c )
by Joas
31:19 queued 16s
created
tests/lib/IntegrityCheck/CheckerTest.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 			->with('NotExistingApp/appinfo')
95 95
 			->willReturn(true);
96 96
 
97
-		$keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt');
98
-		$rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key');
97
+		$keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.crt');
98
+		$rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.key');
99 99
 		$rsa = new RSA();
100 100
 		$rsa->loadKey($rsaPrivateKey);
101 101
 		$x509 = new X509();
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 			->method('file_put_contents')
114 114
 			->will($this->throwException(new \Exception('Exception message')));
115 115
 
116
-		$keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt');
117
-		$rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key');
116
+		$keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.crt');
117
+		$rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.key');
118 118
 		$rsa = new RSA();
119 119
 		$rsa->loadKey($rsaPrivateKey);
120 120
 		$x509 = new X509();
121 121
 		$x509->loadX509($keyBundle);
122
-		$this->checker->writeAppSignature(\OC::$SERVERROOT . '/tests/data/integritycheck/app/', $x509, $rsa);
122
+		$this->checker->writeAppSignature(\OC::$SERVERROOT.'/tests/data/integritycheck/app/', $x509, $rsa);
123 123
 	}
124 124
 
125 125
 	public function testWriteAppSignature(): void {
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 			->expects($this->once())
136 136
 			->method('file_put_contents')
137 137
 			->with(
138
-				$this->equalTo(\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'),
139
-				$this->callback(function ($signature) use ($expectedSignatureFileData) {
138
+				$this->equalTo(\OC::$SERVERROOT.'/tests/data/integritycheck/app//appinfo/signature.json'),
139
+				$this->callback(function($signature) use ($expectedSignatureFileData) {
140 140
 					$expectedArray = json_decode($expectedSignatureFileData, true);
141 141
 					$actualArray = json_decode($signature, true);
142 142
 					$this->assertEquals($expectedArray, $actualArray);
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 				})
145 145
 			);
146 146
 
147
-		$keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt');
148
-		$rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key');
147
+		$keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.crt');
148
+		$rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.key');
149 149
 		$rsa = new RSA();
150 150
 		$rsa->loadKey($rsaPrivateKey);
151 151
 		$x509 = new X509();
152 152
 		$x509->loadX509($keyBundle);
153
-		$this->checker->writeAppSignature(\OC::$SERVERROOT . '/tests/data/integritycheck/app/', $x509, $rsa);
153
+		$this->checker->writeAppSignature(\OC::$SERVERROOT.'/tests/data/integritycheck/app/', $x509, $rsa);
154 154
 	}
155 155
 
156 156
 	public function testVerifyAppSignatureWithoutSignatureData(): void {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 			->expects($this->once())
189 189
 			->method('getAppPath')
190 190
 			->with('SomeApp')
191
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
191
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/');
192 192
 		$signatureDataFile = '{
193 193
     "hashes": {
194 194
         "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 			->expects($this->exactly(2))
202 202
 			->method('file_get_contents')
203 203
 			->willReturnMap([
204
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile],
205
-				['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
204
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile],
205
+				['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
206 206
 			]);
207 207
 
208 208
 		$this->assertSame([], $this->checker->verifyAppSignature('SomeApp'));
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 			->expects($this->once())
224 224
 			->method('getAppPath')
225 225
 			->with('SomeApp')
226
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
226
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/');
227 227
 		$signatureDataFile = '{
228 228
     "hashes": {
229 229
         "AnotherFile.txt": "tampered",
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 			->expects($this->exactly(2))
237 237
 			->method('file_get_contents')
238 238
 			->willReturnMap([
239
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile],
240
-				['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
239
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile],
240
+				['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
241 241
 			]);
242 242
 
243 243
 		$expected = [
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 			->expects($this->once())
265 265
 			->method('getAppPath')
266 266
 			->with('SomeApp')
267
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
267
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData/');
268 268
 		$signatureDataFile = '{
269 269
     "hashes": {
270 270
         "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 			->expects($this->exactly(2))
278 278
 			->method('file_get_contents')
279 279
 			->willReturnMap([
280
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile],
281
-				['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
280
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile],
281
+				['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
282 282
 			]);
283 283
 
284 284
 
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 			->expects($this->exactly(2))
334 334
 			->method('file_get_contents')
335 335
 			->willReturnMap([
336
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile],
337
-				['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
336
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile],
337
+				['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
338 338
 			]);
339 339
 
340 340
 		$expected = [
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 			],
359 359
 
360 360
 		];
361
-		$this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp', \OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'));
361
+		$this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp', \OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData/'));
362 362
 	}
363 363
 
364 364
 	public function testVerifyAppWithDifferentScope(): void {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 			->expects($this->once())
377 377
 			->method('getAppPath')
378 378
 			->with('SomeApp')
379
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
379
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData/');
380 380
 		$signatureDataFile = '{
381 381
     "hashes": {
382 382
         "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -389,8 +389,8 @@  discard block
 block discarded – undo
389 389
 			->expects($this->exactly(2))
390 390
 			->method('file_get_contents')
391 391
 			->willReturnMap([
392
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile],
393
-				['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
392
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json', $signatureDataFile],
393
+				['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
394 394
 			]);
395 395
 
396 396
 		$expected = [
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 			->expects($this->once())
418 418
 			->method('getAppPath')
419 419
 			->with('SomeApp')
420
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
420
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/');
421 421
 		$signatureDataFile = '{
422 422
     "hashes": {
423 423
         "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 			->expects($this->exactly(2))
431 431
 			->method('file_get_contents')
432 432
 			->willReturnMap([
433
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile],
434
-				['/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
433
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/app//appinfo/signature.json', $signatureDataFile],
434
+				['/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
435 435
 			]);
436 436
 
437 437
 		$this->assertSame([], $this->checker->verifyAppSignature('SomeApp'));
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
 		$this->fileAccessHelper
450 450
 			->expects($this->once())
451 451
 			->method('is_writable')
452
-			->with(__DIR__ . '/core')
452
+			->with(__DIR__.'/core')
453 453
 			->willReturn(true);
454 454
 
455
-		$keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt');
456
-		$rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key');
455
+		$keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.crt');
456
+		$rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.key');
457 457
 		$rsa = new RSA();
458 458
 		$rsa->loadKey($rsaPrivateKey);
459 459
 		$x509 = new X509();
@@ -473,11 +473,11 @@  discard block
 block discarded – undo
473 473
 		$this->fileAccessHelper
474 474
 			->expects($this->once())
475 475
 			->method('is_writable')
476
-			->with(__DIR__ . '/core')
476
+			->with(__DIR__.'/core')
477 477
 			->willReturn(false);
478 478
 
479
-		$keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.crt');
480
-		$rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/SomeApp.key');
479
+		$keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.crt');
480
+		$rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/SomeApp.key');
481 481
 		$rsa = new RSA();
482 482
 		$rsa->loadKey($rsaPrivateKey);
483 483
 		$x509 = new X509();
@@ -497,13 +497,13 @@  discard block
 block discarded – undo
497 497
 		$this->environmentHelper
498 498
 			->expects($this->any())
499 499
 			->method('getServerRoot')
500
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
500
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/');
501 501
 		$this->fileAccessHelper
502 502
 			->expects($this->once())
503 503
 			->method('file_put_contents')
504 504
 			->with(
505
-				\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json',
506
-				$this->callback(function ($signature) use ($expectedSignatureFileData) {
505
+				\OC::$SERVERROOT.'/tests/data/integritycheck/app//core/signature.json',
506
+				$this->callback(function($signature) use ($expectedSignatureFileData) {
507 507
 					$expectedArray = json_decode($expectedSignatureFileData, true);
508 508
 					$actualArray = json_decode($signature, true);
509 509
 					$this->assertEquals($expectedArray, $actualArray);
@@ -511,13 +511,13 @@  discard block
 block discarded – undo
511 511
 				})
512 512
 			);
513 513
 
514
-		$keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt');
515
-		$rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key');
514
+		$keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/core.crt');
515
+		$rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/core.key');
516 516
 		$rsa = new RSA();
517 517
 		$rsa->loadKey($rsaPrivateKey);
518 518
 		$x509 = new X509();
519 519
 		$x509->loadX509($keyBundle);
520
-		$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/app/');
520
+		$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT.'/tests/data/integritycheck/app/');
521 521
 	}
522 522
 
523 523
 	public function testWriteCoreSignatureWithUnmodifiedHtaccess(): void {
@@ -532,13 +532,13 @@  discard block
 block discarded – undo
532 532
 		$this->environmentHelper
533 533
 			->expects($this->any())
534 534
 			->method('getServerRoot')
535
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/');
535
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessUnmodified/');
536 536
 		$this->fileAccessHelper
537 537
 			->expects($this->once())
538 538
 			->method('file_put_contents')
539 539
 			->with(
540
-				\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified//core/signature.json',
541
-				$this->callback(function ($signature) use ($expectedSignatureFileData) {
540
+				\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessUnmodified//core/signature.json',
541
+				$this->callback(function($signature) use ($expectedSignatureFileData) {
542 542
 					$expectedArray = json_decode($expectedSignatureFileData, true);
543 543
 					$actualArray = json_decode($signature, true);
544 544
 					$this->assertEquals($expectedArray, $actualArray);
@@ -546,13 +546,13 @@  discard block
 block discarded – undo
546 546
 				})
547 547
 			);
548 548
 
549
-		$keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt');
550
-		$rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key');
549
+		$keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/core.crt');
550
+		$rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/core.key');
551 551
 		$rsa = new RSA();
552 552
 		$rsa->loadKey($rsaPrivateKey);
553 553
 		$x509 = new X509();
554 554
 		$x509->loadX509($keyBundle);
555
-		$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/');
555
+		$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT.'/tests/data/integritycheck/htaccessUnmodified/');
556 556
 	}
557 557
 
558 558
 	public function testWriteCoreSignatureWithInvalidModifiedHtaccess(): void {
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
 			->expects($this->once())
568 568
 			->method('file_put_contents')
569 569
 			->with(
570
-				\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json',
571
-				$this->callback(function ($signature) use ($expectedSignatureFileData) {
570
+				\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json',
571
+				$this->callback(function($signature) use ($expectedSignatureFileData) {
572 572
 					$expectedArray = json_decode($expectedSignatureFileData, true);
573 573
 					$actualArray = json_decode($signature, true);
574 574
 					$this->assertEquals($expectedArray, $actualArray);
@@ -576,13 +576,13 @@  discard block
 block discarded – undo
576 576
 				})
577 577
 			);
578 578
 
579
-		$keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt');
580
-		$rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key');
579
+		$keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/core.crt');
580
+		$rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/core.key');
581 581
 		$rsa = new RSA();
582 582
 		$rsa->loadKey($rsaPrivateKey);
583 583
 		$x509 = new X509();
584 584
 		$x509->loadX509($keyBundle);
585
-		$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent/');
585
+		$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithInvalidModifiedContent/');
586 586
 	}
587 587
 
588 588
 	public function testWriteCoreSignatureWithValidModifiedHtaccess(): void {
@@ -597,13 +597,13 @@  discard block
 block discarded – undo
597 597
 		$this->environmentHelper
598 598
 			->expects($this->any())
599 599
 			->method('getServerRoot')
600
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent');
600
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent');
601 601
 		$this->fileAccessHelper
602 602
 			->expects($this->once())
603 603
 			->method('file_put_contents')
604 604
 			->with(
605
-				\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json',
606
-				$this->callback(function ($signature) use ($expectedSignatureFileData) {
605
+				\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json',
606
+				$this->callback(function($signature) use ($expectedSignatureFileData) {
607 607
 					$expectedArray = json_decode($expectedSignatureFileData, true);
608 608
 					$actualArray = json_decode($signature, true);
609 609
 					$this->assertEquals($expectedArray, $actualArray);
@@ -611,13 +611,13 @@  discard block
 block discarded – undo
611 611
 				})
612 612
 			);
613 613
 
614
-		$keyBundle = file_get_contents(__DIR__ . '/../../data/integritycheck/core.crt');
615
-		$rsaPrivateKey = file_get_contents(__DIR__ . '/../../data/integritycheck/core.key');
614
+		$keyBundle = file_get_contents(__DIR__.'/../../data/integritycheck/core.crt');
615
+		$rsaPrivateKey = file_get_contents(__DIR__.'/../../data/integritycheck/core.key');
616 616
 		$rsa = new RSA();
617 617
 		$rsa->loadKey($rsaPrivateKey);
618 618
 		$x509 = new X509();
619 619
 		$x509->loadX509($keyBundle);
620
-		$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent');
620
+		$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent');
621 621
 	}
622 622
 
623 623
 	public function testVerifyCoreSignatureWithoutSignatureData(): void {
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 		$this->environmentHelper
655 655
 			->expects($this->any())
656 656
 			->method('getServerRoot')
657
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
657
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/');
658 658
 		$signatureDataFile = '{
659 659
     "hashes": {
660 660
         "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
 			->expects($this->exactly(2))
668 668
 			->method('file_get_contents')
669 669
 			->willReturnMap([
670
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', $signatureDataFile],
671
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
670
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/app//core/signature.json', $signatureDataFile],
671
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
672 672
 			]);
673 673
 
674 674
 		$this->assertSame([], $this->checker->verifyCoreSignature());
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 		$this->environmentHelper
689 689
 			->expects($this->any())
690 690
 			->method('getServerRoot')
691
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent');
691
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent');
692 692
 		$signatureDataFile = '{
693 693
     "hashes": {
694 694
         ".htaccess": "7e6a7a4d8ee4f3fbc45dd579407c643471575a9d127d1c75f6d0a49e80766c3c587104b2139ef76d2a4bffce3f45777900605aaa49519c9532909b71e5030227",
@@ -701,8 +701,8 @@  discard block
 block discarded – undo
701 701
 			->expects($this->exactly(2))
702 702
 			->method('file_get_contents')
703 703
 			->willReturnMap([
704
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json', $signatureDataFile],
705
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
704
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json', $signatureDataFile],
705
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/htaccessWithValidModifiedContent/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
706 706
 			]);
707 707
 
708 708
 		$this->assertSame([], $this->checker->verifyCoreSignature());
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	 * See inline instruction on how to update the test assets when changing mimetypealiases.dist.json
713 713
 	 */
714 714
 	public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData(): void {
715
-		$shippedMimetypeAliases = (array)json_decode(file_get_contents(\OC::$SERVERROOT . '/resources/config/mimetypealiases.dist.json'));
715
+		$shippedMimetypeAliases = (array) json_decode(file_get_contents(\OC::$SERVERROOT.'/resources/config/mimetypealiases.dist.json'));
716 716
 		$allAliases = array_merge($shippedMimetypeAliases, ['my-custom/mimetype' => 'custom']);
717 717
 
718 718
 		$this->mimeTypeDetector
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 		// file_put_contents(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/js/mimetypelist.js', $newFile);
733 733
 		// 2. Update signature.json using the following occ command:
734 734
 		// occ integrity:sign-core --privateKey=./tests/data/integritycheck/core.key --certificate=./tests/data/integritycheck/core.crt --path=./tests/data/integritycheck/mimetypeListModified
735
-		self::assertEquals($newFile, file_get_contents(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/js/mimetypelist.js'));
735
+		self::assertEquals($newFile, file_get_contents(\OC::$SERVERROOT.'/tests/data/integritycheck/mimetypeListModified/core/js/mimetypelist.js'));
736 736
 
737 737
 		$this->serverVersion
738 738
 			->expects($this->once())
@@ -747,14 +747,14 @@  discard block
 block discarded – undo
747 747
 		$this->environmentHelper
748 748
 			->expects($this->any())
749 749
 			->method('getServerRoot')
750
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified');
750
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/mimetypeListModified');
751 751
 
752
-		$signatureDataFile = file_get_contents(__DIR__ . '/../../data/integritycheck/mimetypeListModified/core/signature.json');
752
+		$signatureDataFile = file_get_contents(__DIR__.'/../../data/integritycheck/mimetypeListModified/core/signature.json');
753 753
 		$this->fileAccessHelper
754 754
 			->method('file_get_contents')
755 755
 			->willReturnMap([
756
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/signature.json', $signatureDataFile],
757
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
756
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/mimetypeListModified/core/signature.json', $signatureDataFile],
757
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/mimetypeListModified/resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
758 758
 			]);
759 759
 
760 760
 		$this->assertSame([], $this->checker->verifyCoreSignature());
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 		$this->environmentHelper
775 775
 			->expects($this->any())
776 776
 			->method('getServerRoot')
777
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
777
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/');
778 778
 		$signatureDataFile = '{
779 779
     "hashes": {
780 780
         "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
 			->expects($this->exactly(2))
788 788
 			->method('file_get_contents')
789 789
 			->willReturnMap([
790
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', $signatureDataFile],
791
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
790
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/app//core/signature.json', $signatureDataFile],
791
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
792 792
 			]);
793 793
 
794 794
 		$this->assertSame([], $this->checker->verifyCoreSignature());
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 		$this->environmentHelper
809 809
 			->expects($this->any())
810 810
 			->method('getServerRoot')
811
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
811
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData/');
812 812
 		$signatureDataFile = '{
813 813
     "hashes": {
814 814
         "AnotherFile.txt": "tampered",
@@ -821,8 +821,8 @@  discard block
 block discarded – undo
821 821
 			->expects($this->exactly(2))
822 822
 			->method('file_get_contents')
823 823
 			->willReturnMap([
824
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json', $signatureDataFile],
825
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
824
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//core/signature.json', $signatureDataFile],
825
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
826 826
 			]);
827 827
 
828 828
 		$expected = [
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 		$this->environmentHelper
849 849
 			->expects($this->any())
850 850
 			->method('getServerRoot')
851
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
851
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData/');
852 852
 		$signatureDataFile = '{
853 853
     "hashes": {
854 854
         "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 			->expects($this->exactly(2))
862 862
 			->method('file_get_contents')
863 863
 			->willReturnMap([
864
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json', $signatureDataFile],
865
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
864
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//core/signature.json', $signatureDataFile],
865
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
866 866
 			]);
867 867
 
868 868
 		$expected = [
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 		$this->environmentHelper
904 904
 			->expects($this->any())
905 905
 			->method('getServerRoot')
906
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
906
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/');
907 907
 		$signatureDataFile = '{
908 908
     "hashes": {
909 909
         "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -916,8 +916,8 @@  discard block
 block discarded – undo
916 916
 			->expects($this->exactly(2))
917 917
 			->method('file_get_contents')
918 918
 			->willReturnMap([
919
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', $signatureDataFile],
920
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
919
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/app//core/signature.json', $signatureDataFile],
920
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
921 921
 			]);
922 922
 
923 923
 		$expected = [
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 		$this->environmentHelper
944 944
 			->expects($this->any())
945 945
 			->method('getServerRoot')
946
-			->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
946
+			->willReturn(\OC::$SERVERROOT.'/tests/data/integritycheck/app/');
947 947
 		$signatureDataFile = '{
948 948
     "hashes": {
949 949
         "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -956,8 +956,8 @@  discard block
 block discarded – undo
956 956
 			->expects($this->exactly(2))
957 957
 			->method('file_get_contents')
958 958
 			->willReturnMap([
959
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', $signatureDataFile],
960
-				[\OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__ . '/../../data/integritycheck/root.crt')],
959
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/app//core/signature.json', $signatureDataFile],
960
+				[\OC::$SERVERROOT.'/tests/data/integritycheck/app//resources/codesigning/root.crt', file_get_contents(__DIR__.'/../../data/integritycheck/root.crt')],
961 961
 			]);
962 962
 
963 963
 		$expected = [
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 		$this->checker
1019 1019
 			->expects($this->exactly(3))
1020 1020
 			->method('verifyAppSignature')
1021
-			->willReturnCallback(function ($app) use (&$calls) {
1021
+			->willReturnCallback(function($app) use (&$calls) {
1022 1022
 				$expected = array_shift($calls);
1023 1023
 				$this->assertSame($expected, $app);
1024 1024
 				return [];
Please login to merge, or discard this patch.
tests/lib/Encryption/Keys/StorageTest.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 
49 49
 		$this->crypto = $this->createMock(ICrypto::class);
50 50
 		$this->crypto->method('encrypt')
51
-			->willReturnCallback(function ($data, $pass) {
51
+			->willReturnCallback(function($data, $pass) {
52 52
 				return $data;
53 53
 			});
54 54
 		$this->crypto->method('decrypt')
55
-			->willReturnCallback(function ($data, $pass) {
55
+			->willReturnCallback(function($data, $pass) {
56 56
 				return $data;
57 57
 			});
58 58
 
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 		// existing key if it exists, otherwise versions will break
146 146
 		$this->util->expects($this->once())
147 147
 			->method('stripPartialFileExtension')
148
-			->willReturn('user1' . $strippedPartialName);
148
+			->willReturn('user1'.$strippedPartialName);
149 149
 		$this->util->expects($this->any())
150 150
 			->method('isSystemWideMountPoint')
151 151
 			->willReturn(false);
152 152
 
153 153
 		$this->crypto->method('decrypt')
154
-			->willReturnCallback(function ($data, $pass) {
154
+			->willReturnCallback(function($data, $pass) {
155 155
 				return $data;
156 156
 			});
157 157
 
@@ -159,28 +159,28 @@  discard block
 block discarded – undo
159 159
 			$this->view->expects($this->exactly(2))
160 160
 				->method('file_exists')
161 161
 				->willReturnMap([
162
-					['/user1/files_encryption/keys' . $strippedPartialName . '/encModule/fileKey', $originalKeyExists],
163
-					['/user1/files_encryption/keys' . $path . '/encModule/fileKey', true],
162
+					['/user1/files_encryption/keys'.$strippedPartialName.'/encModule/fileKey', $originalKeyExists],
163
+					['/user1/files_encryption/keys'.$path.'/encModule/fileKey', true],
164 164
 				]);
165 165
 
166 166
 			$this->view->expects($this->once())
167 167
 				->method('file_get_contents')
168
-				->with($this->equalTo('/user1/files_encryption/keys' . $path . '/encModule/fileKey'))
168
+				->with($this->equalTo('/user1/files_encryption/keys'.$path.'/encModule/fileKey'))
169 169
 				->willReturn(json_encode(['key' => base64_encode('key2')]));
170 170
 		} else {
171 171
 			$this->view->expects($this->once())
172 172
 				->method('file_exists')
173
-				->with($this->equalTo('/user1/files_encryption/keys' . $strippedPartialName . '/encModule/fileKey'))
173
+				->with($this->equalTo('/user1/files_encryption/keys'.$strippedPartialName.'/encModule/fileKey'))
174 174
 				->willReturn($originalKeyExists);
175 175
 
176 176
 			$this->view->expects($this->once())
177 177
 				->method('file_get_contents')
178
-				->with($this->equalTo('/user1/files_encryption/keys' . $strippedPartialName . '/encModule/fileKey'))
178
+				->with($this->equalTo('/user1/files_encryption/keys'.$strippedPartialName.'/encModule/fileKey'))
179 179
 				->willReturn(json_encode(['key' => base64_encode('key')]));
180 180
 		}
181 181
 
182 182
 		$this->assertSame($expectedKeyContent,
183
-			$this->storage->getFileKey('user1' . $path, 'fileKey', 'encModule')
183
+			$this->storage->getFileKey('user1'.$path, 'fileKey', 'encModule')
184 184
 		);
185 185
 	}
186 186
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			->willReturnArgument(0);
201 201
 
202 202
 		$this->crypto->method('encrypt')
203
-			->willReturnCallback(function ($data, $pass) {
203
+			->willReturnCallback(function($data, $pass) {
204 204
 				return $data;
205 205
 			});
206 206
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 			->willReturnCallback([$this, 'getUidAndFilenameCallback']);
430 430
 		$this->util->expects($this->any())
431 431
 			->method('isSystemWideMountPoint')
432
-			->willReturnCallback(function ($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) {
432
+			->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) {
433 433
 				if (strpos($path, 'source.txt') !== false) {
434 434
 					return $systemWideMountSource;
435 435
 				}
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 			->willReturnCallback([$this, 'getUidAndFilenameCallback']);
461 461
 		$this->util->expects($this->any())
462 462
 			->method('isSystemWideMountPoint')
463
-			->willReturnCallback(function ($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) {
463
+			->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) {
464 464
 				if (strpos($path, 'source.txt') !== false) {
465 465
 					return $systemWideMountSource;
466 466
 				}
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		$path = $args[0];
477 477
 		$parts = explode('/', $path);
478 478
 
479
-		return [$parts[1], '/' . implode('/', array_slice($parts, 2))];
479
+		return [$parts[1], '/'.implode('/', array_slice($parts, 2))];
480 480
 	}
481 481
 
482 482
 	public static function dataProviderCopyRename() {
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 				'user1/files_encryption/backup/test.encryptionModule.1234567',
590 590
 			];
591 591
 			$this->view->expects($this->exactly(2))->method('mkdir')
592
-				->willReturnCallback(function ($path) use (&$calls) {
592
+				->willReturnCallback(function($path) use (&$calls) {
593 593
 					$expected = array_shift($calls);
594 594
 					$this->assertEquals($expected, $path);
595 595
 				});
Please login to merge, or discard this patch.
tests/lib/Encryption/DecryptAllTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			->with($this->inputInterface, $this->outputInterface, $user)
168 168
 			->willReturn($success);
169 169
 
170
-		$callback = function () use ($dummyEncryptionModule) {
170
+		$callback = function() use ($dummyEncryptionModule) {
171 171
 			return $dummyEncryptionModule;
172 172
 		};
173 173
 		$moduleDescription = [
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			];
218 218
 			$instance->expects($this->exactly(2))
219 219
 				->method('decryptUsersFiles')
220
-				->willReturnCallback(function ($user) use (&$calls) {
220
+				->willReturnCallback(function($user) use (&$calls) {
221 221
 					$expected = array_shift($calls);
222 222
 					$this->assertEquals($expected, $user);
223 223
 				});
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
 		$this->view->expects($this->any())->method('is_dir')
285 285
 			->willReturnCallback(
286
-				function ($path) {
286
+				function($path) {
287 287
 					if ($path === '/user1/files/foo') {
288 288
 						return true;
289 289
 					}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		];
298 298
 		$instance->expects($this->exactly(2))
299 299
 			->method('decryptFile')
300
-			->willReturnCallback(function ($path) use (&$calls) {
300
+			->willReturnCallback(function($path) use (&$calls) {
301 301
 				$expected = array_shift($calls);
302 302
 				$this->assertEquals($expected, $path);
303 303
 			});
@@ -346,10 +346,10 @@  discard block
 block discarded – undo
346 346
 
347 347
 			$this->view->expects($this->once())
348 348
 				->method('copy')
349
-				->with($path, $path . '.decrypted.42');
349
+				->with($path, $path.'.decrypted.42');
350 350
 			$this->view->expects($this->once())
351 351
 				->method('rename')
352
-				->with($path . '.decrypted.42', $path);
352
+				->with($path.'.decrypted.42', $path);
353 353
 		} else {
354 354
 			$instance->expects($this->never())->method('getTimestamp');
355 355
 			$this->view->expects($this->never())->method('copy');
@@ -386,19 +386,19 @@  discard block
 block discarded – undo
386 386
 
387 387
 		$this->view->expects($this->once())
388 388
 			->method('copy')
389
-			->with($path, $path . '.decrypted.42')
390
-			->willReturnCallback(function () {
389
+			->with($path, $path.'.decrypted.42')
390
+			->willReturnCallback(function() {
391 391
 				throw new DecryptionFailedException();
392 392
 			});
393 393
 
394 394
 		$this->view->expects($this->never())->method('rename');
395 395
 		$this->view->expects($this->once())
396 396
 			->method('file_exists')
397
-			->with($path . '.decrypted.42')
397
+			->with($path.'.decrypted.42')
398 398
 			->willReturn(true);
399 399
 		$this->view->expects($this->once())
400 400
 			->method('unlink')
401
-			->with($path . '.decrypted.42');
401
+			->with($path.'.decrypted.42');
402 402
 
403 403
 		$this->assertFalse(
404 404
 			$this->invokePrivate($instance, 'decryptFile', [$path])
Please login to merge, or discard this patch.
tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 class ContactsStoreTest extends TestCase {
28 28
 	private ContactsStore $contactsStore;
29
-	private StatusService|MockObject $statusService;
29
+	private StatusService | MockObject $statusService;
30 30
 	/** @var IManager|MockObject */
31 31
 	private $contactsManager;
32 32
 	/** @var ProfileManager */
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		];
264 264
 		$this->groupManager->expects($this->exactly(4))
265 265
 			->method('getUserGroupIds')
266
-			->willReturnCallback(function () use (&$calls): array {
266
+			->willReturnCallback(function() use (&$calls): array {
267 267
 				$expected = array_shift($calls);
268 268
 				$this->assertEquals($expected[0], func_get_args());
269 269
 				return $expected[1];
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 		];
337 337
 		$this->groupManager->expects($this->exactly(4))
338 338
 			->method('getUserGroupIds')
339
-			->willReturnCallback(function () use (&$calls): array {
339
+			->willReturnCallback(function() use (&$calls): array {
340 340
 				$expected = array_shift($calls);
341 341
 				$this->assertEquals($expected[0], func_get_args());
342 342
 				return $expected[1];
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		];
468 468
 		$this->groupManager->expects($this->exactly(4))
469 469
 			->method('getUserGroupIds')
470
-			->willReturnCallback(function () use (&$calls): array {
470
+			->willReturnCallback(function() use (&$calls): array {
471 471
 				$expected = array_shift($calls);
472 472
 				$this->assertEquals($expected[0], func_get_args());
473 473
 				return $expected[1];
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 		];
543 543
 		$this->groupManager->expects($this->exactly(2))
544 544
 			->method('getUserGroupIds')
545
-			->willReturnCallback(function () use (&$calls): array {
545
+			->willReturnCallback(function() use (&$calls): array {
546 546
 				$expected = array_shift($calls);
547 547
 				$this->assertEquals($expected[0], func_get_args());
548 548
 				return $expected[1];
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 		];
621 621
 		$this->groupManager->expects($this->exactly(4))
622 622
 			->method('getUserGroupIds')
623
-			->willReturnCallback(function () use (&$calls): array {
623
+			->willReturnCallback(function() use (&$calls): array {
624 624
 				$expected = array_shift($calls);
625 625
 				$this->assertEquals($expected[0], func_get_args());
626 626
 				return $expected[1];
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 		$user2->method('getCloudId')->willReturn('user2@localcloud');
971 971
 		$this->userManager->expects(self::exactly(2))
972 972
 			->method('get')
973
-			->willReturnCallback(function ($uid) use ($user1, $user2) {
973
+			->willReturnCallback(function($uid) use ($user1, $user2) {
974 974
 				return match ($uid) {
975 975
 					'user1' => $user1,
976 976
 					'user2' => $user2,
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
 		$this->contactsManager
980 980
 			->expects(self::exactly(3))
981 981
 			->method('search')
982
-			->willReturnCallback(function ($uid, $searchProps, $options) {
982
+			->willReturnCallback(function($uid, $searchProps, $options) {
983 983
 				return match ([$uid, $options['limit'] ?? null]) {
984 984
 					['user1@localcloud', 1] => [
985 985
 						[
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 		$this->contactsManager
1028 1028
 			->expects(self::exactly(2))
1029 1029
 			->method('search')
1030
-			->willReturnCallback(function ($uid, $searchProps, $options) {
1030
+			->willReturnCallback(function($uid, $searchProps, $options) {
1031 1031
 				return match ([$uid, $options['limit'] ?? null, $options['offset'] ?? null]) {
1032 1032
 					['', 2, 0] => [
1033 1033
 						[
Please login to merge, or discard this patch.
tests/lib/Files/Type/DetectionTest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 		$this->detection = new Detection(
21 21
 			\OC::$server->getURLGenerator(),
22 22
 			\OC::$server->get(LoggerInterface::class),
23
-			\OC::$SERVERROOT . '/config/',
24
-			\OC::$SERVERROOT . '/resources/config/'
23
+			\OC::$SERVERROOT.'/config/',
24
+			\OC::$SERVERROOT.'/resources/config/'
25 25
 		);
26 26
 	}
27 27
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @param string $expected
72 72
 	 */
73 73
 	public function testDetectContent(string $path, string $expected): void {
74
-		$this->assertEquals($expected, $this->detection->detectContent(\OC::$SERVERROOT . '/tests/data' . $path));
74
+		$this->assertEquals($expected, $this->detection->detectContent(\OC::$SERVERROOT.'/tests/data'.$path));
75 75
 	}
76 76
 
77 77
 	public static function dataDetect(): array {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @param string $expected
92 92
 	 */
93 93
 	public function testDetect(string $path, string $expected): void {
94
-		$this->assertEquals($expected, $this->detection->detect(\OC::$SERVERROOT . '/tests/data' . $path));
94
+		$this->assertEquals($expected, $this->detection->detect(\OC::$SERVERROOT.'/tests/data'.$path));
95 95
 	}
96 96
 
97 97
 	public function testDetectString(): void {
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function testDetectMimeTypeCustom(string $ext, string $mime): void {
118 118
 		$confDir = sys_get_temp_dir();
119
-		file_put_contents($confDir . '/mimetypemapping.dist.json', json_encode([]));
119
+		file_put_contents($confDir.'/mimetypemapping.dist.json', json_encode([]));
120 120
 
121 121
 		/** @var IURLGenerator $urlGenerator */
122 122
 		$urlGenerator = $this->getMockBuilder(IURLGenerator::class)
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 		$logger = $this->createMock(LoggerInterface::class);
128 128
 
129 129
 		// Create new mapping file
130
-		file_put_contents($confDir . '/mimetypemapping.dist.json', json_encode([$ext => [$mime]]));
130
+		file_put_contents($confDir.'/mimetypemapping.dist.json', json_encode([$ext => [$mime]]));
131 131
 
132 132
 		$detection = new Detection($urlGenerator, $logger, $confDir, $confDir);
133 133
 		$mappings = $detection->getAllMappings();
134 134
 		$this->assertArrayHasKey($ext, $mappings);
135
-		$this->assertEquals($mime, $detection->detectPath('foo.' . $ext));
135
+		$this->assertEquals($mime, $detection->detectPath('foo.'.$ext));
136 136
 	}
137 137
 
138 138
 	public static function dataGetSecureMimeType(): array {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 		$urlGenerator->expects($this->exactly(2))
263 263
 			->method('imagePath')
264 264
 			->willReturnCallback(
265
-				function ($appName, $file) use (&$calls) {
265
+				function($appName, $file) use (&$calls) {
266 266
 					$expected = array_shift($calls);
267 267
 					$this->assertEquals($expected, [$appName, $file]);
268 268
 					if ($file === 'filetypes/my.png') {
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		$urlGenerator->expects($this->exactly(3))
296 296
 			->method('imagePath')
297 297
 			->willReturnCallback(
298
-				function ($appName, $file) use (&$calls) {
298
+				function($appName, $file) use (&$calls) {
299 299
 					$expected = array_shift($calls);
300 300
 					$this->assertEquals($expected, [$appName, $file]);
301 301
 					if ($file === 'filetypes/file.png') {
Please login to merge, or discard this patch.
tests/lib/Files/Storage/Wrapper/AvailabilityTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
 		];
83 83
 		$this->storage->expects($this->exactly(2))
84 84
 			->method('setAvailability')
85
-			->willReturnCallback(function ($value) use (&$calls) {
85
+			->willReturnCallback(function($value) use (&$calls) {
86 86
 				$expected = array_shift($calls);
87 87
 				$this->assertEquals($expected, $value);
88 88
 			});
Please login to merge, or discard this patch.
tests/lib/Files/ViewTest.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		}
143 143
 
144 144
 		if ($this->tempStorage) {
145
-			system('rm -rf ' . escapeshellarg($this->tempStorage->getDataDir()));
145
+			system('rm -rf '.escapeshellarg($this->tempStorage->getDataDir()));
146 146
 		}
147 147
 
148 148
 		self::logout();
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 		$storage2 = $this->getTestStorage();
169 169
 		$storage3 = $this->getTestStorage();
170 170
 		$root = self::getUniqueID('/');
171
-		Filesystem::mount($storage1, [], $root . '/');
172
-		Filesystem::mount($storage2, [], $root . '/substorage');
173
-		Filesystem::mount($storage3, [], $root . '/folder/anotherstorage');
171
+		Filesystem::mount($storage1, [], $root.'/');
172
+		Filesystem::mount($storage2, [], $root.'/substorage');
173
+		Filesystem::mount($storage3, [], $root.'/folder/anotherstorage');
174 174
 		$textSize = strlen("dummy file data\n");
175
-		$imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo/logo.png');
175
+		$imageSize = filesize(\OC::$SERVERROOT.'/core/img/logo/logo.png');
176 176
 		$storageSize = $textSize * 2 + $imageSize;
177 177
 
178 178
 		$storageInfo = $storage3->getCache()->get('');
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		$this->assertEquals('foo.png', $folderData[1]['name']);
230 230
 		$this->assertEquals('foo.txt', $folderData[2]['name']);
231 231
 
232
-		$folderView = new View($root . '/folder');
232
+		$folderView = new View($root.'/folder');
233 233
 		$this->assertEquals($rootView->getFileInfo('/folder'), $folderView->getFileInfo('/'));
234 234
 
235 235
 		$cachedData = $rootView->getFileInfo('/foo.txt');
@@ -645,11 +645,11 @@  discard block
 block discarded – undo
645 645
 		$storage2 = $this->getTestStorage();
646 646
 		$defaultRoot = Filesystem::getRoot();
647 647
 		Filesystem::mount($storage1, [], '/');
648
-		Filesystem::mount($storage2, [], $defaultRoot . '/substorage');
648
+		Filesystem::mount($storage2, [], $defaultRoot.'/substorage');
649 649
 		\OC_Hook::connect('OC_Filesystem', 'post_write', $this, 'dummyHook');
650 650
 
651 651
 		$rootView = new View('');
652
-		$subView = new View($defaultRoot . '/substorage');
652
+		$subView = new View($defaultRoot.'/substorage');
653 653
 		$this->hookPath = null;
654 654
 
655 655
 		$rootView->file_put_contents('/foo.txt', 'asd');
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 		 */
690 690
 		$storage = new $class([]);
691 691
 		$textData = "dummy file data\n";
692
-		$imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo/logo.png');
692
+		$imgData = file_get_contents(\OC::$SERVERROOT.'/core/img/logo/logo.png');
693 693
 		$storage->mkdir('folder');
694 694
 		$storage->file_put_contents('foo.txt', $textData);
695 695
 		$storage->file_put_contents('foo.png', $imgData);
@@ -711,10 +711,10 @@  discard block
 block discarded – undo
711 711
 		$storage2 = $this->getTestStorage();
712 712
 		$defaultRoot = Filesystem::getRoot();
713 713
 		Filesystem::mount($storage1, [], '/');
714
-		Filesystem::mount($storage2, [], $defaultRoot . '_substorage');
714
+		Filesystem::mount($storage2, [], $defaultRoot.'_substorage');
715 715
 		\OC_Hook::connect('OC_Filesystem', 'post_write', $this, 'dummyHook');
716 716
 
717
-		$subView = new View($defaultRoot . '_substorage');
717
+		$subView = new View($defaultRoot.'_substorage');
718 718
 		$this->hookPath = null;
719 719
 
720 720
 		$subView->file_put_contents('/foo.txt', 'asd');
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 
810 810
 		$rootView = new View('');
811 811
 		foreach ($names as $name) {
812
-			$rootView->file_put_contents('/' . $name, 'dummy content');
812
+			$rootView->file_put_contents('/'.$name, 'dummy content');
813 813
 		}
814 814
 
815 815
 		$list = $rootView->getDirectoryContent('/');
@@ -851,15 +851,15 @@  discard block
 block discarded – undo
851 851
 			$depth = ((4000 - $tmpdirLength) / 57);
852 852
 		}
853 853
 		foreach (range(0, $depth - 1) as $i) {
854
-			$longPath .= $ds . $folderName;
854
+			$longPath .= $ds.$folderName;
855 855
 			$result = $rootView->mkdir($longPath);
856
-			$this->assertTrue($result, "mkdir failed on $i - path length: " . strlen($longPath));
856
+			$this->assertTrue($result, "mkdir failed on $i - path length: ".strlen($longPath));
857 857
 
858
-			$result = $rootView->file_put_contents($longPath . "{$ds}test.txt", 'lorem');
858
+			$result = $rootView->file_put_contents($longPath."{$ds}test.txt", 'lorem');
859 859
 			$this->assertEquals(5, $result, "file_put_contents failed on $i");
860 860
 
861 861
 			$this->assertTrue($rootView->file_exists($longPath));
862
-			$this->assertTrue($rootView->file_exists($longPath . "{$ds}test.txt"));
862
+			$this->assertTrue($rootView->file_exists($longPath."{$ds}test.txt"));
863 863
 		}
864 864
 
865 865
 		$cache = $storage->getCache();
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 			$this->assertTrue(is_array($cachedFolder), "No cache entry for folder at $i");
873 873
 			$this->assertEquals($folderName, $cachedFolder['name'], "Wrong cache entry for folder at $i");
874 874
 
875
-			$cachedFile = $cache->get($longPath . '/test.txt');
875
+			$cachedFile = $cache->get($longPath.'/test.txt');
876 876
 			$this->assertTrue(is_array($cachedFile), "No cache entry for file at $i");
877 877
 			$this->assertEquals('test.txt', $cachedFile['name'], "Wrong cache entry for file at $i");
878 878
 
879
-			$longPath .= $ds . $folderName;
879
+			$longPath .= $ds.$folderName;
880 880
 		}
881 881
 	}
882 882
 
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 		$folderName = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123456789';
1088 1088
 		$depth = (4000 / 57);
1089 1089
 		foreach (range(0, $depth + 1) as $i) {
1090
-			$longPath .= '/' . $folderName;
1090
+			$longPath .= '/'.$folderName;
1091 1091
 		}
1092 1092
 
1093 1093
 		$storage = new Temporary([]);
@@ -1337,8 +1337,8 @@  discard block
 block discarded – undo
1337 1337
 		$view = new View($rootPath);
1338 1338
 		$storage = new Temporary([]);
1339 1339
 		Filesystem::mount($storage, [], '/');
1340
-		$this->assertTrue($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE));
1341
-		$view->lockFile($pathPrefix . '/foo/bar/asd', ILockingProvider::LOCK_SHARED);
1340
+		$this->assertTrue($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE));
1341
+		$view->lockFile($pathPrefix.'/foo/bar/asd', ILockingProvider::LOCK_SHARED);
1342 1342
 	}
1343 1343
 
1344 1344
 	/**
@@ -1356,8 +1356,8 @@  discard block
 block discarded – undo
1356 1356
 		$view = new View($rootPath);
1357 1357
 		$storage = new Temporary([]);
1358 1358
 		Filesystem::mount($storage, [], '/');
1359
-		$this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE));
1360
-		$this->assertFalse($view->lockFile($pathPrefix . '/foo/bar/asd', ILockingProvider::LOCK_SHARED));
1359
+		$this->assertFalse($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE));
1360
+		$this->assertFalse($view->lockFile($pathPrefix.'/foo/bar/asd', ILockingProvider::LOCK_SHARED));
1361 1361
 	}
1362 1362
 
1363 1363
 	/**
@@ -1378,8 +1378,8 @@  discard block
 block discarded – undo
1378 1378
 		$view = new View($rootPath);
1379 1379
 		$storage = new Temporary([]);
1380 1380
 		Filesystem::mount($storage, [], '/');
1381
-		$this->assertTrue($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_SHARED));
1382
-		$view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE);
1381
+		$this->assertTrue($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_SHARED));
1382
+		$view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE);
1383 1383
 	}
1384 1384
 
1385 1385
 	/**
@@ -1397,8 +1397,8 @@  discard block
 block discarded – undo
1397 1397
 		$view = new View($rootPath);
1398 1398
 		$storage = new Temporary([]);
1399 1399
 		Filesystem::mount($storage, [], '/');
1400
-		$this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_SHARED));
1401
-		$this->assertFalse($view->lockFile($pathPrefix . '/foo/bar', ILockingProvider::LOCK_EXCLUSIVE));
1400
+		$this->assertFalse($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_SHARED));
1401
+		$this->assertFalse($view->lockFile($pathPrefix.'/foo/bar', ILockingProvider::LOCK_EXCLUSIVE));
1402 1402
 	}
1403 1403
 
1404 1404
 	/**
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
 				->onlyMethods([])
1608 1608
 				->getMock();
1609 1609
 			$storage->method('getId')->willReturn('non-null-id');
1610
-			$storage->method('getStorageCache')->willReturnCallback(function () use ($storage) {
1610
+			$storage->method('getStorageCache')->willReturnCallback(function() use ($storage) {
1611 1611
 				return new \OC\Files\Cache\Storage($storage, true, \OC::$server->get(IDBConnection::class));
1612 1612
 			});
1613 1613
 
@@ -1636,8 +1636,8 @@  discard block
 block discarded – undo
1636 1636
 		self::loginAsUser($this->user);
1637 1637
 
1638 1638
 		[$mount1, $mount2] = $this->createTestMovableMountPoints([
1639
-			$this->user . '/files/mount1',
1640
-			$this->user . '/files/mount2',
1639
+			$this->user.'/files/mount1',
1640
+			$this->user.'/files/mount2',
1641 1641
 		]);
1642 1642
 		$mount1->expects($this->once())
1643 1643
 			->method('moveMount')
@@ -1647,7 +1647,7 @@  discard block
 block discarded – undo
1647 1647
 			->method('moveMount')
1648 1648
 			->willReturn(true);
1649 1649
 
1650
-		$view = new View('/' . $this->user . '/files/');
1650
+		$view = new View('/'.$this->user.'/files/');
1651 1651
 		$view->mkdir('sub');
1652 1652
 
1653 1653
 		$this->assertTrue($view->rename('mount1', 'renamed_mount'), 'Can rename mount point');
@@ -1658,8 +1658,8 @@  discard block
 block discarded – undo
1658 1658
 		self::loginAsUser($this->user);
1659 1659
 
1660 1660
 		[$mount1, $mount2] = $this->createTestMovableMountPoints([
1661
-			$this->user . '/files/mount1',
1662
-			$this->user . '/files/mount2',
1661
+			$this->user.'/files/mount1',
1662
+			$this->user.'/files/mount2',
1663 1663
 		]);
1664 1664
 
1665 1665
 		$mount1->expects($this->never())
@@ -1668,7 +1668,7 @@  discard block
 block discarded – undo
1668 1668
 		$mount2->expects($this->never())
1669 1669
 			->method('moveMount');
1670 1670
 
1671
-		$view = new View('/' . $this->user . '/files/');
1671
+		$view = new View('/'.$this->user.'/files/');
1672 1672
 
1673 1673
 		$this->expectException(ForbiddenException::class);
1674 1674
 		$view->rename('mount1', 'mount2');
@@ -1678,8 +1678,8 @@  discard block
 block discarded – undo
1678 1678
 		self::loginAsUser($this->user);
1679 1679
 
1680 1680
 		[$mount1, $mount2] = $this->createTestMovableMountPoints([
1681
-			$this->user . '/files/mount1',
1682
-			$this->user . '/files/mount2',
1681
+			$this->user.'/files/mount1',
1682
+			$this->user.'/files/mount2',
1683 1683
 		]);
1684 1684
 
1685 1685
 		$mount1->expects($this->never())
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
 		$mount2->expects($this->never())
1689 1689
 			->method('moveMount');
1690 1690
 
1691
-		$view = new View('/' . $this->user . '/files/');
1691
+		$view = new View('/'.$this->user.'/files/');
1692 1692
 
1693 1693
 		$this->expectException(ForbiddenException::class);
1694 1694
 		$view->rename('mount1', 'mount2/sub');
@@ -1701,8 +1701,8 @@  discard block
 block discarded – undo
1701 1701
 		self::loginAsUser($this->user);
1702 1702
 
1703 1703
 		[$mount1, $mount2] = $this->createTestMovableMountPoints([
1704
-			$this->user . '/files/mount1',
1705
-			$this->user . '/files/mount2',
1704
+			$this->user.'/files/mount1',
1705
+			$this->user.'/files/mount2',
1706 1706
 		]);
1707 1707
 
1708 1708
 		$mount1->expects($this->never())
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 			->method('moveMount')
1713 1713
 			->willReturn(true);
1714 1714
 
1715
-		$view = new View('/' . $this->user . '/files/');
1715
+		$view = new View('/'.$this->user.'/files/');
1716 1716
 		$view->mkdir('shareddir');
1717 1717
 		$view->mkdir('shareddir/sub');
1718 1718
 		$view->mkdir('shareddir/sub2');
@@ -1938,7 +1938,7 @@  discard block
 block discarded – undo
1938 1938
 		$expectedStrayLock = null,
1939 1939
 		$returnValue = true,
1940 1940
 	): void {
1941
-		$view = new View('/' . $this->user . '/files/');
1941
+		$view = new View('/'.$this->user.'/files/');
1942 1942
 
1943 1943
 		/** @var Temporary&MockObject $storage */
1944 1944
 		$storage = $this->getMockBuilder(Temporary::class)
@@ -1948,19 +1948,19 @@  discard block
 block discarded – undo
1948 1948
 		/* Pause trash to avoid the trashbin intercepting rmdir and unlink calls */
1949 1949
 		Server::get(ITrashManager::class)->pauseTrash();
1950 1950
 
1951
-		Filesystem::mount($storage, [], $this->user . '/');
1951
+		Filesystem::mount($storage, [], $this->user.'/');
1952 1952
 
1953 1953
 		// work directly on disk because mkdir might be mocked
1954 1954
 		$realPath = $storage->getSourcePath('');
1955
-		mkdir($realPath . '/files');
1956
-		mkdir($realPath . '/files/dir');
1957
-		file_put_contents($realPath . '/files/test.txt', 'blah');
1955
+		mkdir($realPath.'/files');
1956
+		mkdir($realPath.'/files/dir');
1957
+		file_put_contents($realPath.'/files/test.txt', 'blah');
1958 1958
 		$storage->getScanner()->scan('files');
1959 1959
 
1960 1960
 		$storage->expects($this->once())
1961 1961
 			->method($operation)
1962 1962
 			->willReturnCallback(
1963
-				function () use ($view, $lockedPath, &$lockTypeDuring, $returnValue) {
1963
+				function() use ($view, $lockedPath, &$lockTypeDuring, $returnValue) {
1964 1964
 					$lockTypeDuring = $this->getFileLockType($view, $lockedPath);
1965 1965
 
1966 1966
 					return $returnValue;
@@ -1993,7 +1993,7 @@  discard block
 block discarded – undo
1993 1993
 	 * This code path uses $storage->fopen instead
1994 1994
 	 */
1995 1995
 	public function testLockFilePutContentWithStream(): void {
1996
-		$view = new View('/' . $this->user . '/files/');
1996
+		$view = new View('/'.$this->user.'/files/');
1997 1997
 
1998 1998
 		$path = 'test_file_put_contents.txt';
1999 1999
 		/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
@@ -2001,13 +2001,13 @@  discard block
 block discarded – undo
2001 2001
 			->onlyMethods(['fopen'])
2002 2002
 			->getMock();
2003 2003
 
2004
-		Filesystem::mount($storage, [], $this->user . '/');
2004
+		Filesystem::mount($storage, [], $this->user.'/');
2005 2005
 		$storage->mkdir('files');
2006 2006
 
2007 2007
 		$storage->expects($this->once())
2008 2008
 			->method('fopen')
2009 2009
 			->willReturnCallback(
2010
-				function () use ($view, $path, &$lockTypeDuring) {
2010
+				function() use ($view, $path, &$lockTypeDuring) {
2011 2011
 					$lockTypeDuring = $this->getFileLockType($view, $path);
2012 2012
 
2013 2013
 					return fopen('php://temp', 'r+');
@@ -2032,7 +2032,7 @@  discard block
 block discarded – undo
2032 2032
 	 * Test locks for fopen with fclose at the end
2033 2033
 	 */
2034 2034
 	public function testLockFopen(): void {
2035
-		$view = new View('/' . $this->user . '/files/');
2035
+		$view = new View('/'.$this->user.'/files/');
2036 2036
 
2037 2037
 		$path = 'test_file_put_contents.txt';
2038 2038
 		/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
@@ -2040,13 +2040,13 @@  discard block
 block discarded – undo
2040 2040
 			->onlyMethods(['fopen'])
2041 2041
 			->getMock();
2042 2042
 
2043
-		Filesystem::mount($storage, [], $this->user . '/');
2043
+		Filesystem::mount($storage, [], $this->user.'/');
2044 2044
 		$storage->mkdir('files');
2045 2045
 
2046 2046
 		$storage->expects($this->once())
2047 2047
 			->method('fopen')
2048 2048
 			->willReturnCallback(
2049
-				function () use ($view, $path, &$lockTypeDuring) {
2049
+				function() use ($view, $path, &$lockTypeDuring) {
2050 2050
 					$lockTypeDuring = $this->getFileLockType($view, $path);
2051 2051
 
2052 2052
 					return fopen('php://temp', 'r+');
@@ -2088,7 +2088,7 @@  discard block
 block discarded – undo
2088 2088
 		if ($operation === 'touch') {
2089 2089
 			$this->markTestSkipped('touch handles storage exceptions internally');
2090 2090
 		}
2091
-		$view = new View('/' . $this->user . '/files/');
2091
+		$view = new View('/'.$this->user.'/files/');
2092 2092
 
2093 2093
 		/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
2094 2094
 		$storage = $this->getMockBuilder(Temporary::class)
@@ -2098,19 +2098,19 @@  discard block
 block discarded – undo
2098 2098
 		/* Pause trash to avoid the trashbin intercepting rmdir and unlink calls */
2099 2099
 		Server::get(ITrashManager::class)->pauseTrash();
2100 2100
 
2101
-		Filesystem::mount($storage, [], $this->user . '/');
2101
+		Filesystem::mount($storage, [], $this->user.'/');
2102 2102
 
2103 2103
 		// work directly on disk because mkdir might be mocked
2104 2104
 		$realPath = $storage->getSourcePath('');
2105
-		mkdir($realPath . '/files');
2106
-		mkdir($realPath . '/files/dir');
2107
-		file_put_contents($realPath . '/files/test.txt', 'blah');
2105
+		mkdir($realPath.'/files');
2106
+		mkdir($realPath.'/files/dir');
2107
+		file_put_contents($realPath.'/files/test.txt', 'blah');
2108 2108
 		$storage->getScanner()->scan('files');
2109 2109
 
2110 2110
 		$storage->expects($this->once())
2111 2111
 			->method($operation)
2112 2112
 			->willReturnCallback(
2113
-				function () {
2113
+				function() {
2114 2114
 					throw new \Exception('Simulated exception');
2115 2115
 				}
2116 2116
 			);
@@ -2130,11 +2130,11 @@  discard block
 block discarded – undo
2130 2130
 	}
2131 2131
 
2132 2132
 	public function testLockBasicOperationUnlocksAfterLockException(): void {
2133
-		$view = new View('/' . $this->user . '/files/');
2133
+		$view = new View('/'.$this->user.'/files/');
2134 2134
 
2135 2135
 		$storage = new Temporary([]);
2136 2136
 
2137
-		Filesystem::mount($storage, [], $this->user . '/');
2137
+		Filesystem::mount($storage, [], $this->user.'/');
2138 2138
 
2139 2139
 		$storage->mkdir('files');
2140 2140
 		$storage->mkdir('files/dir');
@@ -2176,14 +2176,14 @@  discard block
 block discarded – undo
2176 2176
 		$path,
2177 2177
 		$hookType,
2178 2178
 	): void {
2179
-		$view = new View('/' . $this->user . '/files/');
2179
+		$view = new View('/'.$this->user.'/files/');
2180 2180
 
2181 2181
 		/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
2182 2182
 		$storage = $this->getMockBuilder(Temporary::class)
2183 2183
 			->onlyMethods([$operation])
2184 2184
 			->getMock();
2185 2185
 
2186
-		Filesystem::mount($storage, [], $this->user . '/');
2186
+		Filesystem::mount($storage, [], $this->user.'/');
2187 2187
 		$storage->mkdir('files');
2188 2188
 
2189 2189
 		Util::connectHook(
@@ -2215,7 +2215,7 @@  discard block
 block discarded – undo
2215 2215
 	 *                                          the operation
2216 2216
 	 */
2217 2217
 	public function testLockFileRename($operation, $expectedLockTypeSourceDuring): void {
2218
-		$view = new View('/' . $this->user . '/files/');
2218
+		$view = new View('/'.$this->user.'/files/');
2219 2219
 
2220 2220
 		/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
2221 2221
 		$storage = $this->getMockBuilder(Temporary::class)
@@ -2238,14 +2238,14 @@  discard block
 block discarded – undo
2238 2238
 		$sourcePath = 'original.txt';
2239 2239
 		$targetPath = 'target.txt';
2240 2240
 
2241
-		Filesystem::mount($storage, [], $this->user . '/');
2241
+		Filesystem::mount($storage, [], $this->user.'/');
2242 2242
 		$storage->mkdir('files');
2243 2243
 		$view->file_put_contents($sourcePath, 'meh');
2244 2244
 
2245 2245
 		$storage->expects($this->once())
2246 2246
 			->method($operation)
2247 2247
 			->willReturnCallback(
2248
-				function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) {
2248
+				function() use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) {
2249 2249
 					$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath);
2250 2250
 					$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath);
2251 2251
 
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
 	public function testLockFileCopyException(): void {
2282 2282
 		$this->expectException(\Exception::class);
2283 2283
 
2284
-		$view = new View('/' . $this->user . '/files/');
2284
+		$view = new View('/'.$this->user.'/files/');
2285 2285
 
2286 2286
 		/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
2287 2287
 		$storage = $this->getMockBuilder(Temporary::class)
@@ -2291,14 +2291,14 @@  discard block
 block discarded – undo
2291 2291
 		$sourcePath = 'original.txt';
2292 2292
 		$targetPath = 'target.txt';
2293 2293
 
2294
-		Filesystem::mount($storage, [], $this->user . '/');
2294
+		Filesystem::mount($storage, [], $this->user.'/');
2295 2295
 		$storage->mkdir('files');
2296 2296
 		$view->file_put_contents($sourcePath, 'meh');
2297 2297
 
2298 2298
 		$storage->expects($this->once())
2299 2299
 			->method('copy')
2300 2300
 			->willReturnCallback(
2301
-				function () {
2301
+				function() {
2302 2302
 					throw new \Exception();
2303 2303
 				}
2304 2304
 			);
@@ -2324,7 +2324,7 @@  discard block
 block discarded – undo
2324 2324
 	public function testLockFileRenameUnlockOnException(): void {
2325 2325
 		self::loginAsUser('test');
2326 2326
 
2327
-		$view = new View('/' . $this->user . '/files/');
2327
+		$view = new View('/'.$this->user.'/files/');
2328 2328
 
2329 2329
 		$sourcePath = 'original.txt';
2330 2330
 		$targetPath = 'target.txt';
@@ -2365,7 +2365,7 @@  discard block
 block discarded – undo
2365 2365
 		$this->assertEquals('test', $view->getFileInfo($path)->getOwner()->getUID());
2366 2366
 
2367 2367
 		$folderInfo = $view->getDirectoryContent('');
2368
-		$folderInfo = array_values(array_filter($folderInfo, function (FileInfo $info) {
2368
+		$folderInfo = array_values(array_filter($folderInfo, function(FileInfo $info) {
2369 2369
 			return $info->getName() === 'foo.txt';
2370 2370
 		}));
2371 2371
 
@@ -2375,7 +2375,7 @@  discard block
 block discarded – undo
2375 2375
 		Filesystem::mount($subStorage, [], '/test/files/asd');
2376 2376
 
2377 2377
 		$folderInfo = $view->getDirectoryContent('');
2378
-		$folderInfo = array_values(array_filter($folderInfo, function (FileInfo $info) {
2378
+		$folderInfo = array_values(array_filter($folderInfo, function(FileInfo $info) {
2379 2379
 			return $info->getName() === 'asd';
2380 2380
 		}));
2381 2381
 
@@ -2400,7 +2400,7 @@  discard block
 block discarded – undo
2400 2400
 	 *                                          the operation
2401 2401
 	 */
2402 2402
 	public function testLockFileRenameCrossStorage($viewOperation, $storageOperation, $expectedLockTypeSourceDuring): void {
2403
-		$view = new View('/' . $this->user . '/files/');
2403
+		$view = new View('/'.$this->user.'/files/');
2404 2404
 
2405 2405
 		/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
2406 2406
 		$storage = $this->getMockBuilder(Temporary::class)
@@ -2427,8 +2427,8 @@  discard block
 block discarded – undo
2427 2427
 		$sourcePath = 'original.txt';
2428 2428
 		$targetPath = 'substorage/target.txt';
2429 2429
 
2430
-		Filesystem::mount($storage, [], $this->user . '/');
2431
-		Filesystem::mount($storage2, [], $this->user . '/files/substorage');
2430
+		Filesystem::mount($storage, [], $this->user.'/');
2431
+		Filesystem::mount($storage2, [], $this->user.'/files/substorage');
2432 2432
 		$storage->mkdir('files');
2433 2433
 		$view->file_put_contents($sourcePath, 'meh');
2434 2434
 		$storage2->getUpdater()->update('');
@@ -2438,7 +2438,7 @@  discard block
 block discarded – undo
2438 2438
 		$storage2->expects($this->once())
2439 2439
 			->method($storageOperation)
2440 2440
 			->willReturnCallback(
2441
-				function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) {
2441
+				function() use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) {
2442 2442
 					$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath);
2443 2443
 					$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath);
2444 2444
 
@@ -2473,10 +2473,10 @@  discard block
 block discarded – undo
2473 2473
 		self::loginAsUser('test');
2474 2474
 
2475 2475
 		[$mount] = $this->createTestMovableMountPoints([
2476
-			$this->user . '/files/substorage',
2476
+			$this->user.'/files/substorage',
2477 2477
 		]);
2478 2478
 
2479
-		$view = new View('/' . $this->user . '/files/');
2479
+		$view = new View('/'.$this->user.'/files/');
2480 2480
 		$view->mkdir('subdir');
2481 2481
 
2482 2482
 		$sourcePath = 'substorage';
@@ -2485,7 +2485,7 @@  discard block
 block discarded – undo
2485 2485
 		$mount->expects($this->once())
2486 2486
 			->method('moveMount')
2487 2487
 			->willReturnCallback(
2488
-				function ($target) use ($mount, $view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring, &$lockTypeSharedRootDuring) {
2488
+				function($target) use ($mount, $view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring, &$lockTypeSharedRootDuring) {
2489 2489
 					$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath, true);
2490 2490
 					$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath, true);
2491 2491
 
@@ -2550,14 +2550,14 @@  discard block
 block discarded – undo
2550 2550
 		$eventHandler->expects($this->any())
2551 2551
 			->method('preCallback')
2552 2552
 			->willReturnCallback(
2553
-				function () use ($view, $path, $onMountPoint, &$lockTypePre) {
2553
+				function() use ($view, $path, $onMountPoint, &$lockTypePre) {
2554 2554
 					$lockTypePre = $this->getFileLockType($view, $path, $onMountPoint);
2555 2555
 				}
2556 2556
 			);
2557 2557
 		$eventHandler->expects($this->any())
2558 2558
 			->method('postCallback')
2559 2559
 			->willReturnCallback(
2560
-				function () use ($view, $path, $onMountPoint, &$lockTypePost) {
2560
+				function() use ($view, $path, $onMountPoint, &$lockTypePost) {
2561 2561
 					$lockTypePost = $this->getFileLockType($view, $path, $onMountPoint);
2562 2562
 				}
2563 2563
 			);
@@ -2571,7 +2571,7 @@  discard block
 block discarded – undo
2571 2571
 			);
2572 2572
 			Util::connectHook(
2573 2573
 				Filesystem::CLASSNAME,
2574
-				'post_' . $hookType,
2574
+				'post_'.$hookType,
2575 2575
 				$eventHandler,
2576 2576
 				'postCallback'
2577 2577
 			);
@@ -2599,7 +2599,7 @@  discard block
 block discarded – undo
2599 2599
 
2600 2600
 
2601 2601
 	public function testRemoveMoveableMountPoint(): void {
2602
-		$mountPoint = '/' . $this->user . '/files/mount/';
2602
+		$mountPoint = '/'.$this->user.'/files/mount/';
2603 2603
 
2604 2604
 		// Mock the mount point
2605 2605
 		/** @var TestMoveableMountPoint|\PHPUnit\Framework\MockObject\MockObject $mount */
@@ -2641,7 +2641,7 @@  discard block
 block discarded – undo
2641 2641
 		);
2642 2642
 
2643 2643
 		//Delete the mountpoint
2644
-		$view = new View('/' . $this->user . '/files');
2644
+		$view = new View('/'.$this->user.'/files');
2645 2645
 		$this->assertEquals('foo', $view->rmdir('mount'));
2646 2646
 	}
2647 2647
 
@@ -2662,7 +2662,7 @@  discard block
 block discarded – undo
2662 2662
 	public function testGetDirectoryContentMimeFilter($filter, $expected): void {
2663 2663
 		$storage1 = new Temporary();
2664 2664
 		$root = self::getUniqueID('/');
2665
-		Filesystem::mount($storage1, [], $root . '/');
2665
+		Filesystem::mount($storage1, [], $root.'/');
2666 2666
 		$view = new View($root);
2667 2667
 
2668 2668
 		$view->file_put_contents('test1.txt', 'asd');
@@ -2672,7 +2672,7 @@  discard block
 block discarded – undo
2672 2672
 
2673 2673
 		$content = $view->getDirectoryContent('', $filter);
2674 2674
 
2675
-		$files = array_map(function (FileInfo $info) {
2675
+		$files = array_map(function(FileInfo $info) {
2676 2676
 			return $info->getName();
2677 2677
 		}, $content);
2678 2678
 		sort($files);
@@ -2778,7 +2778,7 @@  discard block
 block discarded – undo
2778 2778
 		$calls = ['/new/folder', '/new/folder/structure'];
2779 2779
 		$view->expects($this->exactly(2))
2780 2780
 			->method('mkdir')
2781
-			->willReturnCallback(function ($dir) use (&$calls) {
2781
+			->willReturnCallback(function($dir) use (&$calls) {
2782 2782
 				$expected = array_shift($calls);
2783 2783
 				$this->assertEquals($expected, $dir);
2784 2784
 			});
@@ -2875,7 +2875,7 @@  discard block
 block discarded – undo
2875 2875
 	}
2876 2876
 
2877 2877
 	public function testCopyPreservesContent() {
2878
-		$viewUser1 = new View('/' . 'userId' . '/files');
2878
+		$viewUser1 = new View('/'.'userId'.'/files');
2879 2879
 		$viewUser1->mkdir('');
2880 2880
 		$viewUser1->file_put_contents('foo.txt', 'foo');
2881 2881
 		$viewUser1->copy('foo.txt', 'bar.txt');
Please login to merge, or discard this patch.
tests/lib/Share20/ManagerTest.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
 		$this->l10nFactory = $this->createMock(IFactory::class);
146 146
 		$this->l = $this->createMock(IL10N::class);
147 147
 		$this->l->method('t')
148
-			->willReturnCallback(function ($text, $parameters = []) {
148
+			->willReturnCallback(function($text, $parameters = []) {
149 149
 				return vsprintf($text, $parameters);
150 150
 			});
151 151
 		$this->l->method('n')
152
-			->willReturnCallback(function ($singular, $plural, $count, $parameters = []) {
152
+			->willReturnCallback(function($singular, $plural, $count, $parameters = []) {
153 153
 				return vsprintf(str_replace('%n', $count, ($count === 1) ? $singular : $plural), $parameters);
154 154
 			});
155 155
 		$this->l10nFactory->method('get')->willReturn($this->l);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 		];
278 278
 		$this->dispatcher->expects($this->exactly(2))
279 279
 			->method('dispatchTyped')
280
-			->willReturnCallback(function ($event) use (&$calls, $share) {
280
+			->willReturnCallback(function($event) use (&$calls, $share) {
281 281
 				$expected = array_shift($calls);
282 282
 				$this->assertInstanceOf($expected, $event);
283 283
 				$this->assertEquals($share, $event->getShare());
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 		];
321 321
 		$this->dispatcher->expects($this->exactly(2))
322 322
 			->method('dispatchTyped')
323
-			->willReturnCallback(function ($event) use (&$calls, $share) {
323
+			->willReturnCallback(function($event) use (&$calls, $share) {
324 324
 				$expected = array_shift($calls);
325 325
 				$this->assertInstanceOf($expected, $event);
326 326
 				$this->assertEquals($share, $event->getShare());
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 		];
381 381
 		$this->defaultProvider->expects($this->exactly(3))
382 382
 			->method('delete')
383
-			->willReturnCallback(function ($share) use (&$deleteCalls) {
383
+			->willReturnCallback(function($share) use (&$deleteCalls) {
384 384
 				$expected = array_shift($deleteCalls);
385 385
 				$this->assertEquals($expected, $share);
386 386
 			});
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 		];
396 396
 		$this->dispatcher->expects($this->exactly(6))
397 397
 			->method('dispatchTyped')
398
-			->willReturnCallback(function ($event) use (&$dispatchCalls) {
398
+			->willReturnCallback(function($event) use (&$dispatchCalls) {
399 399
 				$expected = array_shift($dispatchCalls);
400 400
 				$this->assertInstanceOf($expected[0], $event);
401 401
 				$this->assertEquals($expected[1]->getId(), $event->getShare()->getId());
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		$this->dispatcher->expects($this->once())
430 430
 			->method('dispatchTyped')
431 431
 			->with(
432
-				$this->callBack(function (ShareDeletedFromSelfEvent $e) use ($share) {
432
+				$this->callBack(function(ShareDeletedFromSelfEvent $e) use ($share) {
433 433
 					return $e->getShare() === $share;
434 434
 				})
435 435
 			);
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 		$this->defaultProvider
462 462
 			->expects($this->exactly(4))
463 463
 			->method('getChildren')
464
-			->willReturnCallback(function ($_share) use ($share, $shares) {
464
+			->willReturnCallback(function($_share) use ($share, $shares) {
465 465
 				if ($_share === $share) {
466 466
 					return $shares;
467 467
 				}
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 		];
476 476
 		$this->defaultProvider->expects($this->exactly(3))
477 477
 			->method('delete')
478
-			->willReturnCallback(function ($share) use (&$calls) {
478
+			->willReturnCallback(function($share) use (&$calls) {
479 479
 				$expected = array_shift($calls);
480 480
 				$this->assertEquals($expected, $share);
481 481
 			});
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 		$reShare->method('getNode')->willReturn($file);
505 505
 
506 506
 		$this->defaultProvider->method('getSharesBy')
507
-			->willReturnCallback(function ($userId, $shareType, $node, $reshares, $limit, $offset) use ($reShare, $file) {
507
+			->willReturnCallback(function($userId, $shareType, $node, $reshares, $limit, $offset) use ($reShare, $file) {
508 508
 				$this->assertEquals($file, $node);
509 509
 				if ($shareType === IShare::TYPE_USER) {
510 510
 					return match($userId) {
@@ -555,10 +555,10 @@  discard block
 block discarded – undo
555 555
 		$reShareInOtherFolder->method('getNode')->willReturn($otherFolder);
556 556
 
557 557
 		$this->defaultProvider->method('getSharesBy')
558
-			->willReturnCallback(function ($userId, $shareType, $node, $reshares, $limit, $offset) use ($reShare, $reShareInSubFolder, $reShareInOtherFolder) {
558
+			->willReturnCallback(function($userId, $shareType, $node, $reshares, $limit, $offset) use ($reShare, $reShareInSubFolder, $reShareInOtherFolder) {
559 559
 				if ($shareType === IShare::TYPE_USER) {
560 560
 					return match($userId) {
561
-						'userB' => [$reShare,$reShareInSubFolder,$reShareInOtherFolder],
561
+						'userB' => [$reShare, $reShareInSubFolder, $reShareInOtherFolder],
562 562
 					};
563 563
 				} else {
564 564
 					return [];
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 		];
573 573
 		$manager->expects($this->exactly(2))
574 574
 			->method('updateShare')
575
-			->willReturnCallback(function ($share) use (&$calls) {
575
+			->willReturnCallback(function($share) use (&$calls) {
576 576
 				$expected = array_shift($calls);
577 577
 				$this->assertEquals($expected, $share);
578 578
 			});
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 		$this->groupManager->method('get')->with('Group')->willReturn($group);
647 647
 
648 648
 		$this->defaultProvider->method('getSharesBy')
649
-			->willReturnCallback(function ($userId, $shareType, $node, $reshares, $limit, $offset) use ($reShare1, $reShare2) {
649
+			->willReturnCallback(function($userId, $shareType, $node, $reshares, $limit, $offset) use ($reShare1, $reShare2) {
650 650
 				if ($shareType === IShare::TYPE_USER) {
651 651
 					return match($userId) {
652 652
 						'userB' => [$reShare1],
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 		];
667 667
 		$manager->expects($this->exactly(2))
668 668
 			->method('updateShare')
669
-			->willReturnCallback(function ($share) use (&$calls) {
669
+			->willReturnCallback(function($share) use (&$calls) {
670 670
 				$expected = array_shift($calls);
671 671
 				$this->assertEquals($expected, $share);
672 672
 			});
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 		]);
774 774
 
775 775
 		$this->dispatcher->expects($this->once())->method('dispatchTyped')
776
-			->willReturnCallback(function (Event $event) {
776
+			->willReturnCallback(function(Event $event) {
777 777
 				$this->assertInstanceOf(ValidatePasswordPolicyEvent::class, $event);
778 778
 				/** @var ValidatePasswordPolicyEvent $event */
779 779
 				$this->assertSame('password', $event->getPassword());
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 		]);
796 796
 
797 797
 		$this->dispatcher->expects($this->once())->method('dispatchTyped')
798
-			->willReturnCallback(function (Event $event) {
798
+			->willReturnCallback(function(Event $event) {
799 799
 				$this->assertInstanceOf(ValidatePasswordPolicyEvent::class, $event);
800 800
 				/** @var ValidatePasswordPolicyEvent $event */
801 801
 				$this->assertSame('password', $event->getPassword());
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 
1279 1279
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1280 1280
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1281
-		$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) use ($future) {
1281
+		$hookListener->expects($this->once())->method('listener')->with($this->callback(function($data) use ($future) {
1282 1282
 			return $data['expirationDate'] == $future;
1283 1283
 		}));
1284 1284
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 
1305 1305
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1306 1306
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1307
-		$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) use ($expected) {
1307
+		$hookListener->expects($this->once())->method('listener')->with($this->callback(function($data) use ($expected) {
1308 1308
 			return $data['expirationDate'] == $expected && $data['passwordSet'] === false;
1309 1309
 		}));
1310 1310
 
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 	public function testValidateExpirationDateInternalNoDateNoDefault($shareType): void {
1320 1320
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1321 1321
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1322
-		$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) {
1322
+		$hookListener->expects($this->once())->method('listener')->with($this->callback(function($data) {
1323 1323
 			return $data['expirationDate'] === null && $data['passwordSet'] === true;
1324 1324
 		}));
1325 1325
 
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
 
1363 1363
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1364 1364
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1365
-		$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) use ($expected) {
1365
+		$hookListener->expects($this->once())->method('listener')->with($this->callback(function($data) use ($expected) {
1366 1366
 			return $data['expirationDate'] == $expected;
1367 1367
 		}));
1368 1368
 
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
 
1405 1405
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1406 1406
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1407
-		$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) use ($expected) {
1407
+		$hookListener->expects($this->once())->method('listener')->with($this->callback(function($data) use ($expected) {
1408 1408
 			return $data['expirationDate'] == $expected;
1409 1409
 		}));
1410 1410
 
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
 
1426 1426
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1427 1427
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1428
-		$hookListener->expects($this->once())->method('listener')->willReturnCallback(function ($data) {
1428
+		$hookListener->expects($this->once())->method('listener')->willReturnCallback(function($data) {
1429 1429
 			$data['expirationDate']->sub(new \DateInterval('P2D'));
1430 1430
 		});
1431 1431
 
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
 
1457 1457
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1458 1458
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1459
-		$hookListener->expects($this->once())->method('listener')->willReturnCallback(function ($data) {
1459
+		$hookListener->expects($this->once())->method('listener')->willReturnCallback(function($data) {
1460 1460
 			$data['accepted'] = false;
1461 1461
 			$data['message'] = 'Invalid date!';
1462 1462
 		});
@@ -1617,7 +1617,7 @@  discard block
 block discarded – undo
1617 1617
 
1618 1618
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1619 1619
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1620
-		$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) use ($future) {
1620
+		$hookListener->expects($this->once())->method('listener')->with($this->callback(function($data) use ($future) {
1621 1621
 			return $data['expirationDate'] == $future;
1622 1622
 		}));
1623 1623
 
@@ -1640,7 +1640,7 @@  discard block
 block discarded – undo
1640 1640
 
1641 1641
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1642 1642
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1643
-		$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) use ($expected) {
1643
+		$hookListener->expects($this->once())->method('listener')->with($this->callback(function($data) use ($expected) {
1644 1644
 			return $data['expirationDate'] == $expected && $data['passwordSet'] === false;
1645 1645
 		}));
1646 1646
 
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 	public function testValidateExpirationDateNoDateNoDefault(): void {
1653 1653
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1654 1654
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1655
-		$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) {
1655
+		$hookListener->expects($this->once())->method('listener')->with($this->callback(function($data) {
1656 1656
 			return $data['expirationDate'] === null && $data['passwordSet'] === true;
1657 1657
 		}));
1658 1658
 
@@ -1681,7 +1681,7 @@  discard block
 block discarded – undo
1681 1681
 
1682 1682
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1683 1683
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1684
-		$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) use ($expected) {
1684
+		$hookListener->expects($this->once())->method('listener')->with($this->callback(function($data) use ($expected) {
1685 1685
 			return $data['expirationDate'] == $expected;
1686 1686
 		}));
1687 1687
 
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 
1712 1712
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1713 1713
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1714
-		$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) use ($expected) {
1714
+		$hookListener->expects($this->once())->method('listener')->with($this->callback(function($data) use ($expected) {
1715 1715
 			return $data['expirationDate'] == $expected;
1716 1716
 		}));
1717 1717
 
@@ -1742,7 +1742,7 @@  discard block
 block discarded – undo
1742 1742
 
1743 1743
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1744 1744
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1745
-		$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) use ($expected) {
1745
+		$hookListener->expects($this->once())->method('listener')->with($this->callback(function($data) use ($expected) {
1746 1746
 			return $data['expirationDate'] == $expected;
1747 1747
 		}));
1748 1748
 
@@ -1762,7 +1762,7 @@  discard block
 block discarded – undo
1762 1762
 
1763 1763
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1764 1764
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1765
-		$hookListener->expects($this->once())->method('listener')->willReturnCallback(function ($data) {
1765
+		$hookListener->expects($this->once())->method('listener')->willReturnCallback(function($data) {
1766 1766
 			$data['expirationDate']->sub(new \DateInterval('P2D'));
1767 1767
 		});
1768 1768
 
@@ -1787,7 +1787,7 @@  discard block
 block discarded – undo
1787 1787
 
1788 1788
 		$hookListener = $this->createMock(DummyShareManagerListener::class);
1789 1789
 		\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
1790
-		$hookListener->expects($this->once())->method('listener')->willReturnCallback(function ($data) {
1790
+		$hookListener->expects($this->once())->method('listener')->willReturnCallback(function($data) {
1791 1791
 			$data['accepted'] = false;
1792 1792
 			$data['message'] = 'Invalid date!';
1793 1793
 		});
@@ -2619,7 +2619,7 @@  discard block
 block discarded – undo
2619 2619
 			->expects($this->once())
2620 2620
 			->method('create')
2621 2621
 			->with($share)
2622
-			->willReturnCallback(function (Share $share) {
2622
+			->willReturnCallback(function(Share $share) {
2623 2623
 				return $share->setId(42);
2624 2624
 			});
2625 2625
 
@@ -2629,7 +2629,7 @@  discard block
 block discarded – undo
2629 2629
 		];
2630 2630
 		$this->dispatcher->expects($this->exactly(2))
2631 2631
 			->method('dispatchTyped')
2632
-			->willReturnCallback(function ($event) use (&$calls, $date, $path) {
2632
+			->willReturnCallback(function($event) use (&$calls, $date, $path) {
2633 2633
 				$expected = array_shift($calls);
2634 2634
 				$this->assertInstanceOf($expected, $event);
2635 2635
 				$share = $event->getShare();
@@ -2716,7 +2716,7 @@  discard block
 block discarded – undo
2716 2716
 			->expects($this->once())
2717 2717
 			->method('create')
2718 2718
 			->with($share)
2719
-			->willReturnCallback(function (Share $share) {
2719
+			->willReturnCallback(function(Share $share) {
2720 2720
 				return $share->setId(42);
2721 2721
 			});
2722 2722
 
@@ -2726,7 +2726,7 @@  discard block
 block discarded – undo
2726 2726
 		];
2727 2727
 		$this->dispatcher->expects($this->exactly(2))
2728 2728
 			->method('dispatchTyped')
2729
-			->willReturnCallback(function ($event) use (&$calls, $path) {
2729
+			->willReturnCallback(function($event) use (&$calls, $path) {
2730 2730
 				$expected = array_shift($calls);
2731 2731
 				$this->assertInstanceOf($expected, $event);
2732 2732
 				$share = $event->getShare();
@@ -2813,7 +2813,7 @@  discard block
 block discarded – undo
2813 2813
 			->method('dispatchTyped')
2814 2814
 			->with(
2815 2815
 				$this->isInstanceOf(BeforeShareCreatedEvent::class)
2816
-			)->willReturnCallback(function (BeforeShareCreatedEvent $e) {
2816
+			)->willReturnCallback(function(BeforeShareCreatedEvent $e) {
2817 2817
 				$e->setError('I won\'t let you share!');
2818 2818
 				$e->stopPropagation();
2819 2819
 			}
@@ -2992,7 +2992,7 @@  discard block
 block discarded – undo
2992 2992
 		 */
2993 2993
 		$this->defaultProvider
2994 2994
 			->method('getSharesBy')
2995
-			->willReturnCallback(function ($uid, $type, $node, $reshares, $limit, $offset) use (&$shares2) {
2995
+			->willReturnCallback(function($uid, $type, $node, $reshares, $limit, $offset) use (&$shares2) {
2996 2996
 				return array_slice($shares2, $offset, $limit);
2997 2997
 			});
2998 2998
 
@@ -3000,7 +3000,7 @@  discard block
 block discarded – undo
3000 3000
 		 * Simulate the deleteShare call.
3001 3001
 		 */
3002 3002
 		$manager->method('deleteShare')
3003
-			->willReturnCallback(function ($share) use (&$shares2) {
3003
+			->willReturnCallback(function($share) use (&$shares2) {
3004 3004
 				for ($i = 0; $i < count($shares2); $i++) {
3005 3005
 					if ($shares2[$i]->getId() === $share->getId()) {
3006 3006
 						array_splice($shares2, $i, 1);
@@ -3072,7 +3072,7 @@  discard block
 block discarded – undo
3072 3072
 
3073 3073
 		$factory->expects($this->any())
3074 3074
 			->method('getProviderForType')
3075
-			->willReturnCallback(function ($shareType) use ($roomShareProvider) {
3075
+			->willReturnCallback(function($shareType) use ($roomShareProvider) {
3076 3076
 				if ($shareType !== IShare::TYPE_ROOM) {
3077 3077
 					throw new Exception\ProviderException();
3078 3078
 				}
@@ -3110,7 +3110,7 @@  discard block
 block discarded – undo
3110 3110
 		];
3111 3111
 		$factory->expects($this->exactly(2))
3112 3112
 			->method('getProviderForType')
3113
-			->willReturnCallback(function () use (&$calls) {
3113
+			->willReturnCallback(function() use (&$calls) {
3114 3114
 				$expected = array_shift($calls);
3115 3115
 				$this->assertEquals($expected, func_get_args());
3116 3116
 				return $this->defaultProvider;
@@ -3324,7 +3324,7 @@  discard block
 block discarded – undo
3324 3324
 			->setPassword('passwordHash');
3325 3325
 
3326 3326
 		$this->hasher->method('verify')->with('password', 'passwordHash', '')
3327
-			->willReturnCallback(function ($pass, $hash, &$newHash) {
3327
+			->willReturnCallback(function($pass, $hash, &$newHash) {
3328 3328
 				$newHash = 'newHash';
3329 3329
 
3330 3330
 				return true;
@@ -3332,7 +3332,7 @@  discard block
 block discarded – undo
3332 3332
 
3333 3333
 		$this->defaultProvider->expects($this->once())
3334 3334
 			->method('update')
3335
-			->with($this->callback(function (\OCP\Share\IShare $share) {
3335
+			->with($this->callback(function(\OCP\Share\IShare $share) {
3336 3336
 				return $share->getPassword() === 'newHash';
3337 3337
 			}));
3338 3338
 
@@ -4478,7 +4478,7 @@  discard block
 block discarded – undo
4478 4478
 	public function testShareProviderExists($shareType, $expected): void {
4479 4479
 		$factory = $this->getMockBuilder('OCP\Share\IProviderFactory')->getMock();
4480 4480
 		$factory->expects($this->any())->method('getProviderForType')
4481
-			->willReturnCallback(function ($id) {
4481
+			->willReturnCallback(function($id) {
4482 4482
 				if ($id === IShare::TYPE_USER) {
4483 4483
 					return true;
4484 4484
 				}
@@ -4675,7 +4675,7 @@  discard block
 block discarded – undo
4675 4675
 			->willReturn($userFolder);
4676 4676
 
4677 4677
 		$expected = [
4678
-			'users' => ['owner', 'user1', 'user2', 'user3', '123456','user4', 'user5', '234567'],
4678
+			'users' => ['owner', 'user1', 'user2', 'user3', '123456', 'user4', 'user5', '234567'],
4679 4679
 			'remote' => true,
4680 4680
 			'public' => true,
4681 4681
 		];
@@ -4810,12 +4810,12 @@  discard block
 block discarded – undo
4810 4810
 		$share4 = $this->createMock(IShare::class);
4811 4811
 
4812 4812
 		$this->defaultProvider->method('getAllShares')
4813
-			->willReturnCallback(function () use ($share1, $share2) {
4813
+			->willReturnCallback(function() use ($share1, $share2) {
4814 4814
 				yield $share1;
4815 4815
 				yield $share2;
4816 4816
 			});
4817 4817
 		$extraProvider->method('getAllShares')
4818
-			->willReturnCallback(function () use ($share3, $share4) {
4818
+			->willReturnCallback(function() use ($share3, $share4) {
4819 4819
 				yield $share3;
4820 4820
 				yield $share4;
4821 4821
 			});
Please login to merge, or discard this patch.
tests/Core/Command/Encryption/SetDefaultModuleTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@
 block discarded – undo
119 119
 		];
120 120
 		$this->consoleOutput->expects($this->exactly(2))
121 121
 			->method('writeln')
122
-			->willReturnCallback(function ($message) use (&$calls) {
122
+			->willReturnCallback(function($message) use (&$calls) {
123 123
 				$expected = array_shift($calls);
124 124
 				$this->assertStringContainsString($expected, $message);
125 125
 			});
Please login to merge, or discard this patch.