aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Files
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2020-04-11 08:21:35 +0200
committerGitHub <noreply@github.com>2020-04-11 08:21:35 +0200
commitb5a30d5cd6b53831c0d6d2fd074dc0000fa811de (patch)
tree386f3cb5df4630a1e87dae706667772e590596b8 /tests/lib/Files
parent97de425a171adf9194dae75eede74cf9f3356cc8 (diff)
parenteea282ccc0d9dfae2d321efddce99cdb18158338 (diff)
downloadnextcloud-server-b5a30d5cd6b53831c0d6d2fd074dc0000fa811de.tar.gz
nextcloud-server-b5a30d5cd6b53831c0d6d2fd074dc0000fa811de.zip
Merge pull request #20426 from nextcloud/techdebt/psr2
It is done
Diffstat (limited to 'tests/lib/Files')
-rw-r--r--tests/lib/Files/Cache/CacheTest.php24
-rw-r--r--tests/lib/Files/Cache/ScannerTest.php14
-rw-r--r--tests/lib/Files/Cache/WatcherTest.php2
-rw-r--r--tests/lib/Files/Cache/Wrapper/CacheJailTest.php14
-rw-r--r--tests/lib/Files/FilesystemTest.php4
-rw-r--r--tests/lib/Files/Node/NodeTest.php8
-rw-r--r--tests/lib/Files/ObjectStore/NoopScannerTest.php6
-rw-r--r--tests/lib/Files/ObjectStore/S3Test.php2
-rw-r--r--tests/lib/Files/Storage/HomeStorageQuotaTest.php4
-rw-r--r--tests/lib/Files/Storage/Storage.php2
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncodingTest.php4
-rw-r--r--tests/lib/Files/Stream/EncryptionTest.php2
12 files changed, 43 insertions, 43 deletions
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php
index f3e61e8e820..97663c16c02 100644
--- a/tests/lib/Files/Cache/CacheTest.php
+++ b/tests/lib/Files/Cache/CacheTest.php
@@ -265,7 +265,7 @@ class CacheTest extends \Test\TestCase {
$this->assertFalse($this->cache->inCache($dir2));
}
- function testStatus() {
+ public function testStatus() {
$this->assertEquals(\OC\Files\Cache\Cache::NOT_FOUND, $this->cache->getStatus('foo'));
$this->cache->put('foo', ['size' => -1]);
$this->assertEquals(\OC\Files\Cache\Cache::PARTIAL, $this->cache->getStatus('foo'));
@@ -296,7 +296,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals($fileName, $cacheEntry['path']);
}
- function testSearch() {
+ public function testSearch() {
$file1 = 'folder';
$file2 = 'folder/foobar';
$file3 = 'folder/foo';
@@ -325,7 +325,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals(2, count($this->cache->searchByMime('foo/file')));
}
- function testSearchQueryByTag() {
+ public function testSearchQueryByTag() {
$userId = static::getUniqueID('user');
\OC::$server->getUserManager()->createUser($userId, $userId);
static::loginAsUser($userId);
@@ -380,7 +380,7 @@ class CacheTest extends \Test\TestCase {
}
}
- function testSearchByQuery() {
+ public function testSearchByQuery() {
$file1 = 'folder';
$file2 = 'folder/foobar';
$file3 = 'folder/foo';
@@ -415,7 +415,7 @@ class CacheTest extends \Test\TestCase {
, 10, 0, [], $user)));
}
- function movePathProvider() {
+ public function movePathProvider() {
return [
['folder/foo', 'folder/foobar', ['1', '2']],
['folder/foo', 'foo', ['1', '2']],
@@ -426,7 +426,7 @@ class CacheTest extends \Test\TestCase {
/**
* @dataProvider movePathProvider
*/
- function testMove($sourceFolder, $targetFolder, $children) {
+ public function testMove($sourceFolder, $targetFolder, $children) {
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/bar'];
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
@@ -461,7 +461,7 @@ class CacheTest extends \Test\TestCase {
}
}
- function testGetIncomplete() {
+ public function testGetIncomplete() {
$file1 = 'folder1';
$file2 = 'folder2';
$file3 = 'folder3';
@@ -478,13 +478,13 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals($file3, $this->cache->getIncomplete());
}
- function testNonExisting() {
+ public function testNonExisting() {
$this->assertFalse($this->cache->get('foo.txt'));
$this->assertFalse($this->cache->get(-1));
$this->assertEquals([], $this->cache->getFolderContents('foo'));
}
- function testGetById() {
+ public function testGetById() {
$storageId = $this->storage->getId();
$data = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'];
$id = $this->cache->put('foo', $data);
@@ -495,7 +495,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals([$storageId, 'foo'], \OC\Files\Cache\Cache::getById($id));
}
- function testStorageMTime() {
+ public function testStorageMTime() {
$data = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'];
$this->cache->put('foo', $data);
$cachedData = $this->cache->get('foo');
@@ -512,7 +512,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals(25, $cachedData['mtime']);
}
- function testLongId() {
+ public function testLongId() {
$storage = new LongId([]);
$cache = $storage->getCache();
$storageId = $storage->getId();
@@ -606,7 +606,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals(1, count($this->cache->getFolderContents('folder')));
}
- function bogusPathNamesProvider() {
+ public function bogusPathNamesProvider() {
return [
['/bogus.txt', 'bogus.txt'],
['//bogus.txt', 'bogus.txt'],
diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php
index c51ce0388d5..f9c05d52ee5 100644
--- a/tests/lib/Files/Cache/ScannerTest.php
+++ b/tests/lib/Files/Cache/ScannerTest.php
@@ -49,7 +49,7 @@ class ScannerTest extends \Test\TestCase {
parent::tearDown();
}
- function testFile() {
+ public function testFile() {
$data = "dummy file data\n";
$this->storage->file_put_contents('foo.txt', $data);
$this->scanner->scanFile('foo.txt');
@@ -70,7 +70,7 @@ class ScannerTest extends \Test\TestCase {
$this->assertEquals($cachedData['mimetype'], 'image/png');
}
- function testFile4Byte() {
+ public function testFile4Byte() {
$data = "dummy file data\n";
$this->storage->file_put_contents('foo🙈.txt', $data);
@@ -88,7 +88,7 @@ class ScannerTest extends \Test\TestCase {
}
}
- function testFileInvalidChars() {
+ public function testFileInvalidChars() {
$data = "dummy file data\n";
$this->storage->file_put_contents("foo\nbar.txt", $data);
@@ -105,7 +105,7 @@ class ScannerTest extends \Test\TestCase {
$this->storage->file_put_contents('folder/bar.txt', $textData);
}
- function testFolder() {
+ public function testFolder() {
$this->fillTestFolders();
$this->scanner->scan('');
@@ -127,7 +127,7 @@ class ScannerTest extends \Test\TestCase {
$this->assertEquals($cachedDataFolder2['size'], $cachedDataText2['size']);
}
- function testShallow() {
+ public function testShallow() {
$this->fillTestFolders();
$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW);
@@ -155,7 +155,7 @@ class ScannerTest extends \Test\TestCase {
$this->assertNotEquals($cachedDataFolder['size'], -1);
}
- function testBackgroundScan() {
+ public function testBackgroundScan() {
$this->fillTestFolders();
$this->storage->mkdir('folder2');
$this->storage->file_put_contents('folder2/bar.txt', 'foobar');
@@ -177,7 +177,7 @@ class ScannerTest extends \Test\TestCase {
$this->assertFalse($this->cache->getIncomplete());
}
- function testBackgroundScanOnlyRecurseIncomplete() {
+ public function testBackgroundScanOnlyRecurseIncomplete() {
$this->fillTestFolders();
$this->storage->mkdir('folder2');
$this->storage->file_put_contents('folder2/bar.txt', 'foobar');
diff --git a/tests/lib/Files/Cache/WatcherTest.php b/tests/lib/Files/Cache/WatcherTest.php
index 2a42a9e603f..42115c1c477 100644
--- a/tests/lib/Files/Cache/WatcherTest.php
+++ b/tests/lib/Files/Cache/WatcherTest.php
@@ -42,7 +42,7 @@ class WatcherTest extends \Test\TestCase {
/**
* @medium
*/
- function testWatcher() {
+ public function testWatcher() {
$storage = $this->getTestStorage();
$cache = $storage->getCache();
$updater = $storage->getWatcher();
diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
index 5d7e9f8ec08..f0943ba5a03 100644
--- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
+++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
@@ -31,7 +31,7 @@ class CacheJailTest extends CacheTest {
$this->cache = new \OC\Files\Cache\Wrapper\CacheJail($this->sourceCache, 'foo');
}
- function testSearchOutsideJail() {
+ public function testSearchOutsideJail() {
$file1 = 'foo/foobar';
$file2 = 'folder/foobar';
$data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'];
@@ -46,7 +46,7 @@ class CacheJailTest extends CacheTest {
$this->assertEquals('foobar', $result[0]['path']);
}
- function testClearKeepEntriesOutsideJail() {
+ public function testClearKeepEntriesOutsideJail() {
$file1 = 'foo/foobar';
$file2 = 'foo/foobar/asd';
$file3 = 'folder/foobar';
@@ -63,7 +63,7 @@ class CacheJailTest extends CacheTest {
$this->assertTrue($this->sourceCache->inCache('folder/foobar'));
}
- function testGetById() {
+ public function testGetById() {
$data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
$id = $this->sourceCache->put('foo/bar', $data1);
@@ -77,12 +77,12 @@ class CacheJailTest extends CacheTest {
$this->assertEquals('foo/bar', $path);
}
- function testGetIncomplete() {
+ public function testGetIncomplete() {
//not supported
$this->addToAssertionCount(1);
}
- function testMoveFromJail() {
+ public function testMoveFromJail() {
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
$this->sourceCache->put('source', $folderData);
@@ -98,7 +98,7 @@ class CacheJailTest extends CacheTest {
$this->assertTrue($this->sourceCache->inCache('target/foo/bar'));
}
- function testMoveToJail() {
+ public function testMoveToJail() {
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
$this->sourceCache->put('source', $folderData);
@@ -114,7 +114,7 @@ class CacheJailTest extends CacheTest {
$this->assertTrue($this->sourceCache->inCache('target/foo/bar'));
}
- function testMoveBetweenJail() {
+ public function testMoveBetweenJail() {
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
$this->sourceCache->put('source', $folderData);
diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php
index 9fc3032fa28..d9e6de898f0 100644
--- a/tests/lib/Files/FilesystemTest.php
+++ b/tests/lib/Files/FilesystemTest.php
@@ -59,8 +59,8 @@ class DummyMountProvider implements IMountProvider {
* @package Test\Files
*/
class FilesystemTest extends \Test\TestCase {
- const TEST_FILESYSTEM_USER1 = "test-filesystem-user1";
- const TEST_FILESYSTEM_USER2 = "test-filesystem-user1";
+ public const TEST_FILESYSTEM_USER1 = "test-filesystem-user1";
+ public const TEST_FILESYSTEM_USER2 = "test-filesystem-user1";
/**
* @var array tmpDirs
diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php
index adcf43956be..86643617959 100644
--- a/tests/lib/Files/Node/NodeTest.php
+++ b/tests/lib/Files/Node/NodeTest.php
@@ -66,22 +66,22 @@ abstract class NodeTest extends \Test\TestCase {
* @param string $path
* @return Node
*/
- protected abstract function createTestNode($root, $view, $path);
+ abstract protected function createTestNode($root, $view, $path);
/**
* @return string
*/
- protected abstract function getNodeClass();
+ abstract protected function getNodeClass();
/**
* @return string
*/
- protected abstract function getNonExistingNodeClass();
+ abstract protected function getNonExistingNodeClass();
/**
* @return string
*/
- protected abstract function getViewDeleteMethod();
+ abstract protected function getViewDeleteMethod();
protected function getMockStorage() {
$storage = $this->getMockBuilder(Storage::class)
diff --git a/tests/lib/Files/ObjectStore/NoopScannerTest.php b/tests/lib/Files/ObjectStore/NoopScannerTest.php
index 570fc16ee98..7142fb6daf9 100644
--- a/tests/lib/Files/ObjectStore/NoopScannerTest.php
+++ b/tests/lib/Files/ObjectStore/NoopScannerTest.php
@@ -26,7 +26,7 @@ class NoopScannerTest extends \Test\TestCase {
$this->scanner = new \OC\Files\ObjectStore\NoopScanner($this->storage);
}
- function testFile() {
+ public function testFile() {
$data = "dummy file data\n";
$this->storage->file_put_contents('foo.txt', $data);
@@ -46,7 +46,7 @@ class NoopScannerTest extends \Test\TestCase {
$this->storage->file_put_contents('folder/bar.txt', $textData);
}
- function testFolder() {
+ public function testFolder() {
$this->fillTestFolders();
$this->assertEquals(
@@ -56,7 +56,7 @@ class NoopScannerTest extends \Test\TestCase {
);
}
- function testBackgroundScan() {
+ public function testBackgroundScan() {
$this->fillTestFolders();
$this->storage->mkdir('folder2');
$this->storage->file_put_contents('folder2/bar.txt', 'foobar');
diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php
index 525e020445a..c1e7948e3c4 100644
--- a/tests/lib/Files/ObjectStore/S3Test.php
+++ b/tests/lib/Files/ObjectStore/S3Test.php
@@ -25,7 +25,7 @@ use Icewind\Streams\Wrapper;
use OC\Files\ObjectStore\S3;
class MultiPartUploadS3 extends S3 {
- function writeObject($urn, $stream) {
+ public function writeObject($urn, $stream) {
$this->getConnection()->upload($this->bucket, $urn, $stream, 'private', [
'mup_threshold' => 1,
]);
diff --git a/tests/lib/Files/Storage/HomeStorageQuotaTest.php b/tests/lib/Files/Storage/HomeStorageQuotaTest.php
index cfee638d5f3..177fe1b4f6c 100644
--- a/tests/lib/Files/Storage/HomeStorageQuotaTest.php
+++ b/tests/lib/Files/Storage/HomeStorageQuotaTest.php
@@ -30,7 +30,7 @@ class HomeStorageQuotaTest extends \Test\TestCase {
/**
* Tests that the home storage is not wrapped when no quota exists.
*/
- function testHomeStorageWrapperWithoutQuota() {
+ public function testHomeStorageWrapperWithoutQuota() {
$user1 = $this->getUniqueID();
\OC::$server->getUserManager()->createUser($user1, 'test');
\OC::$server->getConfig()->setUserValue($user1, 'files', 'quota', 'none');
@@ -55,7 +55,7 @@ class HomeStorageQuotaTest extends \Test\TestCase {
/**
* Tests that the home storage is not wrapped when no quota exists.
*/
- function testHomeStorageWrapperWithQuota() {
+ public function testHomeStorageWrapperWithQuota() {
$user1 = $this->getUniqueID();
\OC::$server->getUserManager()->createUser($user1, 'test');
\OC::$server->getConfig()->setUserValue($user1, 'files', 'quota', '1024');
diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php
index 736cbfff4f0..c37a8152989 100644
--- a/tests/lib/Files/Storage/Storage.php
+++ b/tests/lib/Files/Storage/Storage.php
@@ -128,7 +128,7 @@ abstract class Storage extends \Test\TestCase {
];
}
- function loremFileProvider() {
+ public function loremFileProvider() {
$root = \OC::$SERVERROOT . '/tests/data/';
return [
// small file
diff --git a/tests/lib/Files/Storage/Wrapper/EncodingTest.php b/tests/lib/Files/Storage/Wrapper/EncodingTest.php
index 1f199239a8e..498d9f78248 100644
--- a/tests/lib/Files/Storage/Wrapper/EncodingTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncodingTest.php
@@ -9,8 +9,8 @@
namespace Test\Files\Storage\Wrapper;
class EncodingTest extends \Test\Files\Storage\Storage {
- const NFD_NAME = 'ümlaut';
- const NFC_NAME = 'ümlaut';
+ public const NFD_NAME = 'ümlaut';
+ public const NFC_NAME = 'ümlaut';
/**
* @var \OC\Files\Storage\Temporary
diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php
index e1ad3ec68fa..bedce1b6f6d 100644
--- a/tests/lib/Files/Stream/EncryptionTest.php
+++ b/tests/lib/Files/Stream/EncryptionTest.php
@@ -240,7 +240,7 @@ class EncryptionTest extends \Test\TestCase {
unlink($fileName);
}
- function dataFilesProvider() {
+ public function dataFilesProvider() {
return [
['lorem-big.txt'],
['block-aligned.txt'],