diff options
Diffstat (limited to 'tests')
34 files changed, 128 insertions, 128 deletions
diff --git a/tests/lib/APITest.php b/tests/lib/APITest.php index ebb03425375..7027d64eceb 100644 --- a/tests/lib/APITest.php +++ b/tests/lib/APITest.php @@ -17,7 +17,7 @@ class APITest extends \Test\TestCase { /** * @param string $message */ - function buildResponse($shipped, $data, $code, $message=null) { + public function buildResponse($shipped, $data, $code, $message=null) { $resp = new \OC\OCS\Result($data, $code, $message); $resp->addHeader('KEY', 'VALUE'); return [ @@ -32,7 +32,7 @@ class APITest extends \Test\TestCase { /** * @param \OC\OCS\Result $result */ - function checkResult($result, $success) { + public function checkResult($result, $success) { // Check response is of correct type $this->assertInstanceOf(\OC\OCS\Result::class, $result); // Check if it succeeded diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php index 40cd308f886..09a939f4855 100644 --- a/tests/lib/App/DependencyAnalyzerTest.php +++ b/tests/lib/App/DependencyAnalyzerTest.php @@ -144,7 +144,7 @@ class DependencyAnalyzerTest extends TestCase { * @param $expectedMissing * @param $libs */ - function testLibs($expectedMissing, $libs) { + public function testLibs($expectedMissing, $libs) { $app = [ 'dependencies' => [ ] @@ -164,7 +164,7 @@ class DependencyAnalyzerTest extends TestCase { * @param $expectedMissing * @param $oss */ - function testOS($expectedMissing, $oss) { + public function testOS($expectedMissing, $oss) { $app = [ 'dependencies' => [] ]; @@ -183,7 +183,7 @@ class DependencyAnalyzerTest extends TestCase { * @param $expectedMissing * @param $oc */ - function testOC($expectedMissing, $oc) { + public function testOC($expectedMissing, $oc) { $app = [ 'dependencies' => [] ]; @@ -200,7 +200,7 @@ class DependencyAnalyzerTest extends TestCase { /** * @return array */ - function providesOC() { + public function providesOC() { return [ // no version -> no missing dependency [ @@ -428,7 +428,7 @@ class DependencyAnalyzerTest extends TestCase { /** * @return array */ - function providesOS() { + public function providesOS() { return [ [[], null], [[], []], @@ -440,7 +440,7 @@ class DependencyAnalyzerTest extends TestCase { /** * @return array */ - function providesLibs() { + public function providesLibs() { return [ // we expect curl to exist [[], 'curl'], @@ -470,7 +470,7 @@ class DependencyAnalyzerTest extends TestCase { /** * @return array */ - function providesCommands() { + public function providesCommands() { return [ [[], null], // grep is known on linux @@ -488,7 +488,7 @@ class DependencyAnalyzerTest extends TestCase { /** * @return array */ - function providesDatabases() { + public function providesDatabases() { return [ // non BC - in case on databases are defined -> all are supported [[], null], @@ -501,7 +501,7 @@ class DependencyAnalyzerTest extends TestCase { /** * @return array */ - function providesPhpVersion() { + public function providesPhpVersion() { return [ [[], null, null, null], [[], '5.4', null, null], diff --git a/tests/lib/AppFramework/Http/RequestStream.php b/tests/lib/AppFramework/Http/RequestStream.php index 1dcfbce46d1..3868ed16505 100644 --- a/tests/lib/AppFramework/Http/RequestStream.php +++ b/tests/lib/AppFramework/Http/RequestStream.php @@ -10,7 +10,7 @@ class RequestStream { protected $position; protected $varname; - function stream_open($path, $mode, $options, &$opened_path) { + public function stream_open($path, $mode, $options, &$opened_path) { $url = parse_url($path); $this->varname = $url["host"]; $this->position = 0; @@ -18,13 +18,13 @@ class RequestStream { return true; } - function stream_read($count) { + public function stream_read($count) { $ret = substr($GLOBALS[$this->varname], $this->position, $count); $this->position += strlen($ret); return $ret; } - function stream_write($data) { + public function stream_write($data) { $left = substr($GLOBALS[$this->varname], 0, $this->position); $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); $GLOBALS[$this->varname] = $left . $data . $right; @@ -32,15 +32,15 @@ class RequestStream { return strlen($data); } - function stream_tell() { + public function stream_tell() { return $this->position; } - function stream_eof() { + public function stream_eof() { return $this->position >= strlen($GLOBALS[$this->varname]); } - function stream_seek($offset, $whence) { + public function stream_seek($offset, $whence) { switch ($whence) { case SEEK_SET: if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { @@ -96,7 +96,7 @@ class RequestStream { //return false; } - function stream_metadata($path, $option, $var) { + public function stream_metadata($path, $option, $var) { if ($option == STREAM_META_TOUCH) { $url = parse_url($path); $varname = $url["host"]; diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index 2004bd2e6b5..a8e2f2248c6 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -902,7 +902,7 @@ class RequestTest extends \Test\TestCase { /** * @return array */ - function userAgentProvider() { + public function userAgentProvider() { return [ [ 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)', diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php index 3978326d130..e6f88b6a6e9 100644 --- a/tests/lib/AppFramework/Http/ResponseTest.php +++ b/tests/lib/AppFramework/Http/ResponseTest.php @@ -118,7 +118,7 @@ class ResponseTest extends \Test\TestCase { } - function testSetCookies() { + public function testSetCookies() { $expected = [ 'foo' => [ 'value' => 'bar', @@ -137,7 +137,7 @@ class ResponseTest extends \Test\TestCase { } - function testInvalidateCookie() { + public function testInvalidateCookie() { $this->childResponse->addCookie('foo', 'bar'); $this->childResponse->invalidateCookie('foo'); $expected = [ @@ -153,7 +153,7 @@ class ResponseTest extends \Test\TestCase { } - function testInvalidateCookies() { + public function testInvalidateCookies() { $this->childResponse->addCookie('foo', 'bar'); $this->childResponse->addCookie('bar', 'foo'); $expected = [ diff --git a/tests/lib/Cache/CappedMemoryCacheTest.php b/tests/lib/Cache/CappedMemoryCacheTest.php index 00231004fe5..db0d2bd1193 100644 --- a/tests/lib/Cache/CappedMemoryCacheTest.php +++ b/tests/lib/Cache/CappedMemoryCacheTest.php @@ -49,7 +49,7 @@ class CappedMemoryCacheTest extends TestCache { $this->assertTrue($instance->hasKey('5')); } - function testClear() { + public function testClear() { $value = 'ipsum lorum'; $this->instance->set('1_value1', $value); $this->instance->set('1_value2', $value); @@ -63,7 +63,7 @@ class CappedMemoryCacheTest extends TestCache { $this->assertFalse($this->instance->hasKey('3_value1')); } - function testIndirectSet() { + public function testIndirectSet() { $this->instance->set('array', []); $this->instance['array'][] = 'foo'; diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php index 96c35ebf786..1a28724ae12 100644 --- a/tests/lib/Cache/FileCacheTest.php +++ b/tests/lib/Cache/FileCacheTest.php @@ -49,7 +49,7 @@ class FileCacheTest extends TestCache { * */ private $rootView; - function skip() { + public function skip() { //$this->skipUnless(OC_User::isLoggedIn()); } diff --git a/tests/lib/Cache/TestCache.php b/tests/lib/Cache/TestCache.php index b7aa01f350f..9dfc46eb5a0 100644 --- a/tests/lib/Cache/TestCache.php +++ b/tests/lib/Cache/TestCache.php @@ -22,7 +22,7 @@ abstract class TestCache extends \Test\TestCase { parent::tearDown(); } - function testSimple() { + public function testSimple() { $this->assertNull($this->instance->get('value1')); $this->assertFalse($this->instance->hasKey('value1')); @@ -51,7 +51,7 @@ abstract class TestCache extends \Test\TestCase { $this->assertFalse($this->instance->hasKey('value1')); } - function testClear() { + public function testClear() { $value='ipsum lorum'; $this->instance->set('1_value1', $value . '1'); $this->instance->set('1_value2', $value . '2'); diff --git a/tests/lib/Command/AsyncBusTest.php b/tests/lib/Command/AsyncBusTest.php index 31f28bb88c9..bfe201ed369 100644 --- a/tests/lib/Command/AsyncBusTest.php +++ b/tests/lib/Command/AsyncBusTest.php @@ -23,7 +23,7 @@ class SimpleCommand implements ICommand { class StateFullCommand implements ICommand { private $state; - function __construct($state) { + public function __construct($state) { $this->state = $state; } diff --git a/tests/lib/DateTimeFormatterTest.php b/tests/lib/DateTimeFormatterTest.php index 42870bf6281..2beb89654f6 100644 --- a/tests/lib/DateTimeFormatterTest.php +++ b/tests/lib/DateTimeFormatterTest.php @@ -176,7 +176,7 @@ class DateTimeFormatterTest extends TestCase { } - function testFormatDateWithInvalidTZ() { + public function testFormatDateWithInvalidTZ() { $this->expectException(\Exception::class); $this->formatter->formatDate(1350129205, 'long', new \DateTimeZone('Mordor/Barad-dûr')); diff --git a/tests/lib/ErrorHandlerTest.php b/tests/lib/ErrorHandlerTest.php index 32112c19787..702f64bfb99 100644 --- a/tests/lib/ErrorHandlerTest.php +++ b/tests/lib/ErrorHandlerTest.php @@ -28,7 +28,7 @@ class ErrorHandlerTest extends \Test\TestCase { * provide username, password combinations for testRemovePassword * @return array */ - function passwordProvider() { + public function passwordProvider() { return [ ['user', 'password'], ['user@owncloud.org', 'password'], @@ -43,7 +43,7 @@ class ErrorHandlerTest extends \Test\TestCase { * @param string $username * @param string $password */ - function testRemovePassword($username, $password) { + public function testRemovePassword($username, $password) { $url = 'http://'.$username.':'.$password.'@owncloud.org'; $expectedResult = 'http://xxx:xxx@owncloud.org'; $result = TestableErrorHandler::testRemovePassword($url); 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/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/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'], diff --git a/tests/lib/HelperStorageTest.php b/tests/lib/HelperStorageTest.php index 3169957fabb..4166d606366 100644 --- a/tests/lib/HelperStorageTest.php +++ b/tests/lib/HelperStorageTest.php @@ -81,7 +81,7 @@ class HelperStorageTest extends \Test\TestCase { /** * Test getting the storage info */ - function testGetStorageInfo() { + public function testGetStorageInfo() { $homeStorage = $this->getStorageMock(12); \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); @@ -95,7 +95,7 @@ class HelperStorageTest extends \Test\TestCase { /** * Test getting the storage info, ignoring extra mount points */ - function testGetStorageInfoExcludingExtStorage() { + public function testGetStorageInfoExcludingExtStorage() { $homeStorage = $this->getStorageMock(12); \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); @@ -115,7 +115,7 @@ class HelperStorageTest extends \Test\TestCase { /** * Test getting the storage info, including extra mount points */ - function testGetStorageInfoIncludingExtStorage() { + public function testGetStorageInfoIncludingExtStorage() { $homeStorage = new \OC\Files\Storage\Temporary([]); \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); @@ -146,7 +146,7 @@ class HelperStorageTest extends \Test\TestCase { * when user has no quota set, even when quota ext storage option * was set */ - function testGetStorageInfoIncludingExtStorageWithNoUserQuota() { + public function testGetStorageInfoIncludingExtStorageWithNoUserQuota() { $homeStorage = $this->getStorageMock(12); \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); @@ -173,7 +173,7 @@ class HelperStorageTest extends \Test\TestCase { /** * Test getting the storage info with quota enabled */ - function testGetStorageInfoWithQuota() { + public function testGetStorageInfoWithQuota() { $homeStorage = $this->getStorageMock(12); $homeStorage->file_put_contents('test.txt', '01234'); $homeStorage = new \OC\Files\Storage\Wrapper\Quota( @@ -193,7 +193,7 @@ class HelperStorageTest extends \Test\TestCase { /** * Test getting the storage info when data exceeds quota */ - function testGetStorageInfoWhenSizeExceedsQuota() { + public function testGetStorageInfoWhenSizeExceedsQuota() { $homeStorage = $this->getStorageMock(12); $homeStorage->file_put_contents('test.txt', '0123456789'); $homeStorage = new \OC\Files\Storage\Wrapper\Quota( @@ -215,7 +215,7 @@ class HelperStorageTest extends \Test\TestCase { * Test getting the storage info when the remaining * free storage space is less than the quota */ - function testGetStorageInfoWhenFreeSpaceLessThanQuota() { + public function testGetStorageInfoWhenFreeSpaceLessThanQuota() { $homeStorage = $this->getStorageMock(12); $homeStorage->file_put_contents('test.txt', '01234'); $homeStorage = new \OC\Files\Storage\Wrapper\Quota( diff --git a/tests/lib/ImageTest.php b/tests/lib/ImageTest.php index 3858945d191..5b83c4ac57f 100644 --- a/tests/lib/ImageTest.php +++ b/tests/lib/ImageTest.php @@ -344,7 +344,7 @@ class ImageTest extends \Test\TestCase { $this->assertEquals($expected[1], $img->height()); } - function convertDataProvider() { + public function convertDataProvider() { return [ [ 'image/gif'], [ 'image/jpeg'], diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php index 1940d4f2d01..5c640e91284 100644 --- a/tests/lib/LegacyHelperTest.php +++ b/tests/lib/LegacyHelperTest.php @@ -47,12 +47,12 @@ class LegacyHelperTest extends \Test\TestCase { /** * @dataProvider providesComputerFileSize */ - function testComputerFileSize($expected, $input) { + public function testComputerFileSize($expected, $input) { $result = OC_Helper::computerFileSize($input); $this->assertEquals($expected, $result); } - function providesComputerFileSize() { + public function providesComputerFileSize() { return [ [0.0, "0 B"], [1024.0, "1 KB"], @@ -63,7 +63,7 @@ class LegacyHelperTest extends \Test\TestCase { ]; } - function testMb_array_change_key_case() { + public function testMb_array_change_key_case() { $arrayStart = [ "Foo" => "bar", "Bar" => "foo", @@ -89,7 +89,7 @@ class LegacyHelperTest extends \Test\TestCase { $this->assertEquals($result, $expected); } - function testRecursiveArraySearch() { + public function testRecursiveArraySearch() { $haystack = [ "Foo" => "own", "Bar" => "Cloud", @@ -103,7 +103,7 @@ class LegacyHelperTest extends \Test\TestCase { $this->assertFalse($result); } - function testBuildNotExistingFileNameForView() { + public function testBuildNotExistingFileNameForView() { $viewMock = $this->createMock(View::class); $this->assertEquals('/filename', OC_Helper::buildNotExistingFileNameForView('/', 'filename', $viewMock)); $this->assertEquals('dir/filename.ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock)); @@ -188,7 +188,7 @@ class LegacyHelperTest extends \Test\TestCase { } - function streamCopyDataProvider() { + public function streamCopyDataProvider() { return [ [0, false, false, false], [0, false, \OC::$SERVERROOT . '/tests/data/lorem.txt', false], diff --git a/tests/lib/Memcache/MemcachedTest.php b/tests/lib/Memcache/MemcachedTest.php index 96b88992665..340ce85b9aa 100644 --- a/tests/lib/Memcache/MemcachedTest.php +++ b/tests/lib/Memcache/MemcachedTest.php @@ -10,7 +10,7 @@ namespace Test\Memcache; class MemcachedTest extends Cache { - static public function setUpBeforeClass(): void { + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); if (!\OC\Memcache\Memcached::isAvailable()) { diff --git a/tests/lib/Memcache/RedisTest.php b/tests/lib/Memcache/RedisTest.php index d5bf10e7af9..e7bb9c29d36 100644 --- a/tests/lib/Memcache/RedisTest.php +++ b/tests/lib/Memcache/RedisTest.php @@ -10,7 +10,7 @@ namespace Test\Memcache; class RedisTest extends Cache { - static public function setUpBeforeClass(): void { + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); if (!\OC\Memcache\Redis::isAvailable()) { diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php index 6a93657f8c8..d64c41c79e7 100644 --- a/tests/lib/Security/CertificateManagerTest.php +++ b/tests/lib/Security/CertificateManagerTest.php @@ -76,7 +76,7 @@ class CertificateManagerTest extends \Test\TestCase { $this->assertEquals($expected, $actual); } - function testListCertificates() { + public function testListCertificates() { // Test empty certificate bundle $this->assertSame([], $this->certificateManager->listCertificates()); @@ -93,7 +93,7 @@ class CertificateManagerTest extends \Test\TestCase { } - function testAddInvalidCertificate() { + public function testAddInvalidCertificate() { $this->expectException(\Exception::class); $this->expectExceptionMessage('Certificate could not get parsed.'); @@ -115,23 +115,23 @@ class CertificateManagerTest extends \Test\TestCase { * @dataProvider dangerousFileProvider * @param string $filename */ - function testAddDangerousFile($filename) { + public function testAddDangerousFile($filename) { $this->expectException(\Exception::class); $this->expectExceptionMessage('Filename is not valid'); $this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/expiredCertificate.crt'), $filename); } - function testRemoveDangerousFile() { + public function testRemoveDangerousFile() { $this->assertFalse($this->certificateManager->removeCertificate('../../foo.txt')); } - function testRemoveExistingFile() { + public function testRemoveExistingFile() { $this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt'), 'GoodCertificate'); $this->assertTrue($this->certificateManager->removeCertificate('GoodCertificate')); } - function testGetCertificateBundle() { + public function testGetCertificateBundle() { $this->assertSame('/' . $this->username . '/files_external/rootcerts.crt', $this->certificateManager->getCertificateBundle()); } @@ -145,7 +145,7 @@ class CertificateManagerTest extends \Test\TestCase { * @param int $targetBundleExists * @param bool $expected */ - function testNeedRebundling($uid, + public function testNeedRebundling($uid, $CaBundleMtime, $systemWideMtime, $targetBundleMtime, @@ -194,7 +194,7 @@ class CertificateManagerTest extends \Test\TestCase { ); } - function dataTestNeedRebundling() { + public function dataTestNeedRebundling() { return [ //values: uid, CaBundleMtime, systemWideMtime, targetBundleMtime, targetBundleExists, expected diff --git a/tests/lib/Security/CertificateTest.php b/tests/lib/Security/CertificateTest.php index 986554cf967..223fb226904 100644 --- a/tests/lib/Security/CertificateTest.php +++ b/tests/lib/Security/CertificateTest.php @@ -53,7 +53,7 @@ class CertificateTest extends \Test\TestCase { } - function testCertificateStartingWithFileReference() { + public function testCertificateStartingWithFileReference() { $this->expectException(\Exception::class); $this->expectExceptionMessage('Certificate could not get parsed.'); diff --git a/tests/lib/Security/CryptoTest.php b/tests/lib/Security/CryptoTest.php index 2a2e6adac3e..a6f4902594a 100644 --- a/tests/lib/Security/CryptoTest.php +++ b/tests/lib/Security/CryptoTest.php @@ -30,13 +30,13 @@ class CryptoTest extends \Test\TestCase { /** * @dataProvider defaultEncryptionProvider */ - function testDefaultEncrypt($stringToEncrypt) { + public function testDefaultEncrypt($stringToEncrypt) { $ciphertext = $this->crypto->encrypt($stringToEncrypt); $this->assertEquals($stringToEncrypt, $this->crypto->decrypt($ciphertext)); } - function testWrongPassword() { + public function testWrongPassword() { $this->expectException(\Exception::class); $this->expectExceptionMessage('HMAC does not match.'); @@ -45,14 +45,14 @@ class CryptoTest extends \Test\TestCase { $this->crypto->decrypt($ciphertext, 'A wrong password!'); } - function testLaterDecryption() { + public function testLaterDecryption() { $stringToEncrypt = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'; $encryptedString = '44a35023cca2e7a6125e06c29fc4b2ad9d8a33d0873a8b45b0de4ef9284f260c6c46bf25dc62120644c59b8bafe4281ddc47a70c35ae6c29ef7a63d79eefacc297e60b13042ac582733598d0a6b4de37311556bb5c480fd2633de4e6ebafa868c2d1e2d80a5d24f9660360dba4d6e0c8|lhrFgK0zd9U160Wo|a75e57ab701f9124e1113543fd1dc596f21e20d456a0d1e813d5a8aaec9adcb11213788e96598b67fe9486a9f0b99642c18296d0175db44b1ae426e4e91080ee'; $this->assertEquals($stringToEncrypt, $this->crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd')); } - function testWrongIV() { + public function testWrongIV() { $this->expectException(\Exception::class); $this->expectExceptionMessage('HMAC does not match.'); @@ -61,7 +61,7 @@ class CryptoTest extends \Test\TestCase { } - function testWrongParameters() { + public function testWrongParameters() { $this->expectException(\Exception::class); $this->expectExceptionMessage('Authenticated ciphertext could not be decoded.'); diff --git a/tests/lib/Security/SecureRandomTest.php b/tests/lib/Security/SecureRandomTest.php index 4075a1c7109..0ffd7ae7c14 100644 --- a/tests/lib/Security/SecureRandomTest.php +++ b/tests/lib/Security/SecureRandomTest.php @@ -42,7 +42,7 @@ class SecureRandomTest extends \Test\TestCase { /** * @dataProvider stringGenerationProvider */ - function testGetLowStrengthGeneratorLength($length, $expectedLength) { + public function testGetLowStrengthGeneratorLength($length, $expectedLength) { $generator = $this->rng; $this->assertEquals($expectedLength, strlen($generator->generate($length))); @@ -51,7 +51,7 @@ class SecureRandomTest extends \Test\TestCase { /** * @dataProvider stringGenerationProvider */ - function testMediumLowStrengthGeneratorLength($length, $expectedLength) { + public function testMediumLowStrengthGeneratorLength($length, $expectedLength) { $generator = $this->rng; $this->assertEquals($expectedLength, strlen($generator->generate($length))); @@ -60,7 +60,7 @@ class SecureRandomTest extends \Test\TestCase { /** * @dataProvider stringGenerationProvider */ - function testUninitializedGenerate($length, $expectedLength) { + public function testUninitializedGenerate($length, $expectedLength) { $this->assertEquals($expectedLength, strlen($this->rng->generate($length))); } diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php index d7adc144cf4..fce963ec43a 100644 --- a/tests/lib/Share/ShareTest.php +++ b/tests/lib/Share/ShareTest.php @@ -226,13 +226,13 @@ class ShareTest extends \Test\TestCase { * @param string $url * @param string $expectedResult */ - function testRemoveProtocolFromUrl($url, $expectedResult) { + public function testRemoveProtocolFromUrl($url, $expectedResult) { $share = new \OC\Share\Share(); $result = self::invokePrivate($share, 'removeProtocolFromUrl', [$url]); $this->assertSame($expectedResult, $result); } - function urls() { + public function urls() { return [ ['http://owncloud.org', 'owncloud.org'], ['https://owncloud.org', 'owncloud.org'], @@ -245,13 +245,13 @@ class ShareTest extends \Test\TestCase { * @param array $ungrouped * @param array $grouped */ - function testGroupItems($ungrouped, $grouped) { + public function testGroupItems($ungrouped, $grouped) { $result = DummyShareClass::groupItemsTest($ungrouped); $this->compareArrays($grouped, $result); } - function compareArrays($result, $expectedResult) { + public function compareArrays($result, $expectedResult) { foreach ($expectedResult as $key => $value) { if (is_array($value)) { $this->compareArrays($result[$key], $value); @@ -261,7 +261,7 @@ class ShareTest extends \Test\TestCase { } } - function dataProviderTestGroupItems() { + public function dataProviderTestGroupItems() { return [ // one array with one share [ diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index a1708f9cf01..b28be47875a 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -266,7 +266,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * * @param IQueryBuilder $queryBuilder */ - static protected function tearDownAfterClassCleanShares(IQueryBuilder $queryBuilder) { + protected static function tearDownAfterClassCleanShares(IQueryBuilder $queryBuilder) { $queryBuilder->delete('share') ->execute(); } @@ -276,7 +276,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * * @param IQueryBuilder $queryBuilder */ - static protected function tearDownAfterClassCleanStorages(IQueryBuilder $queryBuilder) { + protected static function tearDownAfterClassCleanStorages(IQueryBuilder $queryBuilder) { $queryBuilder->delete('storages') ->execute(); } @@ -286,7 +286,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * * @param IQueryBuilder $queryBuilder */ - static protected function tearDownAfterClassCleanFileCache(IQueryBuilder $queryBuilder) { + protected static function tearDownAfterClassCleanFileCache(IQueryBuilder $queryBuilder) { $queryBuilder->delete('filecache') ->execute(); } @@ -296,7 +296,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * * @param string $dataDir */ - static protected function tearDownAfterClassCleanStrayDataFiles($dataDir) { + protected static function tearDownAfterClassCleanStrayDataFiles($dataDir) { $knownEntries = [ 'nextcloud.log' => true, 'audit.log' => true, @@ -321,7 +321,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * * @param string $dir */ - static protected function tearDownAfterClassCleanStrayDataUnlinkDir($dir) { + protected static function tearDownAfterClassCleanStrayDataUnlinkDir($dir) { if ($dh = @opendir($dir)) { while (($file = readdir($dh)) !== false) { if (\OC\Files\Filesystem::isIgnoredDir($file)) { @@ -342,14 +342,14 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { /** * Clean up the list of hooks */ - static protected function tearDownAfterClassCleanStrayHooks() { + protected static function tearDownAfterClassCleanStrayHooks() { \OC_Hook::clear(); } /** * Clean up the list of locks */ - static protected function tearDownAfterClassCleanStrayLocks() { + protected static function tearDownAfterClassCleanStrayLocks() { \OC::$server->getLockingProvider()->releaseAll(); } @@ -359,7 +359,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * * @param string $user user id or empty for a generic FS */ - static protected function loginAsUser($user = '') { + protected static function loginAsUser($user = '') { self::logout(); \OC\Files\Filesystem::tearDown(); \OC_User::setUserId($user); @@ -376,7 +376,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { /** * Logout the current user and tear down the filesystem. */ - static protected function logout() { + protected static function logout() { \OC_Util::tearDownFS(); \OC_User::setUserId(''); // needed for fully logout diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php index 0baacda53d1..03f55ff2244 100644 --- a/tests/lib/UrlGeneratorTest.php +++ b/tests/lib/UrlGeneratorTest.php @@ -116,7 +116,7 @@ class UrlGeneratorTest extends \Test\TestCase { * test absolute URL construction * @dataProvider provideDocRootURLs */ - function testGetAbsoluteURLDocRoot($url, $expectedResult) { + public function testGetAbsoluteURLDocRoot($url, $expectedResult) { $this->mockBaseUrl(); \OC::$WEBROOT = ''; $result = $this->urlGenerator->getAbsoluteURL($url); @@ -128,7 +128,7 @@ class UrlGeneratorTest extends \Test\TestCase { * test absolute URL construction * @dataProvider provideSubDirURLs */ - function testGetAbsoluteURLSubDir($url, $expectedResult) { + public function testGetAbsoluteURLSubDir($url, $expectedResult) { $this->mockBaseUrl(); \OC::$WEBROOT = '/nextcloud'; $result = $this->urlGenerator->getAbsoluteURL($url); diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index 75f62163f1e..6e25ce16e75 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -38,7 +38,7 @@ class UtilTest extends \Test\TestCase { $this->assertTrue(is_string($edition)); } - function testSanitizeHTML() { + public function testSanitizeHTML() { $badArray = [ 'While it is unusual to pass an array', 'this function actually <blink>supports</blink> it.', @@ -71,7 +71,7 @@ class UtilTest extends \Test\TestCase { $this->assertEquals('This is a good string without HTML.', $result); } - function testEncodePath() { + public function testEncodePath() { $component = '/§#@test%&^ä/-child'; $result = OC_Util::encodePath($component); $this->assertEquals("/%C2%A7%23%40test%25%26%5E%C3%A4/-child", $result); @@ -82,12 +82,12 @@ class UtilTest extends \Test\TestCase { $this->assertEquals($expected, \OC_Util::fileInfoLoaded()); } - function testGetDefaultEmailAddress() { + public function testGetDefaultEmailAddress() { $email = \OCP\Util::getDefaultEmailAddress("no-reply"); $this->assertEquals('no-reply@localhost', $email); } - function testGetDefaultEmailAddressFromConfig() { + public function testGetDefaultEmailAddressFromConfig() { $config = \OC::$server->getConfig(); $config->setSystemValue('mail_domain', 'example.com'); $email = \OCP\Util::getDefaultEmailAddress("no-reply"); @@ -95,7 +95,7 @@ class UtilTest extends \Test\TestCase { $config->deleteSystemValue('mail_domain'); } - function testGetConfiguredEmailAddressFromConfig() { + public function testGetConfiguredEmailAddressFromConfig() { $config = \OC::$server->getConfig(); $config->setSystemValue('mail_domain', 'example.com'); $config->setSystemValue('mail_from_address', 'owncloud'); @@ -105,7 +105,7 @@ class UtilTest extends \Test\TestCase { $config->deleteSystemValue('mail_from_address'); } - function testGetInstanceIdGeneratesValidId() { + public function testGetInstanceIdGeneratesValidId() { \OC::$server->getConfig()->deleteSystemValue('instanceid'); $instanceId = OC_Util::getInstanceId(); $this->assertStringStartsWith('oc', $instanceId); @@ -178,7 +178,7 @@ class UtilTest extends \Test\TestCase { * @param array $excludedGroups groups which should be excluded from sharing * @param bool $expected expected result */ - function testIsSharingDisabledForUser($groups, $membership, $excludedGroups, $expected) { + public function testIsSharingDisabledForUser($groups, $membership, $excludedGroups, $expected) { $config = $this->getMockBuilder(IConfig::class)->disableOriginalConstructor()->getMock(); $groupManager = $this->getMockBuilder('OCP\IGroupManager')->disableOriginalConstructor()->getMock(); $user = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); @@ -224,7 +224,7 @@ class UtilTest extends \Test\TestCase { * @dataProvider defaultAppsProvider * @group DB */ - function testDefaultApps($defaultAppConfig, $expectedPath, $enabledApps) { + public function testDefaultApps($defaultAppConfig, $expectedPath, $enabledApps) { $oldDefaultApps = \OC::$server->getConfig()->getSystemValue('defaultapp', ''); // CLI is doing messy stuff with the webroot, so need to work it around $oldWebRoot = \OC::$WEBROOT; @@ -249,7 +249,7 @@ class UtilTest extends \Test\TestCase { \OC_User::setUserId(null); } - function defaultAppsProvider() { + public function defaultAppsProvider() { return [ // none specified, default to files [ |