From 49dd79eabb2b8902559a7a4e8f8fcad54f46b604 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Sun, 15 Sep 2024 22:32:31 +0200 Subject: refactor: Add void return type to PHPUnit test methods Signed-off-by: Christoph Wurst --- tests/lib/Files/Storage/CommonTest.php | 10 +-- tests/lib/Files/Storage/HomeTest.php | 6 +- tests/lib/Files/Storage/LocalTest.php | 24 +++---- tests/lib/Files/Storage/Storage.php | 78 +++++++++++----------- tests/lib/Files/Storage/StorageFactoryTest.php | 6 +- .../lib/Files/Storage/Wrapper/AvailabilityTest.php | 12 ++-- tests/lib/Files/Storage/Wrapper/EncodingTest.php | 26 ++++---- tests/lib/Files/Storage/Wrapper/EncryptionTest.php | 30 ++++----- tests/lib/Files/Storage/Wrapper/JailTest.php | 4 +- tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php | 2 +- .../Files/Storage/Wrapper/PermissionsMaskTest.php | 32 ++++----- tests/lib/Files/Storage/Wrapper/QuotaTest.php | 36 +++++----- tests/lib/Files/Storage/Wrapper/WrapperTest.php | 2 +- 13 files changed, 134 insertions(+), 134 deletions(-) (limited to 'tests/lib/Files/Storage') diff --git a/tests/lib/Files/Storage/CommonTest.php b/tests/lib/Files/Storage/CommonTest.php index 321894cc23b..b51b35be8f9 100644 --- a/tests/lib/Files/Storage/CommonTest.php +++ b/tests/lib/Files/Storage/CommonTest.php @@ -42,7 +42,7 @@ class CommonTest extends Storage { parent::tearDown(); } - public function testVerifyPath() { + public function testVerifyPath(): void { $this->filenameValidator ->expects($this->once()) ->method('validateFilename') @@ -53,7 +53,7 @@ class CommonTest extends Storage { $this->instance->verifyPath('/', 'invalid:char.txt'); } - public function testVerifyPathSucceed() { + public function testVerifyPathSucceed(): void { $this->filenameValidator ->expects($this->once()) ->method('validateFilename') @@ -62,7 +62,7 @@ class CommonTest extends Storage { $this->instance->verifyPath('/', 'valid-char.txt'); } - public function testMoveFromStorageWrapped() { + public function testMoveFromStorageWrapped(): void { /** @var \OC\Files\Storage\CommonTest|MockObject $instance */ $instance = $this->getMockBuilder(\OC\Files\Storage\CommonTest::class) ->onlyMethods(['copyFromStorage', 'rmdir', 'unlink']) @@ -80,7 +80,7 @@ class CommonTest extends Storage { $this->assertTrue($instance->file_exists('bar.txt')); } - public function testMoveFromStorageJailed() { + public function testMoveFromStorageJailed(): void { /** @var \OC\Files\Storage\CommonTest|MockObject $instance */ $instance = $this->getMockBuilder(\OC\Files\Storage\CommonTest::class) ->onlyMethods(['copyFromStorage', 'rmdir', 'unlink']) @@ -103,7 +103,7 @@ class CommonTest extends Storage { $this->assertTrue($instance->file_exists('bar.txt')); } - public function testMoveFromStorageNestedJail() { + public function testMoveFromStorageNestedJail(): void { /** @var \OC\Files\Storage\CommonTest|MockObject $instance */ $instance = $this->getMockBuilder(\OC\Files\Storage\CommonTest::class) ->onlyMethods(['copyFromStorage', 'rmdir', 'unlink']) diff --git a/tests/lib/Files/Storage/HomeTest.php b/tests/lib/Files/Storage/HomeTest.php index c3111e74259..b6d0f1aa85a 100644 --- a/tests/lib/Files/Storage/HomeTest.php +++ b/tests/lib/Files/Storage/HomeTest.php @@ -69,18 +69,18 @@ class HomeTest extends Storage { /** * Tests that the home id is in the format home::user1 */ - public function testId() { + public function testId(): void { $this->assertEquals('home::' . $this->userId, $this->instance->getId()); } /** * Tests that getCache() returns an instance of HomeCache */ - public function testGetCacheReturnsHomeCache() { + public function testGetCacheReturnsHomeCache(): void { $this->assertInstanceOf('\OC\Files\Cache\HomeCache', $this->instance->getCache()); } - public function testGetOwner() { + public function testGetOwner(): void { $this->assertEquals($this->userId, $this->instance->getOwner('')); } } diff --git a/tests/lib/Files/Storage/LocalTest.php b/tests/lib/Files/Storage/LocalTest.php index efe5dd04e47..4a98970f233 100644 --- a/tests/lib/Files/Storage/LocalTest.php +++ b/tests/lib/Files/Storage/LocalTest.php @@ -32,14 +32,14 @@ class LocalTest extends Storage { parent::tearDown(); } - public function testStableEtag() { + public function testStableEtag(): void { $this->instance->file_put_contents('test.txt', 'foobar'); $etag1 = $this->instance->getETag('test.txt'); $etag2 = $this->instance->getETag('test.txt'); $this->assertEquals($etag1, $etag2); } - public function testEtagChange() { + public function testEtagChange(): void { $this->instance->file_put_contents('test.txt', 'foo'); $this->instance->touch('test.txt', time() - 2); $etag1 = $this->instance->getETag('test.txt'); @@ -49,21 +49,21 @@ class LocalTest extends Storage { } - public function testInvalidArgumentsEmptyArray() { + public function testInvalidArgumentsEmptyArray(): void { $this->expectException(\InvalidArgumentException::class); new \OC\Files\Storage\Local([]); } - public function testInvalidArgumentsNoArray() { + public function testInvalidArgumentsNoArray(): void { $this->expectException(\InvalidArgumentException::class); new \OC\Files\Storage\Local(null); } - public function testDisallowSymlinksOutsideDatadir() { + public function testDisallowSymlinksOutsideDatadir(): void { $this->expectException(\OCP\Files\ForbiddenException::class); $subDir1 = $this->tmpDir . 'sub1'; @@ -79,7 +79,7 @@ class LocalTest extends Storage { $storage->file_put_contents('sym/foo', 'bar'); } - public function testDisallowSymlinksInsideDatadir() { + public function testDisallowSymlinksInsideDatadir(): void { $subDir1 = $this->tmpDir . 'sub1'; $subDir2 = $this->tmpDir . 'sub1/sub2'; $sym = $this->tmpDir . 'sub1/sym'; @@ -94,21 +94,21 @@ class LocalTest extends Storage { $this->addToAssertionCount(1); } - public function testWriteUmaskFilePutContents() { + public function testWriteUmaskFilePutContents(): void { $oldMask = umask(0333); $this->instance->file_put_contents('test.txt', 'sad'); umask($oldMask); $this->assertTrue($this->instance->isUpdatable('test.txt')); } - public function testWriteUmaskMkdir() { + public function testWriteUmaskMkdir(): void { $oldMask = umask(0333); $this->instance->mkdir('test.txt'); umask($oldMask); $this->assertTrue($this->instance->isUpdatable('test.txt')); } - public function testWriteUmaskFopen() { + public function testWriteUmaskFopen(): void { $oldMask = umask(0333); $handle = $this->instance->fopen('test.txt', 'w'); fwrite($handle, 'foo'); @@ -117,7 +117,7 @@ class LocalTest extends Storage { $this->assertTrue($this->instance->isUpdatable('test.txt')); } - public function testWriteUmaskCopy() { + public function testWriteUmaskCopy(): void { $this->instance->file_put_contents('source.txt', 'sad'); $oldMask = umask(0333); $this->instance->copy('source.txt', 'test.txt'); @@ -125,12 +125,12 @@ class LocalTest extends Storage { $this->assertTrue($this->instance->isUpdatable('test.txt')); } - public function testUnavailableExternal() { + public function testUnavailableExternal(): void { $this->expectException(\OCP\Files\StorageNotAvailableException::class); $this->instance = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir . '/unexist', 'isExternal' => true]); } - public function testUnavailableNonExternal() { + public function testUnavailableNonExternal(): void { $this->instance = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir . '/unexist']); // no exception thrown $this->assertNotNull($this->instance); diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php index 747cb4b6f43..5b0bbf2f95b 100644 --- a/tests/lib/Files/Storage/Storage.php +++ b/tests/lib/Files/Storage/Storage.php @@ -30,7 +30,7 @@ abstract class Storage extends \Test\TestCase { /** * the root folder of the storage should always exist, be readable and be recognized as a directory */ - public function testRoot() { + public function testRoot(): void { $this->assertTrue($this->instance->file_exists('/'), 'Root folder does not exist'); $this->assertTrue($this->instance->isReadable('/'), 'Root folder is not readable'); $this->assertTrue($this->instance->is_dir('/'), 'Root folder is not a directory'); @@ -44,14 +44,14 @@ abstract class Storage extends \Test\TestCase { /** * Check that the test() function works */ - public function testTestFunction() { + public function testTestFunction(): void { $this->assertTrue($this->instance->test()); } /** * @dataProvider directoryProvider */ - public function testDirectories($directory) { + public function testDirectories($directory): void { $this->assertFalse($this->instance->file_exists('/' . $directory)); $this->assertTrue($this->instance->mkdir('/' . $directory)); @@ -144,7 +144,7 @@ abstract class Storage extends \Test\TestCase { * * @dataProvider loremFileProvider */ - public function testGetPutContents($sourceFile) { + public function testGetPutContents($sourceFile): void { $sourceText = file_get_contents($sourceFile); //fill a file with string data @@ -160,7 +160,7 @@ abstract class Storage extends \Test\TestCase { /** * test various known mimetypes */ - public function testMimeType() { + public function testMimeType(): void { $this->assertEquals('httpd/unix-directory', $this->instance->getMimeType('/')); $this->assertEquals(false, $this->instance->getMimeType('/non/existing/file')); @@ -212,7 +212,7 @@ abstract class Storage extends \Test\TestCase { /** * @dataProvider copyAndMoveProvider */ - public function testCopy($source, $target) { + public function testCopy($source, $target): void { $this->initSourceAndTarget($source); $this->instance->copy($source, $target); @@ -225,7 +225,7 @@ abstract class Storage extends \Test\TestCase { /** * @dataProvider copyAndMoveProvider */ - public function testMove($source, $target) { + public function testMove($source, $target): void { $this->initSourceAndTarget($source); $this->instance->rename($source, $target); @@ -239,7 +239,7 @@ abstract class Storage extends \Test\TestCase { /** * @dataProvider copyAndMoveProvider */ - public function testCopyOverwrite($source, $target) { + public function testCopyOverwrite($source, $target): void { $this->initSourceAndTarget($source, $target); $this->instance->copy($source, $target); @@ -253,7 +253,7 @@ abstract class Storage extends \Test\TestCase { /** * @dataProvider copyAndMoveProvider */ - public function testMoveOverwrite($source, $target) { + public function testMoveOverwrite($source, $target): void { $this->initSourceAndTarget($source, $target); $this->instance->rename($source, $target); @@ -263,7 +263,7 @@ abstract class Storage extends \Test\TestCase { $this->assertSameAsLorem($target); } - public function testLocal() { + public function testLocal(): void { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); $localFile = $this->instance->getLocalFile('/lorem.txt'); @@ -290,7 +290,7 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals(file_get_contents($localFile), 'foo'); } - public function testStat() { + public function testStat(): void { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $ctimeStart = time(); $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); @@ -325,7 +325,7 @@ abstract class Storage extends \Test\TestCase { * Test whether checkUpdate properly returns false when there was * no change. */ - public function testCheckUpdate() { + public function testCheckUpdate(): void { if ($this->instance instanceof \OC\Files\Storage\Wrapper\Wrapper) { $this->markTestSkipped('Cannot test update check on wrappers'); } @@ -337,7 +337,7 @@ abstract class Storage extends \Test\TestCase { $this->assertFalse($watcher->checkUpdate('/lorem.txt'), 'No update'); } - public function testUnlink() { + public function testUnlink(): void { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); @@ -352,7 +352,7 @@ abstract class Storage extends \Test\TestCase { /** * @dataProvider fileNameProvider */ - public function testFOpen($fileName) { + public function testFOpen($fileName): void { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $fh = @$this->instance->fopen($fileName, 'r'); @@ -372,14 +372,14 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals(file_get_contents($textFile), $content); } - public function testTouchCreateFile() { + public function testTouchCreateFile(): void { $this->assertFalse($this->instance->file_exists('touch')); // returns true on success $this->assertTrue($this->instance->touch('touch')); $this->assertTrue($this->instance->file_exists('touch')); } - public function testRecursiveRmdir() { + public function testRecursiveRmdir(): void { $this->instance->mkdir('folder'); $this->instance->mkdir('folder/bar'); $this->wait(); @@ -393,14 +393,14 @@ abstract class Storage extends \Test\TestCase { $this->assertFalse($this->instance->file_exists('folder')); } - public function testRmdirEmptyFolder() { + public function testRmdirEmptyFolder(): void { $this->assertTrue($this->instance->mkdir('empty')); $this->wait(); $this->assertTrue($this->instance->rmdir('empty')); $this->assertFalse($this->instance->file_exists('empty')); } - public function testRecursiveUnlink() { + public function testRecursiveUnlink(): void { $this->instance->mkdir('folder'); $this->instance->mkdir('folder/bar'); $this->instance->file_put_contents('folder/asd.txt', 'foobar'); @@ -424,13 +424,13 @@ abstract class Storage extends \Test\TestCase { /** * @dataProvider hashProvider */ - public function testHash($data, $type) { + public function testHash($data, $type): void { $this->instance->file_put_contents('hash.txt', $data); $this->assertEquals(hash($type, $data), $this->instance->hash($type, 'hash.txt')); $this->assertEquals(hash($type, $data, true), $this->instance->hash($type, 'hash.txt', true)); } - public function testHashInFileName() { + public function testHashInFileName(): void { $this->instance->file_put_contents('#test.txt', 'data'); $this->assertEquals('data', $this->instance->file_get_contents('#test.txt')); @@ -449,14 +449,14 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals(['test.txt'], $content); } - public function testCopyOverWriteFile() { + public function testCopyOverWriteFile(): void { $this->instance->file_put_contents('target.txt', 'foo'); $this->instance->file_put_contents('source.txt', 'bar'); $this->instance->copy('source.txt', 'target.txt'); $this->assertEquals('bar', $this->instance->file_get_contents('target.txt')); } - public function testRenameOverWriteFile() { + public function testRenameOverWriteFile(): void { $this->instance->file_put_contents('target.txt', 'foo'); $this->instance->file_put_contents('source.txt', 'bar'); $this->instance->rename('source.txt', 'target.txt'); @@ -464,7 +464,7 @@ abstract class Storage extends \Test\TestCase { $this->assertFalse($this->instance->file_exists('source.txt')); } - public function testRenameDirectory() { + public function testRenameDirectory(): void { $this->instance->mkdir('source'); $this->instance->file_put_contents('source/test1.txt', 'foo'); $this->instance->file_put_contents('source/test2.txt', 'qwerty'); @@ -492,7 +492,7 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals('bar', $this->instance->file_get_contents('target/subfolder/test.txt')); } - public function testRenameOverWriteDirectory() { + public function testRenameOverWriteDirectory(): void { $this->instance->mkdir('source'); $this->instance->file_put_contents('source/test1.txt', 'foo'); @@ -508,7 +508,7 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals('foo', $this->instance->file_get_contents('target/test1.txt'), 'target/test1.txt has not been overwritten'); } - public function testRenameOverWriteDirectoryOverFile() { + public function testRenameOverWriteDirectoryOverFile(): void { $this->instance->mkdir('source'); $this->instance->file_put_contents('source/test1.txt', 'foo'); @@ -521,7 +521,7 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals('foo', $this->instance->file_get_contents('target/test1.txt')); } - public function testCopyDirectory() { + public function testCopyDirectory(): void { $this->instance->mkdir('source'); $this->instance->file_put_contents('source/test1.txt', 'foo'); $this->instance->file_put_contents('source/test2.txt', 'qwerty'); @@ -546,7 +546,7 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals('bar', $this->instance->file_get_contents('target/subfolder/test.txt')); } - public function testCopyOverWriteDirectory() { + public function testCopyOverWriteDirectory(): void { $this->instance->mkdir('source'); $this->instance->file_put_contents('source/test1.txt', 'foo'); @@ -560,7 +560,7 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals('foo', $this->instance->file_get_contents('target/test1.txt')); } - public function testCopyOverWriteDirectoryOverFile() { + public function testCopyOverWriteDirectoryOverFile(): void { $this->instance->mkdir('source'); $this->instance->file_put_contents('source/test1.txt', 'foo'); @@ -571,7 +571,7 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals('foo', $this->instance->file_get_contents('target/test1.txt')); } - public function testInstanceOfStorage() { + public function testInstanceOfStorage(): void { $this->assertTrue($this->instance->instanceOfStorage('\OCP\Files\Storage')); $this->assertTrue($this->instance->instanceOfStorage(get_class($this->instance))); $this->assertFalse($this->instance->instanceOfStorage('\OC')); @@ -580,7 +580,7 @@ abstract class Storage extends \Test\TestCase { /** * @dataProvider copyAndMoveProvider */ - public function testCopyFromSameStorage($source, $target) { + public function testCopyFromSameStorage($source, $target): void { $this->initSourceAndTarget($source); $this->instance->copyFromStorage($this->instance, $source, $target); @@ -590,32 +590,32 @@ abstract class Storage extends \Test\TestCase { $this->assertTrue($this->instance->file_exists($source), $source . ' was deleted'); } - public function testIsCreatable() { + public function testIsCreatable(): void { $this->instance->mkdir('source'); $this->assertTrue($this->instance->isCreatable('source')); } - public function testIsReadable() { + public function testIsReadable(): void { $this->instance->mkdir('source'); $this->assertTrue($this->instance->isReadable('source')); } - public function testIsUpdatable() { + public function testIsUpdatable(): void { $this->instance->mkdir('source'); $this->assertTrue($this->instance->isUpdatable('source')); } - public function testIsDeletable() { + public function testIsDeletable(): void { $this->instance->mkdir('source'); $this->assertTrue($this->instance->isDeletable('source')); } - public function testIsShareable() { + public function testIsShareable(): void { $this->instance->mkdir('source'); $this->assertTrue($this->instance->isSharable('source')); } - public function testStatAfterWrite() { + public function testStatAfterWrite(): void { $this->instance->file_put_contents('foo.txt', 'bar'); $stat = $this->instance->stat('foo.txt'); $this->assertEquals(3, $stat['size']); @@ -628,13 +628,13 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals(6, $stat['size']); } - public function testPartFile() { + public function testPartFile(): void { $this->instance->file_put_contents('bar.txt.part', 'bar'); $this->instance->rename('bar.txt.part', 'bar.txt'); $this->assertEquals('bar', $this->instance->file_get_contents('bar.txt')); } - public function testWriteStream() { + public function testWriteStream(): void { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; if (!$this->instance->instanceOfStorage(IWriteStreamStorage::class)) { @@ -651,7 +651,7 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals('resource (closed)', gettype($source)); } - public function testFseekSize() { + public function testFseekSize(): void { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $this->instance->file_put_contents('bar.txt', file_get_contents($textFile)); diff --git a/tests/lib/Files/Storage/StorageFactoryTest.php b/tests/lib/Files/Storage/StorageFactoryTest.php index ee23f6199c9..66f2a2af9a6 100644 --- a/tests/lib/Files/Storage/StorageFactoryTest.php +++ b/tests/lib/Files/Storage/StorageFactoryTest.php @@ -25,7 +25,7 @@ class DummyWrapper extends Wrapper { } class StorageFactoryTest extends TestCase { - public function testSimpleWrapper() { + public function testSimpleWrapper(): void { $instance = new \OC\Files\Storage\StorageFactory(); $mount = new MountPoint('\OC\Files\Storage\Temporary', '/foo', [[]], $instance); $instance->addStorageWrapper('dummy', function ($mountPoint, IStorage $storage, IMountPoint $mount) { @@ -38,7 +38,7 @@ class StorageFactoryTest extends TestCase { $this->assertInstanceOf('\Test\Files\Storage\DummyWrapper', $wrapped); } - public function testRemoveWrapper() { + public function testRemoveWrapper(): void { $instance = new \OC\Files\Storage\StorageFactory(); $mount = new MountPoint('\OC\Files\Storage\Temporary', '/foo', [[]], $instance); $instance->addStorageWrapper('dummy', function ($mountPoint, IStorage $storage) { @@ -49,7 +49,7 @@ class StorageFactoryTest extends TestCase { $this->assertInstanceOf('\OC\Files\Storage\Temporary', $wrapped); } - public function testWrapperPriority() { + public function testWrapperPriority(): void { $instance = new \OC\Files\Storage\StorageFactory(); $mount = new MountPoint('\OC\Files\Storage\Temporary', '/foo', [[]], $instance); $instance->addStorageWrapper('dummy1', function ($mountPoint, IStorage $storage) { diff --git a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php index 8e64269a2f4..616fd023414 100644 --- a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php +++ b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php @@ -36,7 +36,7 @@ class AvailabilityTest extends \Test\TestCase { /** * Storage is available */ - public function testAvailable() { + public function testAvailable(): void { $this->storage->expects($this->once()) ->method('getAvailability') ->willReturn(['available' => true, 'last_checked' => 0]); @@ -52,7 +52,7 @@ class AvailabilityTest extends \Test\TestCase { * Storage marked unavailable, TTL not expired * */ - public function testUnavailable() { + public function testUnavailable(): void { $this->expectException(\OCP\Files\StorageNotAvailableException::class); $this->storage->expects($this->once()) @@ -69,7 +69,7 @@ class AvailabilityTest extends \Test\TestCase { /** * Storage marked unavailable, TTL expired */ - public function testUnavailableRecheck() { + public function testUnavailableRecheck(): void { $this->storage->expects($this->once()) ->method('getAvailability') ->willReturn(['available' => false, 'last_checked' => 0]); @@ -92,7 +92,7 @@ class AvailabilityTest extends \Test\TestCase { * Storage marked available, but throws StorageNotAvailableException * */ - public function testAvailableThrowStorageNotAvailable() { + public function testAvailableThrowStorageNotAvailable(): void { $this->expectException(\OCP\Files\StorageNotAvailableException::class); $this->storage->expects($this->once()) @@ -114,7 +114,7 @@ class AvailabilityTest extends \Test\TestCase { * Storage available, but call fails * Method failure does not indicate storage unavailability */ - public function testAvailableFailure() { + public function testAvailableFailure(): void { $this->storage->expects($this->once()) ->method('getAvailability') ->willReturn(['available' => true, 'last_checked' => 0]); @@ -134,7 +134,7 @@ class AvailabilityTest extends \Test\TestCase { * Standard exception does not indicate storage unavailability * */ - public function testAvailableThrow() { + public function testAvailableThrow(): void { $this->expectException(\Exception::class); $this->storage->expects($this->once()) diff --git a/tests/lib/Files/Storage/Wrapper/EncodingTest.php b/tests/lib/Files/Storage/Wrapper/EncodingTest.php index ae6a6ece742..4256337f08e 100644 --- a/tests/lib/Files/Storage/Wrapper/EncodingTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncodingTest.php @@ -57,7 +57,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { /** * @dataProvider accessNameProvider */ - public function testFputEncoding($accessName) { + public function testFputEncoding($accessName): void { $this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar'); $this->assertEquals('bar', $this->instance->file_get_contents($accessName)); } @@ -65,7 +65,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { /** * @dataProvider accessNameProvider */ - public function testFopenReadEncoding($accessName) { + public function testFopenReadEncoding($accessName): void { $this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar'); $fh = $this->instance->fopen($accessName, 'r'); $data = fgets($fh); @@ -76,7 +76,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { /** * @dataProvider accessNameProvider */ - public function testFopenOverwriteEncoding($accessName) { + public function testFopenOverwriteEncoding($accessName): void { $this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar'); $fh = $this->instance->fopen($accessName, 'w'); $data = fputs($fh, 'test'); @@ -89,7 +89,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { /** * @dataProvider accessNameProvider */ - public function testFileExistsEncoding($accessName) { + public function testFileExistsEncoding($accessName): void { $this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar'); $this->assertTrue($this->instance->file_exists($accessName)); } @@ -97,14 +97,14 @@ class EncodingTest extends \Test\Files\Storage\Storage { /** * @dataProvider accessNameProvider */ - public function testUnlinkEncoding($accessName) { + public function testUnlinkEncoding($accessName): void { $this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar'); $this->assertTrue($this->instance->unlink($accessName)); $this->assertFalse($this->sourceStorage->file_exists(self::NFC_NAME)); $this->assertFalse($this->sourceStorage->file_exists(self::NFD_NAME)); } - public function testNfcHigherPriority() { + public function testNfcHigherPriority(): void { $this->sourceStorage->file_put_contents(self::NFC_NAME, 'nfc'); $this->sourceStorage->file_put_contents(self::NFD_NAME, 'nfd'); $this->assertEquals('nfc', $this->instance->file_get_contents(self::NFC_NAME)); @@ -121,7 +121,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { /** * @dataProvider encodedDirectoriesProvider */ - public function testOperationInsideDirectory($sourceDir, $accessDir) { + public function testOperationInsideDirectory($sourceDir, $accessDir): void { $this->sourceStorage->mkdir($sourceDir); $this->instance->file_put_contents($accessDir . '/test.txt', 'bar'); $this->assertTrue($this->instance->file_exists($accessDir . '/test.txt')); @@ -138,7 +138,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { $this->assertTrue($this->instance->file_exists($accessDir . '/' . self::NFC_NAME)); } - public function testCacheExtraSlash() { + public function testCacheExtraSlash(): void { $this->sourceStorage->file_put_contents(self::NFD_NAME, 'foo'); $this->assertEquals(3, $this->instance->file_put_contents(self::NFC_NAME, 'bar')); $this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME)); @@ -162,7 +162,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { /** * @dataProvider sourceAndTargetDirectoryProvider */ - public function testCopyAndMoveEncodedFolder($sourceDir, $targetDir) { + public function testCopyAndMoveEncodedFolder($sourceDir, $targetDir): void { $this->sourceStorage->mkdir($sourceDir); $this->sourceStorage->mkdir($targetDir); $this->sourceStorage->file_put_contents($sourceDir . '/test.txt', 'bar'); @@ -182,7 +182,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { /** * @dataProvider sourceAndTargetDirectoryProvider */ - public function testCopyAndMoveFromStorageEncodedFolder($sourceDir, $targetDir) { + public function testCopyAndMoveFromStorageEncodedFolder($sourceDir, $targetDir): void { $this->sourceStorage->mkdir($sourceDir); $this->sourceStorage->mkdir($targetDir); $this->sourceStorage->file_put_contents($sourceDir . '/test.txt', 'bar'); @@ -199,7 +199,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { $this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME . '2/test2.txt')); } - public function testNormalizedDirectoryEntriesOpenDir() { + public function testNormalizedDirectoryEntriesOpenDir(): void { $this->sourceStorage->mkdir('/test'); $this->sourceStorage->mkdir('/test/' . self::NFD_NAME); @@ -218,7 +218,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { $this->assertEquals(self::NFC_NAME, $content[0]); } - public function testNormalizedDirectoryEntriesGetDirectoryContent() { + public function testNormalizedDirectoryEntriesGetDirectoryContent(): void { $this->sourceStorage->mkdir('/test'); $this->sourceStorage->mkdir('/test/' . self::NFD_NAME); @@ -230,7 +230,7 @@ class EncodingTest extends \Test\Files\Storage\Storage { $this->assertEquals(self::NFC_NAME, $content[0]['name']); } - public function testNormalizedGetMetaData() { + public function testNormalizedGetMetaData(): void { $this->sourceStorage->mkdir('/test'); $this->sourceStorage->mkdir('/test/' . self::NFD_NAME); diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index 74b91216c37..2a131a1ea39 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -251,7 +251,7 @@ class EncryptionTest extends Storage { * @param int $storedUnencryptedSize * @param array $expected */ - public function testGetMetaData($path, $metaData, $encrypted, $unencryptedSizeSet, $storedUnencryptedSize, $expected) { + public function testGetMetaData($path, $metaData, $encrypted, $unencryptedSizeSet, $storedUnencryptedSize, $expected): void { $sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); @@ -329,7 +329,7 @@ class EncryptionTest extends Storage { ]; } - public function testFilesize() { + public function testFilesize(): void { $cache = $this->getMockBuilder('\OC\Files\Cache\Cache') ->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) @@ -369,7 +369,7 @@ class EncryptionTest extends Storage { * @param bool $failure * @param int $expected */ - public function testVerifyUnencryptedSize($encryptedSize, $unencryptedSize, $failure, $expected) { + public function testVerifyUnencryptedSize($encryptedSize, $unencryptedSize, $failure, $expected): void { $sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); @@ -428,7 +428,7 @@ class EncryptionTest extends Storage { public function testRename($source, $target, $encryptionEnabled, - $renameKeysReturn) { + $renameKeysReturn): void { if ($encryptionEnabled) { $this->keyStore ->expects($this->once()) @@ -448,7 +448,7 @@ class EncryptionTest extends Storage { $this->instance->rename($source, $target); } - public function testCopyEncryption() { + public function testCopyEncryption(): void { $this->instance->file_put_contents('source.txt', 'bar'); $this->instance->copy('source.txt', 'target.txt'); $this->assertSame('bar', $this->instance->file_get_contents('target.txt')); @@ -473,7 +473,7 @@ class EncryptionTest extends Storage { ]; } - public function testIsLocal() { + public function testIsLocal(): void { $this->encryptionManager->expects($this->once()) ->method('isEnabled')->willReturn(true); $this->assertFalse($this->instance->isLocal()); @@ -487,7 +487,7 @@ class EncryptionTest extends Storage { * @param boolean $isExcluded * @param boolean $encryptionEnabled */ - public function testRmdir($path, $rmdirResult, $isExcluded, $encryptionEnabled) { + public function testRmdir($path, $rmdirResult, $isExcluded, $encryptionEnabled): void { $sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); @@ -536,7 +536,7 @@ class EncryptionTest extends Storage { * @param boolean $excluded * @param boolean $expected */ - public function testCopyKeys($excluded, $expected) { + public function testCopyKeys($excluded, $expected): void { $this->util->expects($this->once()) ->method('isExcluded') ->willReturn($excluded); @@ -566,7 +566,7 @@ class EncryptionTest extends Storage { * @param bool $strippedPathExists * @param string $strippedPath */ - public function testGetHeader($path, $strippedPathExists, $strippedPath) { + public function testGetHeader($path, $strippedPathExists, $strippedPath): void { $sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); @@ -647,7 +647,7 @@ class EncryptionTest extends Storage { * * @dataProvider dataTestGetHeaderAddLegacyModule */ - public function testGetHeaderAddLegacyModule($header, $isEncrypted, $exists, $expected) { + public function testGetHeaderAddLegacyModule($header, $isEncrypted, $exists, $expected): void { $sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); @@ -717,7 +717,7 @@ class EncryptionTest extends Storage { ]; } - public function testCopyBetweenStorageMinimumEncryptedVersion() { + public function testCopyBetweenStorageMinimumEncryptedVersion(): void { $storage2 = $this->createMock(\OC\Files\Storage\Storage::class); $sourceInternalPath = $targetInternalPath = 'file.txt'; @@ -766,7 +766,7 @@ class EncryptionTest extends Storage { * @param bool $mountPointEncryptionEnabled * @param bool $expectedEncrypted */ - public function testCopyBetweenStorage($encryptionEnabled, $mountPointEncryptionEnabled, $expectedEncrypted) { + public function testCopyBetweenStorage($encryptionEnabled, $mountPointEncryptionEnabled, $expectedEncrypted): void { $storage2 = $this->createMock(\OC\Files\Storage\Storage::class); $sourceInternalPath = $targetInternalPath = 'file.txt'; @@ -827,7 +827,7 @@ class EncryptionTest extends Storage { * @param bool $copyResult * @param bool $encrypted */ - public function testCopyBetweenStorageVersions($sourceInternalPath, $targetInternalPath, $copyResult, $encrypted) { + public function testCopyBetweenStorageVersions($sourceInternalPath, $targetInternalPath, $copyResult, $encrypted): void { $sourceStorage = $this->createMock(\OC\Files\Storage\Storage::class); $targetStorage = $this->createMock(\OC\Files\Storage\Storage::class); @@ -919,7 +919,7 @@ class EncryptionTest extends Storage { * @param string $path * @param bool $expected */ - public function testIsVersion($path, $expected) { + public function testIsVersion($path, $expected): void { $this->assertSame($expected, $this->invokePrivate($this->instance, 'isVersion', [$path]) ); @@ -949,7 +949,7 @@ class EncryptionTest extends Storage { $encryptionModule, $encryptionModuleShouldEncrypt, $expected - ) { + ): void { $encryptionManager = $this->createMock(\OC\Encryption\Manager::class); $util = $this->createMock(Util::class); $fileHelper = $this->createMock(IFile::class); diff --git a/tests/lib/Files/Storage/Wrapper/JailTest.php b/tests/lib/Files/Storage/Wrapper/JailTest.php index fb2d05d0691..fbc4e1d09ee 100644 --- a/tests/lib/Files/Storage/Wrapper/JailTest.php +++ b/tests/lib/Files/Storage/Wrapper/JailTest.php @@ -37,12 +37,12 @@ class JailTest extends \Test\Files\Storage\Storage { parent::tearDown(); } - public function testMkDirRooted() { + public function testMkDirRooted(): void { $this->instance->mkdir('bar'); $this->assertTrue($this->sourceStorage->is_dir('foo/bar')); } - public function testFilePutContentsRooted() { + public function testFilePutContentsRooted(): void { $this->instance->file_put_contents('bar', 'asd'); $this->assertEquals('asd', $this->sourceStorage->file_get_contents('foo/bar')); } diff --git a/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php index ccc95de1002..bbeb48c5cef 100644 --- a/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php +++ b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php @@ -50,7 +50,7 @@ class KnownMtimeTest extends Storage { ]); } - public function testNewerKnownMtime() { + public function testNewerKnownMtime(): void { $future = time() + 1000; $this->fakeTime = $future; diff --git a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php index 0b2d444700a..5c0a035d094 100644 --- a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php +++ b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php @@ -38,13 +38,13 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { ]); } - public function testMkdirNoCreate() { + public function testMkdirNoCreate(): void { $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE); $this->assertFalse($storage->mkdir('foo')); $this->assertFalse($storage->file_exists('foo')); } - public function testRmdirNoDelete() { + public function testRmdirNoDelete(): void { $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE); $this->assertTrue($storage->mkdir('foo')); $this->assertTrue($storage->file_exists('foo')); @@ -52,25 +52,25 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { $this->assertTrue($storage->file_exists('foo')); } - public function testTouchNewFileNoCreate() { + public function testTouchNewFileNoCreate(): void { $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE); $this->assertFalse($storage->touch('foo')); $this->assertFalse($storage->file_exists('foo')); } - public function testTouchNewFileNoUpdate() { + public function testTouchNewFileNoUpdate(): void { $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE); $this->assertTrue($storage->touch('foo')); $this->assertTrue($storage->file_exists('foo')); } - public function testTouchExistingFileNoUpdate() { + public function testTouchExistingFileNoUpdate(): void { $this->sourceStorage->touch('foo'); $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE); $this->assertFalse($storage->touch('foo')); } - public function testUnlinkNoDelete() { + public function testUnlinkNoDelete(): void { $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE); $this->assertTrue($storage->touch('foo')); $this->assertTrue($storage->file_exists('foo')); @@ -78,35 +78,35 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { $this->assertTrue($storage->file_exists('foo')); } - public function testPutContentsNewFileNoUpdate() { + public function testPutContentsNewFileNoUpdate(): void { $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE); $this->assertEquals(3, $storage->file_put_contents('foo', 'bar')); $this->assertEquals('bar', $storage->file_get_contents('foo')); } - public function testPutContentsNewFileNoCreate() { + public function testPutContentsNewFileNoCreate(): void { $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE); $this->assertFalse($storage->file_put_contents('foo', 'bar')); } - public function testPutContentsExistingFileNoUpdate() { + public function testPutContentsExistingFileNoUpdate(): void { $this->sourceStorage->touch('foo'); $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE); $this->assertFalse($storage->file_put_contents('foo', 'bar')); } - public function testFopenExistingFileNoUpdate() { + public function testFopenExistingFileNoUpdate(): void { $this->sourceStorage->touch('foo'); $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE); $this->assertFalse($storage->fopen('foo', 'w')); } - public function testFopenNewFileNoCreate() { + public function testFopenNewFileNoCreate(): void { $storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE); $this->assertFalse($storage->fopen('foo', 'w')); } - public function testScanNewFiles() { + public function testScanNewFiles(): void { $storage = $this->getMaskedStorage(Constants::PERMISSION_READ + Constants::PERMISSION_CREATE); $storage->file_put_contents('foo', 'bar'); $storage->getScanner()->scan(''); @@ -115,7 +115,7 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { $this->assertEquals(Constants::PERMISSION_READ, $storage->getCache()->get('foo')->getPermissions()); } - public function testScanNewWrappedFiles() { + public function testScanNewWrappedFiles(): void { $storage = $this->getMaskedStorage(Constants::PERMISSION_READ + Constants::PERMISSION_CREATE); $wrappedStorage = new Wrapper(['storage' => $storage]); $wrappedStorage->file_put_contents('foo', 'bar'); @@ -125,7 +125,7 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { $this->assertEquals(Constants::PERMISSION_READ, $storage->getCache()->get('foo')->getPermissions()); } - public function testScanNewFilesNested() { + public function testScanNewFilesNested(): void { $storage = $this->getMaskedStorage(Constants::PERMISSION_READ + Constants::PERMISSION_CREATE + Constants::PERMISSION_UPDATE); $nestedStorage = new \OC\Files\Storage\Wrapper\PermissionsMask([ 'storage' => $storage, @@ -140,7 +140,7 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { $this->assertEquals(Constants::PERMISSION_READ, $wrappedStorage->getCache()->get('foo')->getPermissions()); } - public function testScanUnchanged() { + public function testScanUnchanged(): void { $this->sourceStorage->mkdir('foo'); $this->sourceStorage->file_put_contents('foo/bar.txt', 'bar'); @@ -157,7 +157,7 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { $this->assertFalse($called); } - public function testScanUnchangedWrapped() { + public function testScanUnchangedWrapped(): void { $this->sourceStorage->mkdir('foo'); $this->sourceStorage->file_put_contents('foo/bar.txt', 'bar'); diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php index b24b44c6a56..f07e6021e4e 100644 --- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php +++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php @@ -49,24 +49,24 @@ class QuotaTest extends \Test\Files\Storage\Storage { return new \OC\Files\Storage\Wrapper\Quota(['storage' => $storage, 'quota' => $limit]); } - public function testFilePutContentsNotEnoughSpace() { + public function testFilePutContentsNotEnoughSpace(): void { $instance = $this->getLimitedStorage(3); $this->assertFalse($instance->file_put_contents('files/foo', 'foobar')); } - public function testCopyNotEnoughSpace() { + public function testCopyNotEnoughSpace(): void { $instance = $this->getLimitedStorage(9); $this->assertEquals(6, $instance->file_put_contents('files/foo', 'foobar')); $instance->getScanner()->scan(''); $this->assertFalse($instance->copy('files/foo', 'files/bar')); } - public function testFreeSpace() { + public function testFreeSpace(): void { $instance = $this->getLimitedStorage(9); $this->assertEquals(9, $instance->free_space('')); } - public function testFreeSpaceWithUsedSpace() { + public function testFreeSpaceWithUsedSpace(): void { $instance = $this->getLimitedStorage(9); $instance->getCache()->put( '', ['size' => 3] @@ -74,7 +74,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { $this->assertEquals(6, $instance->free_space('')); } - public function testFreeSpaceWithUnknownDiskSpace() { + public function testFreeSpaceWithUnknownDiskSpace(): void { $storage = $this->getMockBuilder(Local::class) ->setMethods(['free_space']) ->setConstructorArgs([['datadir' => $this->tmpDir]]) @@ -91,7 +91,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { $this->assertEquals(6, $instance->free_space('')); } - public function testFreeSpaceWithUsedSpaceAndEncryption() { + public function testFreeSpaceWithUsedSpaceAndEncryption(): void { $instance = $this->getLimitedStorage(9); $instance->getCache()->put( '', ['size' => 7] @@ -99,7 +99,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { $this->assertEquals(2, $instance->free_space('')); } - public function testFWriteNotEnoughSpace() { + public function testFWriteNotEnoughSpace(): void { $instance = $this->getLimitedStorage(9); $stream = $instance->fopen('files/foo', 'w+'); $this->assertEquals(6, fwrite($stream, 'foobar')); @@ -108,7 +108,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { $this->assertEquals('foobarqwe', $instance->file_get_contents('files/foo')); } - public function testStreamCopyWithEnoughSpace() { + public function testStreamCopyWithEnoughSpace(): void { $instance = $this->getLimitedStorage(16); $inputStream = fopen('data://text/plain,foobarqwerty', 'r'); $outputStream = $instance->fopen('files/foo', 'w+'); @@ -119,7 +119,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { fclose($outputStream); } - public function testStreamCopyNotEnoughSpace() { + public function testStreamCopyNotEnoughSpace(): void { $instance = $this->getLimitedStorage(9); $inputStream = fopen('data://text/plain,foobarqwerty', 'r'); $outputStream = $instance->fopen('files/foo', 'w+'); @@ -130,7 +130,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { fclose($outputStream); } - public function testReturnFalseWhenFopenFailed() { + public function testReturnFalseWhenFopenFailed(): void { $failStorage = $this->getMockBuilder(Local::class) ->setMethods(['fopen']) ->setConstructorArgs([['datadir' => $this->tmpDir]]) @@ -144,7 +144,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { $this->assertFalse($instance->fopen('failedfopen', 'r')); } - public function testReturnRegularStreamOnRead() { + public function testReturnRegularStreamOnRead(): void { $instance = $this->getLimitedStorage(9); // create test file first @@ -163,7 +163,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { fclose($stream); } - public function testReturnRegularStreamWhenOutsideFiles() { + public function testReturnRegularStreamWhenOutsideFiles(): void { $instance = $this->getLimitedStorage(9); $instance->mkdir('files_other'); @@ -174,7 +174,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { fclose($stream); } - public function testReturnQuotaStreamOnWrite() { + public function testReturnQuotaStreamOnWrite(): void { $instance = $this->getLimitedStorage(9); $stream = $instance->fopen('files/foo', 'w+'); $meta = stream_get_meta_data($stream); @@ -183,7 +183,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { fclose($stream); } - public function testSpaceRoot() { + public function testSpaceRoot(): void { $storage = $this->getMockBuilder(Local::class)->disableOriginalConstructor()->getMock(); $cache = $this->getMockBuilder('\OC\Files\Cache\Cache')->disableOriginalConstructor()->getMock(); $storage->expects($this->once()) @@ -202,19 +202,19 @@ class QuotaTest extends \Test\Files\Storage\Storage { $this->assertEquals(1024 - 50, $instance->free_space('')); } - public function testInstanceOfStorageWrapper() { + public function testInstanceOfStorageWrapper(): void { $this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Local')); $this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Wrapper\Wrapper')); $this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Wrapper\Quota')); } - public function testNoMkdirQuotaZero() { + public function testNoMkdirQuotaZero(): void { $instance = $this->getLimitedStorage(0.0); $this->assertFalse($instance->mkdir('files')); $this->assertFalse($instance->mkdir('files/foobar')); } - public function testMkdirQuotaZeroTrashbin() { + public function testMkdirQuotaZeroTrashbin(): void { $instance = $this->getLimitedStorage(0.0); $this->assertTrue($instance->mkdir('files_trashbin')); $this->assertTrue($instance->mkdir('files_trashbin/files')); @@ -222,7 +222,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { $this->assertTrue($instance->mkdir('cache')); } - public function testNoTouchQuotaZero() { + public function testNoTouchQuotaZero(): void { $instance = $this->getLimitedStorage(0.0); $this->assertFalse($instance->touch('foobar')); } diff --git a/tests/lib/Files/Storage/Wrapper/WrapperTest.php b/tests/lib/Files/Storage/Wrapper/WrapperTest.php index 0244c78da8b..1d0f41bf3ed 100644 --- a/tests/lib/Files/Storage/Wrapper/WrapperTest.php +++ b/tests/lib/Files/Storage/Wrapper/WrapperTest.php @@ -26,7 +26,7 @@ class WrapperTest extends \Test\Files\Storage\Storage { parent::tearDown(); } - public function testInstanceOfStorageWrapper() { + public function testInstanceOfStorageWrapper(): void { $this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Local')); $this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Wrapper\Wrapper')); } -- cgit v1.2.3