diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /tests/lib/Files/Storage/Wrapper | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Files/Storage/Wrapper')
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/EncodingTest.php | 1 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/EncryptionTest.php | 25 |
2 files changed, 11 insertions, 15 deletions
diff --git a/tests/lib/Files/Storage/Wrapper/EncodingTest.php b/tests/lib/Files/Storage/Wrapper/EncodingTest.php index 9060ca2dac3..1f199239a8e 100644 --- a/tests/lib/Files/Storage/Wrapper/EncodingTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncodingTest.php @@ -9,7 +9,6 @@ namespace Test\Files\Storage\Wrapper; class EncodingTest extends \Test\Files\Storage\Storage { - const NFD_NAME = 'ümlaut'; const NFC_NAME = 'ümlaut'; diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index c50015483fb..73de60e3652 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -110,7 +110,6 @@ class EncryptionTest extends Storage { private $dummySize = -1; protected function setUp(): void { - parent::setUp(); $mockModule = $this->buildMockModule(); @@ -174,7 +173,9 @@ class EncryptionTest extends Storage { ->disableOriginalConstructor()->getMock(); $this->cache->expects($this->any()) ->method('get') - ->willReturnCallback(function ($path) {return ['encrypted' => false, 'path' => $path];}); + ->willReturnCallback(function ($path) { + return ['encrypted' => false, 'path' => $path]; + }); $this->mountManager = $this->createMock(\OC\Files\Mount\Manager::class); $this->mountManager->method('findByStorageId') @@ -244,7 +245,6 @@ class EncryptionTest extends Storage { * @param array $expected */ public function testGetMetaData($path, $metaData, $encrypted, $unencryptedSizeSet, $storedUnencryptedSize, $expected) { - $sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); @@ -273,7 +273,7 @@ class EncryptionTest extends Storage { ->setMethods(['getCache', 'verifyUnencryptedSize']) ->getMock(); - if($unencryptedSizeSet) { + if ($unencryptedSizeSet) { $this->invokePrivate($this->instance, 'unencryptedSize', [[$path => $storedUnencryptedSize]]); } @@ -298,10 +298,10 @@ class EncryptionTest extends Storage { } $result = $this->instance->getMetaData($path); - if(isset($expected['encrypted'])) { + if (isset($expected['encrypted'])) { $this->assertSame($expected['encrypted'], (bool)$result['encrypted']); - if(isset($expected['encryptedVersion'])) { + if (isset($expected['encryptedVersion'])) { $this->assertSame($expected['encryptedVersion'], $result['encryptedVersion']); } } @@ -352,7 +352,6 @@ class EncryptionTest extends Storage { $this->assertSame(42, $this->instance->filesize('/test.txt') ); - } /** @@ -561,7 +560,6 @@ class EncryptionTest extends Storage { * @param string $strippedPath */ public function testGetHeader($path, $strippedPathExists, $strippedPath) { - $sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); @@ -629,7 +627,6 @@ class EncryptionTest extends Storage { * @dataProvider dataTestGetHeaderAddLegacyModule */ public function testGetHeaderAddLegacyModule($header, $isEncrypted, $exists, $expected) { - $sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); @@ -645,7 +642,9 @@ class EncryptionTest extends Storage { ->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) ->method('get') - ->willReturnCallback(function ($path) use ($isEncrypted) {return ['encrypted' => $isEncrypted, 'path' => $path];}); + ->willReturnCallback(function ($path) use ($isEncrypted) { + return ['encrypted' => $isEncrypted, 'path' => $path]; + }); $instance = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Encryption') ->setConstructorArgs( @@ -792,7 +791,7 @@ class EncryptionTest extends Storage { }); $storage2->method('getId') ->willReturn('stroage2'); - if($expectedEncrypted) { + if ($expectedEncrypted) { $cache = $this->createMock(ICache::class); $cache->expects($this->once()) ->method('get') @@ -816,7 +815,7 @@ class EncryptionTest extends Storage { $expectedCachePut = [ 'encrypted' => $expectedEncrypted, ]; - if($expectedEncrypted === true) { + if ($expectedEncrypted === true) { $expectedCachePut['encryptedVersion'] = 1; } @@ -840,7 +839,6 @@ class EncryptionTest extends Storage { * @param bool $encrypted */ public function testCopyBetweenStorageVersions($sourceInternalPath, $targetInternalPath, $copyResult, $encrypted) { - $sourceStorage = $this->createMock(\OC\Files\Storage\Storage::class); $targetStorage = $this->createMock(\OC\Files\Storage\Storage::class); @@ -1043,5 +1041,4 @@ class EncryptionTest extends Storage { [true, null, false, true], ]; } - } |