diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2020-04-10 16:38:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-10 16:38:23 +0200 |
commit | 1762a409f954fd9a66e7572704ea9ba7813601b4 (patch) | |
tree | 554d8f6bc93f397755d0a7c050041a9973e25396 /tests/lib | |
parent | eba3726e1e1b7ce0a98df4552cfdecfe05e0d63a (diff) | |
parent | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (diff) | |
download | nextcloud-server-1762a409f954fd9a66e7572704ea9ba7813601b4.tar.gz nextcloud-server-1762a409f954fd9a66e7572704ea9ba7813601b4.zip |
Merge pull request #20422 from nextcloud/techdebt/format-control-structs-classes-methods
Format control structures, classes, methods and function
Diffstat (limited to 'tests/lib')
218 files changed, 420 insertions, 643 deletions
diff --git a/tests/lib/Accounts/AccountPropertyTest.php b/tests/lib/Accounts/AccountPropertyTest.php index 988fd64001d..afd807a44b4 100644 --- a/tests/lib/Accounts/AccountPropertyTest.php +++ b/tests/lib/Accounts/AccountPropertyTest.php @@ -33,7 +33,6 @@ use Test\TestCase; * @package Test\Accounts */ class AccountPropertyTest extends TestCase { - public function testConstructor() { $accountProperty = new AccountProperty( IAccountManager::PROPERTY_WEBSITE, @@ -97,6 +96,4 @@ class AccountPropertyTest extends TestCase { 'verified' => IAccountManager::VERIFIED ], $accountProperty->jsonSerialize()); } - - } diff --git a/tests/lib/Accounts/AccountTest.php b/tests/lib/Accounts/AccountTest.php index 6d0e187c433..11b13637bd0 100644 --- a/tests/lib/Accounts/AccountTest.php +++ b/tests/lib/Accounts/AccountTest.php @@ -35,7 +35,6 @@ use Test\TestCase; * @package Test\Accounts */ class AccountTest extends TestCase { - public function testConstructor() { $user = $this->createMock(IUser::class); $account = new Account($user); @@ -108,5 +107,4 @@ class AccountTest extends TestCase { $this->assertEquals($properties, $account->jsonSerialize()); } - } diff --git a/tests/lib/Accounts/AccountsManagerTest.php b/tests/lib/Accounts/AccountsManagerTest.php index 5bed1ff74fb..76abeb5b495 100644 --- a/tests/lib/Accounts/AccountsManagerTest.php +++ b/tests/lib/Accounts/AccountsManagerTest.php @@ -80,7 +80,6 @@ class AccountsManagerTest extends TestCase { ->setConstructorArgs([$this->connection, $this->eventDispatcher, $this->jobList, $this->logger]) ->setMethods($mockedMethods) ->getMock(); - } /** @@ -162,9 +161,8 @@ class AccountsManagerTest extends TestCase { ->with($askUser, $expectedData); } - if(empty($expectedData)) { + if (empty($expectedData)) { $accountManager->expects($this->never())->method('addMissingDefaultValues'); - } else { $accountManager->expects($this->once())->method('addMissingDefaultValues')->with($expectedData) ->willReturn($expectedData); @@ -215,7 +213,6 @@ class AccountsManagerTest extends TestCase { } public function testAddMissingDefaultValues() { - $accountManager = $this->getInstance(); $input = [ @@ -234,7 +231,6 @@ class AccountsManagerTest extends TestCase { } private function addDummyValuesToTable($uid, $data) { - $query = $this->connection->getQueryBuilder(); $query->insert($this->table) ->values( @@ -294,5 +290,4 @@ class AccountsManagerTest extends TestCase { ->willReturn($data); $this->assertEquals($expected, $accountManager->getAccount($user)); } - } diff --git a/tests/lib/Accounts/HooksTest.php b/tests/lib/Accounts/HooksTest.php index 433ecdedcf4..a0360404d72 100644 --- a/tests/lib/Accounts/HooksTest.php +++ b/tests/lib/Accounts/HooksTest.php @@ -33,7 +33,7 @@ use Test\TestCase; * @package Test\Accounts * @group DB */ -class HooksTest extends TestCase { +class HooksTest extends TestCase { /** @var ILogger | \PHPUnit_Framework_MockObject_MockObject */ private $logger; @@ -89,7 +89,6 @@ class HooksTest extends TestCase { } $this->hooks->changeUserHook($params); - } public function dataTestChangeUserHook() { @@ -151,5 +150,4 @@ class HooksTest extends TestCase { $result = $this->invokePrivate($hooks, 'getAccountManager'); $this->assertInstanceOf(AccountManager::class, $result); } - } diff --git a/tests/lib/Activity/ManagerTest.php b/tests/lib/Activity/ManagerTest.php index 98f36572c4a..77c0607916a 100644 --- a/tests/lib/Activity/ManagerTest.php +++ b/tests/lib/Activity/ManagerTest.php @@ -294,8 +294,6 @@ class ManagerTest extends TestCase { } class NoOpConsumer implements \OCP\Activity\IConsumer { - public function receive(\OCP\Activity\IEvent $event) { - } } diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php index c0e2878de37..bdcf2837fa5 100644 --- a/tests/lib/AllConfigTest.php +++ b/tests/lib/AllConfigTest.php @@ -23,13 +23,13 @@ class AllConfigTest extends \Test\TestCase { protected $connection; protected function getConfig($systemConfig = null, $connection = null) { - if($this->connection === null) { + if ($this->connection === null) { $this->connection = \OC::$server->getDatabaseConnection(); } - if($connection === null) { + if ($connection === null) { $connection = $this->connection; } - if($systemConfig === null) { + if ($systemConfig === null) { $systemConfig = $this->getMockBuilder('\OC\SystemConfig') ->disableOriginalConstructor() ->getMock(); @@ -437,5 +437,4 @@ class AllConfigTest extends \Test\TestCase { // cleanup $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); } - } diff --git a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php index b4d30b4bf50..5964220958c 100644 --- a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php +++ b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php @@ -78,5 +78,4 @@ class BundleFetcherTest extends TestCase { $this->bundleFetcher->getBundleByIdentifier('NotExistingBundle'); } - } diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php index 3390e08881b..f0204b7bcd1 100644 --- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php @@ -38,7 +38,7 @@ use OCP\ILogger; use PHPUnit_Framework_MockObject_MockObject; use Test\TestCase; -class AppFetcherTest extends TestCase { +class AppFetcherTest extends TestCase { /** @var IAppData|PHPUnit_Framework_MockObject_MockObject */ protected $appData; /** @var IClientService|PHPUnit_Framework_MockObject_MockObject */ @@ -1918,16 +1918,16 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== $dataToPut['data'] = array_values($dataToPut['data']); $originalArray = json_decode(self::$responseJson, true); $mappedOriginalArray = []; - foreach($originalArray as $key => $value) { - foreach($value as $releaseKey => $releaseValue) { - if($releaseKey === 'id') { + foreach ($originalArray as $key => $value) { + foreach ($value as $releaseKey => $releaseValue) { + if ($releaseKey === 'id') { $mappedOriginalArray[$releaseValue] = $originalArray[$key]; } } } - foreach($dataToPut['data'] as $key => $appValue) { - foreach($appValue as $appKey => $value) { - if($appKey === 'certificate' || $appKey === 'description') { + foreach ($dataToPut['data'] as $key => $appValue) { + foreach ($appValue as $appKey => $value) { + if ($appKey === 'certificate' || $appKey === 'description') { $dataToPut['data'][$key][$appKey] = $mappedOriginalArray[$appValue['id']][$appKey]; } } @@ -2037,16 +2037,16 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== $dataToPut['data'] = array_values($dataToPut['data']); $originalArray = json_decode(self::$responseJson, true); $mappedOriginalArray = []; - foreach($originalArray as $key => $value) { - foreach($value as $releaseKey => $releaseValue) { - if($releaseKey === 'id') { + foreach ($originalArray as $key => $value) { + foreach ($value as $releaseKey => $releaseValue) { + if ($releaseKey === 'id') { $mappedOriginalArray[$releaseValue] = $originalArray[$key]; } } } - foreach($dataToPut['data'] as $key => $appValue) { - foreach($appValue as $appKey => $value) { - if($appKey === 'certificate' || $appKey === 'description') { + foreach ($dataToPut['data'] as $key => $appValue) { + foreach ($appValue as $appKey => $value) { + if ($appKey === 'certificate' || $appKey === 'description') { $dataToPut['data'][$key][$appKey] = $mappedOriginalArray[$appValue['id']][$appKey]; } } diff --git a/tests/lib/App/AppStore/Version/VersionParserTest.php b/tests/lib/App/AppStore/Version/VersionParserTest.php index 327c8cac779..edb48dc4130 100644 --- a/tests/lib/App/AppStore/Version/VersionParserTest.php +++ b/tests/lib/App/AppStore/Version/VersionParserTest.php @@ -25,7 +25,7 @@ use OC\App\AppStore\Version\Version; use OC\App\AppStore\Version\VersionParser; use Test\TestCase; -class VersionParserTest extends TestCase { +class VersionParserTest extends TestCase { /** @var VersionParser */ private $versionParser; diff --git a/tests/lib/App/CodeChecker/NodeVisitorTest.php b/tests/lib/App/CodeChecker/NodeVisitorTest.php index 2383b56b676..cfc6951c614 100644 --- a/tests/lib/App/CodeChecker/NodeVisitorTest.php +++ b/tests/lib/App/CodeChecker/NodeVisitorTest.php @@ -14,7 +14,6 @@ use Test\App\CodeChecker\Mock\TestList; use Test\TestCase; class NodeVisitorTest extends TestCase { - public function providesFilesToCheck() { return [ [[['OCP\AppFramework\IApi', 1006]], 'test-deprecated-use.php'], diff --git a/tests/lib/App/CompareVersionTest.php b/tests/lib/App/CompareVersionTest.php index af04691f276..6db31d0ee6f 100644 --- a/tests/lib/App/CompareVersionTest.php +++ b/tests/lib/App/CompareVersionTest.php @@ -87,5 +87,4 @@ class CompareVersionTest extends TestCase { $this->compare->isCompatible($actualVersion, '13.0.0.9'); } - } diff --git a/tests/lib/App/PlatformRepositoryTest.php b/tests/lib/App/PlatformRepositoryTest.php index 9063dffa646..6bc256c20b0 100644 --- a/tests/lib/App/PlatformRepositoryTest.php +++ b/tests/lib/App/PlatformRepositoryTest.php @@ -62,4 +62,5 @@ class PlatformRepositoryTest extends \Test\TestCase { // 'semver metadata/3' => array('1.0.0+foo', '1.0.0.0'), // 'metadata w/ alias' => array('1.0.0+foo as 2.0', '1.0.0.0'), ]; - }} + } +} diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php index 6b4cd656a89..595a556a9a8 100644 --- a/tests/lib/AppFramework/AppTest.php +++ b/tests/lib/AppFramework/AppTest.php @@ -43,7 +43,6 @@ function rrmdir($directory) { class AppTest extends \Test\TestCase { - private $container; private $io; private $api; @@ -231,5 +230,4 @@ class AppTest extends \Test\TestCase { App::main('Foo', $this->controllerMethod, $this->container); } - } diff --git a/tests/lib/AppFramework/Controller/ApiControllerTest.php b/tests/lib/AppFramework/Controller/ApiControllerTest.php index ccc44b97764..71eb97b94da 100644 --- a/tests/lib/AppFramework/Controller/ApiControllerTest.php +++ b/tests/lib/AppFramework/Controller/ApiControllerTest.php @@ -27,7 +27,8 @@ use OC\AppFramework\Http\Request; use OCP\AppFramework\ApiController; use OCP\IConfig; -class ChildApiController extends ApiController {}; +class ChildApiController extends ApiController { +}; class ApiControllerTest extends \Test\TestCase { @@ -57,5 +58,4 @@ class ApiControllerTest extends \Test\TestCase { $this->assertEquals('false', $headers['Access-Control-Allow-Credentials']); $this->assertEquals(100, $headers['Access-Control-Max-Age']); } - } diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php index f15d178df28..e07089e0c82 100644 --- a/tests/lib/AppFramework/Controller/ControllerTest.php +++ b/tests/lib/AppFramework/Controller/ControllerTest.php @@ -30,7 +30,6 @@ use OCP\AppFramework\Http\JSONResponse; use OCP\IConfig; class ChildController extends Controller { - public function __construct($appName, $request) { parent::__construct($appName, $request); $this->registerResponder('tom', function ($respone) { @@ -157,6 +156,4 @@ class ControllerTest extends \Test\TestCase { $this->assertEquals('tom', $responder); } - - } diff --git a/tests/lib/AppFramework/Controller/OCSControllerTest.php b/tests/lib/AppFramework/Controller/OCSControllerTest.php index 85f2a7f6463..91a61047871 100644 --- a/tests/lib/AppFramework/Controller/OCSControllerTest.php +++ b/tests/lib/AppFramework/Controller/OCSControllerTest.php @@ -30,7 +30,8 @@ use OCP\AppFramework\OCSController; use OCP\IConfig; use OCP\Security\ISecureRandom; -class ChildOCSController extends OCSController {} +class ChildOCSController extends OCSController { +} class OCSControllerTest extends \Test\TestCase { diff --git a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php index 388d5fbeef2..521c45e47c6 100644 --- a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php +++ b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php @@ -89,5 +89,4 @@ class PublicShareControllerTest extends \Test\TestCase { $this->assertEquals($expected, $this->controller->isAuthenticated()); } - } diff --git a/tests/lib/AppFramework/Db/EntityTest.php b/tests/lib/AppFramework/Db/EntityTest.php index faff2649bc6..73138749a33 100644 --- a/tests/lib/AppFramework/Db/EntityTest.php +++ b/tests/lib/AppFramework/Db/EntityTest.php @@ -62,7 +62,6 @@ class TestEntity extends Entity { class EntityTest extends \Test\TestCase { - private $entity; protected function setUp(): void { diff --git a/tests/lib/AppFramework/Db/MapperTest.php b/tests/lib/AppFramework/Db/MapperTest.php index 4509b1b80c7..e5a4b63b7a3 100644 --- a/tests/lib/AppFramework/Db/MapperTest.php +++ b/tests/lib/AppFramework/Db/MapperTest.php @@ -44,12 +44,24 @@ class Example extends Entity { class ExampleMapper extends Mapper { - public function __construct(IDBConnection $db) { parent::__construct($db, 'table'); } - public function find($table, $id) { return $this->findOneQuery($table, $id); } - public function findOneEntity($table, $id) { return $this->findEntity($table, $id); } - public function findAllEntities($table) { return $this->findEntities($table); } - public function mapRow($row) { return $this->mapRowToEntity($row); } - public function execSql($sql, $params) { return $this->execute($sql, $params); } + public function __construct(IDBConnection $db) { + parent::__construct($db, 'table'); + } + public function find($table, $id) { + return $this->findOneQuery($table, $id); + } + public function findOneEntity($table, $id) { + return $this->findEntity($table, $id); + } + public function findAllEntities($table) { + return $this->findEntities($table); + } + public function mapRow($row) { + return $this->mapRowToEntity($row); + } + public function execSql($sql, $params) { + return $this->execute($sql, $params); + } } diff --git a/tests/lib/AppFramework/Db/MapperTestUtility.php b/tests/lib/AppFramework/Db/MapperTestUtility.php index 9ee83e5a161..1224e6d24ed 100644 --- a/tests/lib/AppFramework/Db/MapperTestUtility.php +++ b/tests/lib/AppFramework/Db/MapperTestUtility.php @@ -90,24 +90,24 @@ abstract class MapperTestUtility extends \Test\TestCase { */ protected function setMapperResult($sql, $arguments=[], $returnRows=[], $limit=null, $offset=null, $expectClose=false) { - if($limit === null && $offset === null) { + if ($limit === null && $offset === null) { $this->db->expects($this->at($this->prepareAt)) ->method('prepare') ->with($this->equalTo($sql)) ->will(($this->returnValue($this->query))); - } elseif($limit !== null && $offset === null) { + } elseif ($limit !== null && $offset === null) { $this->db->expects($this->at($this->prepareAt)) ->method('prepare') ->with($this->equalTo($sql), $this->equalTo($limit)) ->will(($this->returnValue($this->query))); - } elseif($limit === null && $offset !== null) { + } elseif ($limit === null && $offset !== null) { $this->db->expects($this->at($this->prepareAt)) ->method('prepare') ->with($this->equalTo($sql), $this->equalTo(null), $this->equalTo($offset)) ->will(($this->returnValue($this->query))); - } else { + } else { $this->db->expects($this->at($this->prepareAt)) ->method('prepare') ->with($this->equalTo($sql), @@ -128,7 +128,7 @@ abstract class MapperTestUtility extends \Test\TestCase { $iterator = $iterators[$fetchAt]; $result = $iterator->next(); - if($result === false) { + if ($result === false) { $fetchAt++; } @@ -139,7 +139,7 @@ abstract class MapperTestUtility extends \Test\TestCase { ); if ($this->isAssocArray($arguments)) { - foreach($arguments as $key => $argument) { + foreach ($arguments as $key => $argument) { $pdoConstant = $this->getPDOType($argument); $this->query->expects($this->at($this->queryAt)) ->method('bindValue') @@ -150,7 +150,7 @@ abstract class MapperTestUtility extends \Test\TestCase { } } else { $index = 1; - foreach($arguments as $argument) { + foreach ($arguments as $argument) { $pdoConstant = $this->getPDOType($argument); $this->query->expects($this->at($this->queryAt)) ->method('bindValue') @@ -165,7 +165,6 @@ abstract class MapperTestUtility extends \Test\TestCase { $this->query->expects($this->at($this->queryAt)) ->method('execute') ->willReturnCallback(function ($sql, $p=null, $o=null, $s=null) { - }); $this->queryAt++; @@ -182,13 +181,10 @@ abstract class MapperTestUtility extends \Test\TestCase { $this->prepareAt++; $this->fetchAt++; } - - } class ArgumentIterator { - private $arguments; public function __construct($arguments) { @@ -197,7 +193,7 @@ class ArgumentIterator { public function next() { $result = array_shift($this->arguments); - if($result === null){ + if ($result === null) { return false; } else { return $result; diff --git a/tests/lib/AppFramework/Db/QBMapperTest.php b/tests/lib/AppFramework/Db/QBMapperTest.php index 6fa0fe10d88..7865979ef41 100644 --- a/tests/lib/AppFramework/Db/QBMapperTest.php +++ b/tests/lib/AppFramework/Db/QBMapperTest.php @@ -42,7 +42,6 @@ use OCP\IDBConnection; * @method void setIntegerProp(integer $integerProp) */ class QBTestEntity extends Entity { - protected $intProp; protected $boolProp; protected $stringProp; @@ -106,7 +105,6 @@ class QBMapperTest extends \Test\TestCase { * @throws \ReflectionException */ protected function setUp(): void { - $this->db = $this->getMockBuilder(IDBConnection::class) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php b/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php index 669063f4d18..78a1d40bea6 100644 --- a/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php +++ b/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php @@ -28,11 +28,14 @@ use OC\AppFramework\Utility\SimpleContainer; use OC\ServerContainer; use Test\TestCase; -interface Interface1 {} +interface Interface1 { +} -class ClassA1 implements Interface1 {} +class ClassA1 implements Interface1 { +} -class ClassA2 implements Interface1 {} +class ClassA2 implements Interface1 { +} class ClassB { /** @var Interface1 */ diff --git a/tests/lib/AppFramework/Http/DataResponseTest.php b/tests/lib/AppFramework/Http/DataResponseTest.php index cd7b64a1caa..e7624c92d7e 100644 --- a/tests/lib/AppFramework/Http/DataResponseTest.php +++ b/tests/lib/AppFramework/Http/DataResponseTest.php @@ -84,6 +84,4 @@ class DataResponseTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_NOT_FOUND, $this->response->getStatus()); $this->assertEquals(['hi', 'yo'], $this->response->getData()); } - - } diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index bb6f68c40bb..74dbf68c28a 100644 --- a/tests/lib/AppFramework/Http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -70,7 +70,6 @@ class TestController extends Controller { 'text' => [$int, $bool, $test, $test2] ]); } - } @@ -142,15 +141,14 @@ class DispatcherTest extends \Test\TestCase { private function setMiddlewareExpectations($out=null, $httpHeaders=null, $responseHeaders=[], $ex=false, $catchEx=true) { - - if($ex) { + if ($ex) { $exception = new \Exception(); $this->middlewareDispatcher->expects($this->once()) ->method('beforeController') ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod)) ->will($this->throwException($exception)); - if($catchEx) { + if ($catchEx) { $this->middlewareDispatcher->expects($this->once()) ->method('afterException') ->with($this->equalTo($this->controller), @@ -272,7 +270,6 @@ class DispatcherTest extends \Test\TestCase { $this->controller, $this->controllerMethod ); - } @@ -488,8 +485,4 @@ class DispatcherTest extends \Test\TestCase { $this->assertEquals('{"text":[3,true,4,1]}', $response[3]); } - - - - } diff --git a/tests/lib/AppFramework/Http/DownloadResponseTest.php b/tests/lib/AppFramework/Http/DownloadResponseTest.php index b3437a351f9..1ad53f5db13 100644 --- a/tests/lib/AppFramework/Http/DownloadResponseTest.php +++ b/tests/lib/AppFramework/Http/DownloadResponseTest.php @@ -26,7 +26,6 @@ namespace Test\AppFramework\Http; use OCP\AppFramework\Http\DownloadResponse; class ChildDownloadResponse extends DownloadResponse { - }; @@ -49,6 +48,4 @@ class DownloadResponseTest extends \Test\TestCase { $this->assertContains('attachment; filename="file"', $headers['Content-Disposition']); $this->assertContains('content', $headers['Content-Type']); } - - } diff --git a/tests/lib/AppFramework/Http/HttpTest.php b/tests/lib/AppFramework/Http/HttpTest.php index 14097a2a581..009bb39260d 100644 --- a/tests/lib/AppFramework/Http/HttpTest.php +++ b/tests/lib/AppFramework/Http/HttpTest.php @@ -26,7 +26,6 @@ namespace Test\AppFramework\Http; use OC\AppFramework\Http; class HttpTest extends \Test\TestCase { - private $server; /** @@ -93,5 +92,4 @@ class HttpTest extends \Test\TestCase { $this->assertEquals('HTTP/1.0 302 Found', $header); } // TODO: write unittests for http codes - } diff --git a/tests/lib/AppFramework/Http/JSONResponseTest.php b/tests/lib/AppFramework/Http/JSONResponseTest.php index 56e6d43096d..504876b2d88 100644 --- a/tests/lib/AppFramework/Http/JSONResponseTest.php +++ b/tests/lib/AppFramework/Http/JSONResponseTest.php @@ -116,5 +116,4 @@ class JSONResponseTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_NOT_FOUND, $this->json->getStatus()); $this->assertEquals(['hi', 'yo'], $this->json->getData()); } - } diff --git a/tests/lib/AppFramework/Http/OCSResponseTest.php b/tests/lib/AppFramework/Http/OCSResponseTest.php index ec1b422ddd9..e33f1399b84 100644 --- a/tests/lib/AppFramework/Http/OCSResponseTest.php +++ b/tests/lib/AppFramework/Http/OCSResponseTest.php @@ -26,8 +26,6 @@ namespace Test\AppFramework\Http; use OCP\AppFramework\Http\OCSResponse; class OCSResponseTest extends \Test\TestCase { - - public function testHeadersJSON() { $response = new OCSResponse('json', 1, 2, 3); $type = $response->getHeaders()['Content-Type']; @@ -62,8 +60,5 @@ class OCSResponseTest extends \Test\TestCase { "</ocs>\n"; $this->assertEquals($expected, $out); - } - - } diff --git a/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php b/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php index 90fb8cceca1..cbf8f8303c3 100644 --- a/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php +++ b/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php @@ -29,7 +29,6 @@ use OCP\AppFramework\Http\Template\PublicTemplateResponse; use Test\TestCase; class PublicTemplateResponseTest extends TestCase { - public function testSetParamsConstructor() { $template = new PublicTemplateResponse('app', 'home', ['key' => 'value']); $this->assertContains('core/js/public/publicpage', \OC_Util::$scripts); @@ -79,5 +78,4 @@ class PublicTemplateResponseTest extends TestCase { $this->assertEquals(['key' => 'value'], $template->getParams()); $this->assertEquals('public', $template->getRenderAs()); } - } diff --git a/tests/lib/AppFramework/Http/RedirectResponseTest.php b/tests/lib/AppFramework/Http/RedirectResponseTest.php index 3c210092ca8..5130d36937f 100644 --- a/tests/lib/AppFramework/Http/RedirectResponseTest.php +++ b/tests/lib/AppFramework/Http/RedirectResponseTest.php @@ -50,6 +50,4 @@ class RedirectResponseTest extends \Test\TestCase { public function testGetRedirectUrl() { $this->assertEquals('/url', $this->response->getRedirectUrl()); } - - } diff --git a/tests/lib/AppFramework/Http/RequestStream.php b/tests/lib/AppFramework/Http/RequestStream.php index 97951ea4b9f..1dcfbce46d1 100644 --- a/tests/lib/AppFramework/Http/RequestStream.php +++ b/tests/lib/AppFramework/Http/RequestStream.php @@ -44,28 +44,28 @@ class RequestStream { switch ($whence) { case SEEK_SET: if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) { - $this->position = $offset; - return true; + $this->position = $offset; + return true; } else { - return false; + return false; } break; case SEEK_CUR: if ($offset >= 0) { - $this->position += $offset; - return true; + $this->position += $offset; + return true; } else { - return false; + return false; } break; case SEEK_END: if (strlen($GLOBALS[$this->varname]) + $offset >= 0) { - $this->position = strlen($GLOBALS[$this->varname]) + $offset; - return true; + $this->position = strlen($GLOBALS[$this->varname]) + $offset; + return true; } else { - return false; + return false; } break; @@ -97,10 +97,10 @@ class RequestStream { } function stream_metadata($path, $option, $var) { - if($option == STREAM_META_TOUCH) { + if ($option == STREAM_META_TOUCH) { $url = parse_url($path); $varname = $url["host"]; - if(!isset($GLOBALS[$varname])) { + if (!isset($GLOBALS[$varname])) { $GLOBALS[$varname] = ''; } return true; diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index 819eb666d7b..2004bd2e6b5 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -77,7 +77,6 @@ class RequestTest extends \Test\TestCase { $this->assertSame('Joey', $request->get['nickname']); // Always returns null if variable not set. $this->assertSame(null, $request->{'flickname'}); - } // urlParams has precedence over POST which has precedence over GET @@ -326,11 +325,10 @@ class RequestTest extends \Test\TestCase { try { $resource = $request->put; - } catch(\LogicException $e) { + } catch (\LogicException $e) { return; } $this->fail('Expected LogicException.'); - } diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php index 7ff12b7fa67..3978326d130 100644 --- a/tests/lib/AppFramework/Http/ResponseTest.php +++ b/tests/lib/AppFramework/Http/ResponseTest.php @@ -269,7 +269,6 @@ class ResponseTest extends \Test\TestCase { $this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']); $this->assertEquals('max-age=33, must-revalidate', $headers['Cache-Control']); - } public function testThrottle() { diff --git a/tests/lib/AppFramework/Http/StreamResponseTest.php b/tests/lib/AppFramework/Http/StreamResponseTest.php index fb4eb5dc91c..97aced01506 100644 --- a/tests/lib/AppFramework/Http/StreamResponseTest.php +++ b/tests/lib/AppFramework/Http/StreamResponseTest.php @@ -95,5 +95,4 @@ class StreamResponseTest extends \Test\TestCase { $response->callback($this->output); } - } diff --git a/tests/lib/AppFramework/Http/TemplateResponseTest.php b/tests/lib/AppFramework/Http/TemplateResponseTest.php index 0faa78998cb..6cbf112494e 100644 --- a/tests/lib/AppFramework/Http/TemplateResponseTest.php +++ b/tests/lib/AppFramework/Http/TemplateResponseTest.php @@ -82,5 +82,4 @@ class TemplateResponseTest extends \Test\TestCase { $this->assertEquals(Http::STATUS_NOT_FOUND, $this->tpl->getStatus()); $this->assertEquals(['hi' => 'yo'], $this->tpl->getParams()); } - } diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php index 5f0517016dd..25cfa32dc7c 100644 --- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php @@ -65,7 +65,7 @@ class TestMiddleware extends Middleware { $this->beforeControllerOrder = self::$beforeControllerCalled; $this->controller = $controller; $this->methodName = $methodName; - if($this->beforeControllerThrowsEx){ + if ($this->beforeControllerThrowsEx) { throw new \Exception(); } } @@ -100,7 +100,6 @@ class TestMiddleware extends Middleware { class MiddlewareDispatcherTest extends \Test\TestCase { - public $exception; public $response; private $out; diff --git a/tests/lib/AppFramework/Middleware/MiddlewareTest.php b/tests/lib/AppFramework/Middleware/MiddlewareTest.php index 4ac6fa647f7..42e38bbd999 100644 --- a/tests/lib/AppFramework/Middleware/MiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareTest.php @@ -28,7 +28,8 @@ use OCP\AppFramework\Http\Response; use OCP\AppFramework\Middleware; use OCP\IConfig; -class ChildMiddleware extends Middleware {}; +class ChildMiddleware extends Middleware { +}; class MiddlewareTest extends \Test\TestCase { @@ -91,6 +92,4 @@ class MiddlewareTest extends \Test\TestCase { $this->assertEquals('test', $output); } - - } diff --git a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php index e001e48acd2..834cd39185c 100644 --- a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php @@ -238,5 +238,4 @@ class OCSMiddlewareTest extends \Test\TestCase { $this->assertSame(Http::STATUS_UNAUTHORIZED, $newResponse->getStatus()); } } - } diff --git a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php index 82f354d127d..ed6d06d4bf5 100644 --- a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php @@ -282,6 +282,4 @@ class PublicShareMiddlewareTest extends \Test\TestCase { $result = $this->middleware->afterException($controller, 'method', $exception); $this->assertInstanceOf(RedirectResponse::class, $result); } - - } diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php index 691553a13d8..a7bf2b14271 100644 --- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php @@ -270,5 +270,4 @@ class CORSMiddlewareTest extends \Test\TestCase { $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); $middleware->afterException($this->controller, __FUNCTION__, new \Exception('A regular exception')); } - } diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index 422087241f6..306ee9f841c 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -86,7 +86,6 @@ class SecurityMiddlewareTest extends \Test\TestCase { } private function getMiddleware(bool $isLoggedIn, bool $isAdminUser, bool $isSubAdmin, bool $isAppEnabledForUser = true): SecurityMiddleware { - $this->appManager = $this->createMock(IAppManager::class); $this->appManager->expects($this->any()) ->method('isEnabledForUser') @@ -140,7 +139,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { try { $this->reader->reflect(__CLASS__, $method); $sec->beforeController($this->controller, $method); - } catch (SecurityException $ex){ + } catch (SecurityException $ex) { $this->assertEquals($status, $ex->getCode()); } @@ -236,7 +235,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { $sec = $this->getMiddleware($isLoggedIn, $isAdminUser, false); - if($shouldFail) { + if ($shouldFail) { $this->expectException(SecurityException::class); } else { $this->addToAssertionCount(1); diff --git a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php index 940112311c3..f9739044465 100644 --- a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php @@ -81,5 +81,4 @@ class SessionMiddlewareTest extends \Test\TestCase { ->method('close'); return $session; } - } diff --git a/tests/lib/AppFramework/OCS/BaseResponseTest.php b/tests/lib/AppFramework/OCS/BaseResponseTest.php index 18a85788af2..aca8c355f41 100644 --- a/tests/lib/AppFramework/OCS/BaseResponseTest.php +++ b/tests/lib/AppFramework/OCS/BaseResponseTest.php @@ -29,7 +29,6 @@ namespace Test\AppFramework\Middleware; use OC\AppFramework\OCS\BaseResponse; class BaseResponseTest extends \Test\TestCase { - public function testToXml(): void { /** @var BaseResponse $response */ @@ -57,5 +56,4 @@ class BaseResponseTest extends \Test\TestCase { $writer->outputMemory(true) ); } - } diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php index 5e0604263fc..1aef757720b 100644 --- a/tests/lib/AppFramework/Routing/RoutingTest.php +++ b/tests/lib/AppFramework/Routing/RoutingTest.php @@ -10,11 +10,8 @@ use OCP\ILogger; use OCP\Route\IRouter; use PHPUnit\Framework\MockObject\MockObject; -class RoutingTest extends \Test\TestCase -{ - - public function testSimpleRoute() - { +class RoutingTest extends \Test\TestCase { + public function testSimpleRoute() { $routes = ['routes' => [ ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'GET'] ]]; @@ -31,8 +28,7 @@ class RoutingTest extends \Test\TestCase $this->assertSimpleOCSRoute($routes, 'folders.open', 'GET', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open'); } - public function testSimpleRouteWithMissingVerb() - { + public function testSimpleRouteWithMissingVerb() { $routes = ['routes' => [ ['name' => 'folders#open', 'url' => '/folders/{folderId}/open'] ]]; @@ -49,8 +45,7 @@ class RoutingTest extends \Test\TestCase $this->assertSimpleOCSRoute($routes, 'folders.open', 'GET', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open'); } - public function testSimpleRouteWithLowercaseVerb() - { + public function testSimpleRouteWithLowercaseVerb() { $routes = ['routes' => [ ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete'] ]]; @@ -67,8 +62,7 @@ class RoutingTest extends \Test\TestCase $this->assertSimpleOCSRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open'); } - public function testSimpleRouteWithRequirements() - { + public function testSimpleRouteWithRequirements() { $routes = ['routes' => [ ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'requirements' => ['something']] ]]; @@ -85,8 +79,7 @@ class RoutingTest extends \Test\TestCase $this->assertSimpleOCSRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open', ['something']); } - public function testSimpleRouteWithDefaults() - { + public function testSimpleRouteWithDefaults() { $routes = ['routes' => [ ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', [], 'defaults' => ['param' => 'foobar']] ]]; @@ -104,8 +97,7 @@ class RoutingTest extends \Test\TestCase $this->assertSimpleOCSRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open', [], ['param' => 'foobar']); } - public function testSimpleRouteWithPostfix() - { + public function testSimpleRouteWithPostfix() { $routes = ['routes' => [ ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'postfix' => '_something'] ]]; @@ -123,8 +115,7 @@ class RoutingTest extends \Test\TestCase } - public function testSimpleRouteWithBrokenName() - { + public function testSimpleRouteWithBrokenName() { $this->expectException(\UnexpectedValueException::class); $routes = ['routes' => [ @@ -165,8 +156,7 @@ class RoutingTest extends \Test\TestCase $config->register(); } - public function testSimpleRouteWithUnderScoreNames() - { + public function testSimpleRouteWithUnderScoreNames() { $routes = ['routes' => [ ['name' => 'admin_folders#open_current', 'url' => '/folders/{folderId}/open', 'verb' => 'delete'] ]]; @@ -182,36 +172,31 @@ class RoutingTest extends \Test\TestCase $this->assertSimpleOCSRoute($routes, 'admin_folders.open_current', 'DELETE', '/apps/app1/folders/{folderId}/open', 'AdminFoldersController', 'openCurrent'); } - public function testOCSResource() - { + public function testOCSResource() { $routes = ['ocs-resources' => ['account' => ['url' => '/accounts']]]; $this->assertOCSResource($routes, 'account', '/apps/app1/accounts', 'AccountController', 'id'); } - public function testOCSResourceWithUnderScoreName() - { + public function testOCSResourceWithUnderScoreName() { $routes = ['ocs-resources' => ['admin_accounts' => ['url' => '/admin/accounts']]]; $this->assertOCSResource($routes, 'admin_accounts', '/apps/app1/admin/accounts', 'AdminAccountsController', 'id'); } - public function testOCSResourceWithRoot() - { + public function testOCSResourceWithRoot() { $routes = ['ocs-resources' => ['admin_accounts' => ['url' => '/admin/accounts', 'root' => '/core/endpoint']]]; $this->assertOCSResource($routes, 'admin_accounts', '/core/endpoint/admin/accounts', 'AdminAccountsController', 'id'); } - public function testResource() - { + public function testResource() { $routes = ['resources' => ['account' => ['url' => '/accounts']]]; $this->assertResource($routes, 'account', '/accounts', 'AccountController', 'id'); } - public function testResourceWithUnderScoreName() - { + public function testResourceWithUnderScoreName() { $routes = ['resources' => ['admin_accounts' => ['url' => '/admin/accounts']]]; $this->assertResource($routes, 'admin_accounts', '/admin/accounts', 'AdminAccountsController', 'id'); @@ -224,8 +209,7 @@ class RoutingTest extends \Test\TestCase * @param string $controllerName * @param string $actionName */ - private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName, array $requirements=[], array $defaults=[], $postfix='') - { + private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName, array $requirements=[], array $defaults=[], $postfix='') { if ($postfix) { $name .= $postfix; } @@ -272,8 +256,7 @@ class RoutingTest extends \Test\TestCase $actionName, array $requirements=[], array $defaults=[], - $postfix='') - { + $postfix='') { if ($postfix) { $name .= $postfix; } @@ -368,8 +351,7 @@ class RoutingTest extends \Test\TestCase * @param string $controllerName * @param string $paramName */ - private function assertResource($yaml, $resourceName, $url, $controllerName, $paramName) - { + private function assertResource($yaml, $resourceName, $url, $controllerName, $paramName) { // router mock $router = $this->getMockBuilder('\OC\Route\Router') ->setMethods(['create']) @@ -456,7 +438,7 @@ class RoutingTest extends \Test\TestCase ->with($this->equalTo(new RouteActionHandler($container, $controllerName, $actionName))) ->willReturn($route); - if(count($requirements) > 0) { + if (count($requirements) > 0) { $route ->expects($this->exactly(1)) ->method('requirements') @@ -474,7 +456,6 @@ class RoutingTest extends \Test\TestCase return $route; } - } /* diff --git a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php index 2d20578efab..990ad44adf3 100644 --- a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php +++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php @@ -30,18 +30,20 @@ class BaseController { /** * @Annotation */ - public function test() {} + public function test() { + } /** * @Annotation */ - public function test2() {} + public function test2() { + } /** * @Annotation */ - public function test3() {} - + public function test3() { + } } class MiddleController extends BaseController { @@ -49,13 +51,15 @@ class MiddleController extends BaseController { /** * @NoAnnotation */ - public function test2() {} - - public function test3() {} + public function test2() { + } + public function test3() { + } } -class EndController extends MiddleController {} +class EndController extends MiddleController { +} class ControllerMethodReflectorTest extends \Test\TestCase { @@ -136,7 +140,8 @@ class ControllerMethodReflectorTest extends \Test\TestCase { * @param int $a * @param int $b */ - public function arguments3($a, float $b, int $c, $d) {} + public function arguments3($a, float $b, int $c, $d) { + } /** * @requires PHP 7 @@ -184,7 +189,8 @@ class ControllerMethodReflectorTest extends \Test\TestCase { } - public function arguments($arg, $arg2='hi') {} + public function arguments($arg, $arg2='hi') { + } public function testReflectParameters() { $reader = new ControllerMethodReflector(); $reader->reflect( @@ -196,7 +202,8 @@ class ControllerMethodReflectorTest extends \Test\TestCase { } - public function arguments2($arg) {} + public function arguments2($arg) { + } public function testReflectParameters2() { $reader = new ControllerMethodReflector(); $reader->reflect( @@ -231,5 +238,4 @@ class ControllerMethodReflectorTest extends \Test\TestCase { $this->assertFalse($reader->hasAnnotation('Annotation')); } - } diff --git a/tests/lib/AppFramework/Utility/SimpleContainerTest.php b/tests/lib/AppFramework/Utility/SimpleContainerTest.php index 52908ed8839..f8a43058305 100644 --- a/tests/lib/AppFramework/Utility/SimpleContainerTest.php +++ b/tests/lib/AppFramework/Utility/SimpleContainerTest.php @@ -25,9 +25,11 @@ namespace Test\AppFramework\Utility; use OC\AppFramework\Utility\SimpleContainer; -interface TestInterface {} +interface TestInterface { +} -class ClassEmptyConstructor implements IInterfaceConstructor {} +class ClassEmptyConstructor implements IInterfaceConstructor { +} class ClassSimpleConstructor implements IInterfaceConstructor { public $test; @@ -45,7 +47,8 @@ class ClassComplexConstructor { } } -interface IInterfaceConstructor {} +interface IInterfaceConstructor { +} class ClassInterfaceConstructor { public $class; public $test; @@ -57,8 +60,6 @@ class ClassInterfaceConstructor { class SimpleContainerTest extends \Test\TestCase { - - private $container; protected function setUp(): void { @@ -218,5 +219,4 @@ class SimpleContainerTest extends \Test\TestCase { $this->assertNotSame( $this->container->query('test'), $this->container->query('test1')); } - } diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php index 75084e7f0f3..a53e3f8e252 100644 --- a/tests/lib/AppTest.php +++ b/tests/lib/AppTest.php @@ -20,7 +20,6 @@ use OCP\IAppConfig; * @group DB */ class AppTest extends \Test\TestCase { - const TEST_USER1 = 'user1'; const TEST_USER2 = 'user2'; const TEST_USER3 = 'user3'; diff --git a/tests/lib/Archive/TestBase.php b/tests/lib/Archive/TestBase.php index c94767db606..a9a41ed36ba 100644 --- a/tests/lib/Archive/TestBase.php +++ b/tests/lib/Archive/TestBase.php @@ -30,7 +30,7 @@ abstract class TestBase extends \Test\TestCase { $allFiles=$this->instance->getFiles(); $expected=['lorem.txt','logo-wide.png','dir/', 'dir/lorem.txt']; $this->assertEquals(4, count($allFiles), 'only found '.count($allFiles).' out of 4 expected files'); - foreach($expected as $file) { + foreach ($expected as $file) { $this->assertContains($file, $allFiles, 'cant find '. $file . ' in archive'); $this->assertTrue($this->instance->fileExists($file), 'file '.$file.' does not exist in archive'); } @@ -39,14 +39,14 @@ abstract class TestBase extends \Test\TestCase { $rootContent=$this->instance->getFolder(''); $expected=['lorem.txt','logo-wide.png', 'dir/']; $this->assertEquals(3, count($rootContent)); - foreach($expected as $file) { + foreach ($expected as $file) { $this->assertContains($file, $rootContent, 'cant find '. $file . ' in archive'); } $dirContent=$this->instance->getFolder('dir/'); $expected=['lorem.txt']; $this->assertEquals(1, count($dirContent)); - foreach($expected as $file) { + foreach ($expected as $file) { $this->assertContains($file, $dirContent, 'cant find '. $file . ' in archive'); } } diff --git a/tests/lib/Authentication/Events/RemoteWipeFinishedTest.php b/tests/lib/Authentication/Events/RemoteWipeFinishedTest.php index 4d64a1c216a..f28f0ef78bb 100644 --- a/tests/lib/Authentication/Events/RemoteWipeFinishedTest.php +++ b/tests/lib/Authentication/Events/RemoteWipeFinishedTest.php @@ -30,12 +30,10 @@ use OC\Authentication\Token\IToken; use Test\TestCase; class RemoteWipeFinishedTest extends TestCase { - public function testGetToken() { $token = $this->createMock(IToken::class); $event = new RemoteWipeFinished($token); $this->assertSame($token, $event->getToken()); } - } diff --git a/tests/lib/Authentication/Events/RemoteWipeStartedTest.php b/tests/lib/Authentication/Events/RemoteWipeStartedTest.php index 0a962eafc12..d6b0ef7019e 100644 --- a/tests/lib/Authentication/Events/RemoteWipeStartedTest.php +++ b/tests/lib/Authentication/Events/RemoteWipeStartedTest.php @@ -30,12 +30,10 @@ use OC\Authentication\Token\IToken; use Test\TestCase; class RemoteWipeStartedTest extends TestCase { - public function testGetToken() { $token = $this->createMock(IToken::class); $event = new RemoteWipeStarted($token); $this->assertSame($token, $event->getToken()); } - } diff --git a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php index 35d0ae26080..05d38380026 100644 --- a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php +++ b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php @@ -151,5 +151,4 @@ class RemoteWipeActivityListenerTests extends TestCase { $this->listener->handle($event); } - } diff --git a/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php index 2470e686902..9d2319fb9cc 100644 --- a/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php +++ b/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php @@ -239,5 +239,4 @@ class RemoteWipeEmailListenerTest extends TestCase { $this->listener->handle($event); } - } diff --git a/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php index b582749e645..1e03a344404 100644 --- a/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php +++ b/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php @@ -148,5 +148,4 @@ class RemoteWipeNotificationListenerTests extends TestCase { $this->listener->handle($event); } - } diff --git a/tests/lib/Authentication/Login/ALoginCommandTest.php b/tests/lib/Authentication/Login/ALoginCommandTest.php index f09b649ffcb..03cc7dfadc7 100644 --- a/tests/lib/Authentication/Login/ALoginCommandTest.php +++ b/tests/lib/Authentication/Login/ALoginCommandTest.php @@ -118,5 +118,4 @@ abstract class ALoginCommandTest extends TestCase { $data->setUser($this->user); return $data; } - } diff --git a/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php b/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php index 9c14c2a3fb2..49c81b4f385 100644 --- a/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php +++ b/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php @@ -62,5 +62,4 @@ class ClearLostPasswordTokensCommandTest extends ALoginCommandTest { $this->assertTrue($result->isSuccess()); } - } diff --git a/tests/lib/Authentication/Login/CompleteLoginCommandTest.php b/tests/lib/Authentication/Login/CompleteLoginCommandTest.php index e611611dd7c..7d6152f97a1 100644 --- a/tests/lib/Authentication/Login/CompleteLoginCommandTest.php +++ b/tests/lib/Authentication/Login/CompleteLoginCommandTest.php @@ -62,6 +62,4 @@ class CompleteLoginCommandTest extends ALoginCommandTest { $this->assertTrue($result->isSuccess()); } - - } diff --git a/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php b/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php index 82ae90015a4..9e49413e344 100644 --- a/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php +++ b/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php @@ -117,5 +117,4 @@ class CreateSessionTokenCommandTest extends ALoginCommandTest { $this->assertTrue($result->isSuccess()); $this->assertFalse($data->isRememberLogin()); } - } diff --git a/tests/lib/Authentication/Login/EmailLoginCommandTest.php b/tests/lib/Authentication/Login/EmailLoginCommandTest.php index 5217a4d0080..4c1f0bd0e5b 100644 --- a/tests/lib/Authentication/Login/EmailLoginCommandTest.php +++ b/tests/lib/Authentication/Login/EmailLoginCommandTest.php @@ -161,5 +161,4 @@ class EmailLoginCommandTest extends ALoginCommandTest { $this->assertEquals($emailUser, $data->getUser()); $this->assertEquals('user2', $data->getUsername()); } - } diff --git a/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php b/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php index 9cb3734922e..98df129771a 100644 --- a/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php +++ b/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php @@ -65,5 +65,4 @@ class FinishRememberedLoginCommandTest extends ALoginCommandTest { $this->assertTrue($result->isSuccess()); } - } diff --git a/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php b/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php index 7b47bbf5130..18f4a4938e8 100644 --- a/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php +++ b/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php @@ -69,5 +69,4 @@ class LoggedInCheckCommandTest extends ALoginCommandTest { $this->assertFalse($result->isSuccess()); $this->assertSame(LoginController::LOGIN_MSG_INVALIDPASSWORD, $result->getErrorMessage()); } - } diff --git a/tests/lib/Authentication/Login/PreLoginHookCommandTest.php b/tests/lib/Authentication/Login/PreLoginHookCommandTest.php index c067899ffc2..66822291ba8 100644 --- a/tests/lib/Authentication/Login/PreLoginHookCommandTest.php +++ b/tests/lib/Authentication/Login/PreLoginHookCommandTest.php @@ -62,5 +62,4 @@ class PreLoginHookCommandTest extends ALoginCommandTest { $this->assertTrue($result->isSuccess()); } - } diff --git a/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php b/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php index 14da73b93fa..88514fec237 100644 --- a/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php +++ b/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php @@ -86,5 +86,4 @@ class SetUserTimezoneCommandTest extends ALoginCommandTest { $this->assertTrue($result->isSuccess()); } - } diff --git a/tests/lib/Authentication/Login/TwoFactorCommandTest.php b/tests/lib/Authentication/Login/TwoFactorCommandTest.php index 3e8ad142cc1..4796aecad2e 100644 --- a/tests/lib/Authentication/Login/TwoFactorCommandTest.php +++ b/tests/lib/Authentication/Login/TwoFactorCommandTest.php @@ -355,5 +355,4 @@ class TwoFactorCommandTest extends ALoginCommandTest { $this->assertTrue($result->isSuccess()); $this->assertEquals('two/factor/url', $result->getRedirectUrl()); } - } diff --git a/tests/lib/Authentication/Login/UidLoginCommandTest.php b/tests/lib/Authentication/Login/UidLoginCommandTest.php index 1d477921677..6e22609631d 100644 --- a/tests/lib/Authentication/Login/UidLoginCommandTest.php +++ b/tests/lib/Authentication/Login/UidLoginCommandTest.php @@ -75,5 +75,4 @@ class UidLoginCommandTest extends ALoginCommandTest { $this->assertTrue($result->isSuccess()); $this->assertEquals($this->user, $data->getUser()); } - } diff --git a/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php b/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php index b66ecdde3c4..3db23d471ec 100644 --- a/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php +++ b/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php @@ -60,5 +60,4 @@ class UpdateLastPasswordConfirmCommandTest extends ALoginCommandTest { $this->assertTrue($result->isSuccess()); } - } diff --git a/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php b/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php index 2a2f23162bf..e6f619aac0f 100644 --- a/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php +++ b/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php @@ -93,5 +93,4 @@ class UserDisabledCheckCommandTest extends ALoginCommandTest { $this->assertTrue($result->isSuccess()); } - } diff --git a/tests/lib/Authentication/LoginCredentials/CredentialsTest.php b/tests/lib/Authentication/LoginCredentials/CredentialsTest.php index 263db1bbb5b..d3dcd9f4d6b 100644 --- a/tests/lib/Authentication/LoginCredentials/CredentialsTest.php +++ b/tests/lib/Authentication/LoginCredentials/CredentialsTest.php @@ -62,5 +62,4 @@ class CredentialsTest extends TestCase { public function testGetPassword() { $this->assertEquals($this->password, $this->credentials->getPassword()); } - } diff --git a/tests/lib/Authentication/LoginCredentials/StoreTest.php b/tests/lib/Authentication/LoginCredentials/StoreTest.php index b75e1498889..e7b9cb5996f 100644 --- a/tests/lib/Authentication/LoginCredentials/StoreTest.php +++ b/tests/lib/Authentication/LoginCredentials/StoreTest.php @@ -179,5 +179,4 @@ class StoreTest extends TestCase { $this->store->getLoginCredentials(); } - } diff --git a/tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php b/tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php index e4bc13fe5fb..0991c8b1fc8 100644 --- a/tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php +++ b/tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php @@ -49,5 +49,4 @@ class DefaultTokenCleanupJobTest extends TestCase { ->with(); $this->invokePrivate($this->job, 'run', [null]); } - } diff --git a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php index 7060dc2a770..855e90ab6b9 100644 --- a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php +++ b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php @@ -230,5 +230,4 @@ class DefaultTokenMapperTest extends TestCase { $this->mapper->deleteByName($name); $this->assertEquals(2, $this->getNumberOfTokens()); } - } diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php index a1287680317..d95e4c0418d 100644 --- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php +++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php @@ -449,7 +449,6 @@ class DefaultTokenProviderTest extends TestCase { } catch (ExpiredTokenException $e) { $this->assertSame($token, $e->getToken()); } - } public function testGetTokenById() { diff --git a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php index fc1c71e4511..5ba7fe7c40e 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php @@ -266,5 +266,4 @@ class PublicKeyTokenMapperTest extends TestCase { $this->assertFalse($this->mapper->hasExpiredTokens('user1')); $this->assertTrue($this->mapper->hasExpiredTokens('user3')); } - } diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php index 357200e24b4..43ae0e9542c 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php @@ -389,7 +389,6 @@ class PublicKeyTokenProviderTest extends TestCase { } catch (ExpiredTokenException $e) { $this->assertSame($actual, $e->getToken()); } - } public function testGetTokenById() { diff --git a/tests/lib/Authentication/Token/RemoteWipeTest.php b/tests/lib/Authentication/Token/RemoteWipeTest.php index 11be7590459..1338931ac72 100644 --- a/tests/lib/Authentication/Token/RemoteWipeTest.php +++ b/tests/lib/Authentication/Token/RemoteWipeTest.php @@ -187,5 +187,4 @@ class RemoteWipeTest extends TestCase { $this->assertTrue($result); } - } diff --git a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php index 50a74a6424e..1a21ee047df 100644 --- a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php @@ -159,5 +159,4 @@ class ProviderUserAssignmentDaoTest extends TestCase { $this->assertCount(1, $statesUser1); $this->assertCount(0, $statesUser2); } - } diff --git a/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php b/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php index 0508c84787c..f8c4be09a6f 100644 --- a/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php @@ -33,7 +33,6 @@ use OC\Authentication\TwoFactorAuth\EnforcementState; use Test\TestCase; class EnforcementStateTest extends TestCase { - public function testIsEnforced() { $state = new EnforcementState(true); diff --git a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php index e1e401e7683..5147d763daf 100644 --- a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php @@ -194,5 +194,4 @@ class MandatoryTwoFactorTest extends TestCase { $this->mandatoryTwoFactor->setState(new EnforcementState(false)); } - } diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php index 20f7a57d367..b77bddcd5a4 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php @@ -98,5 +98,4 @@ class ProviderLoaderTest extends TestCase { $this->assertArrayHasKey('test', $providers); $this->assertSame($provider, $providers['test']); } - } diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php index e34d844c3a4..0c85d0cf1ba 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php @@ -150,5 +150,4 @@ class ProviderManagerTest extends TestCase { $this->assertTrue($res); } - } diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderSetTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderSetTest.php index c5d2b356a2c..ef221851894 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ProviderSetTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ProviderSetTest.php @@ -90,5 +90,4 @@ class ProviderSetTest extends TestCase { $this->assertTrue($set->isProviderMissing()); } - } diff --git a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php index 5b2aa654f11..49f4eaa7020 100644 --- a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php @@ -127,5 +127,4 @@ class RegistryTest extends TestCase { $this->registry->cleanUp('twofactor_u2f'); } - } diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php index d3e36954cee..e3e0bd1d64e 100644 --- a/tests/lib/Avatar/UserAvatarTest.php +++ b/tests/lib/Avatar/UserAvatarTest.php @@ -259,7 +259,7 @@ class UserAvatarTest extends \Test\TestCase { $colorTo = new \OC\Color(6,12,18); $steps = 6; $palette = $this->invokePrivate($this->avatar, 'mixPalette', [$steps, $colorFrom, $colorTo]); - foreach($palette as $j => $color) { + foreach ($palette as $j => $color) { // calc increment $incR = $colorTo->r / $steps * $j; $incG = $colorTo->g / $steps * $j; @@ -271,15 +271,13 @@ class UserAvatarTest extends \Test\TestCase { $this->assertTrue(gettype($hashToInt) === 'integer'); } - private function getUserWithDisplayName($name) - { + private function getUserWithDisplayName($name) { $user = $this->createMock(User::class); $user->method('getDisplayName')->willReturn($name); return $user; } - private function getUserAvatar($user) - { + private function getUserAvatar($user) { /** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject $l */ $l = $this->createMock(IL10N::class); $l->method('t')->willReturnArgument(0); @@ -292,5 +290,4 @@ class UserAvatarTest extends \Test\TestCase { $this->config ); } - } diff --git a/tests/lib/Cache/TestCache.php b/tests/lib/Cache/TestCache.php index 62341a5698b..b7aa01f350f 100644 --- a/tests/lib/Cache/TestCache.php +++ b/tests/lib/Cache/TestCache.php @@ -15,7 +15,7 @@ abstract class TestCache extends \Test\TestCase { protected $instance; protected function tearDown(): void { - if($this->instance) { + if ($this->instance) { $this->instance->clear(); } diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php index 5f98188799b..3a2c10b6d62 100644 --- a/tests/lib/Calendar/ManagerTest.php +++ b/tests/lib/Calendar/ManagerTest.php @@ -210,5 +210,4 @@ class ManagerTest extends TestCase { $isEnabled = $this->manager->isEnabled(); $this->assertTrue($isEnabled); } - } diff --git a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php index ac84ef04d33..909a11596a3 100644 --- a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php @@ -429,7 +429,6 @@ class GroupPluginTest extends TestCase { false, ], ]; - } /** @@ -459,8 +458,7 @@ class GroupPluginTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->willReturnCallback( - function ($appName, $key, $default) use ($shareWithGroupOnly, $shareeEnumeration) - { + function ($appName, $key, $default) use ($shareWithGroupOnly, $shareeEnumeration) { if ($appName === 'core' && $key === 'shareapi_only_share_with_group_members') { return $shareWithGroupOnly ? 'yes' : 'no'; } elseif ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php index f2d4ce0cf70..613208d27b1 100644 --- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php @@ -86,8 +86,7 @@ class MailPluginTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->willReturnCallback( - function ($appName, $key, $default) use ($shareeEnumeration) - { + function ($appName, $key, $default) use ($shareeEnumeration) { if ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { return $shareeEnumeration ? 'yes' : 'no'; } diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php index d85fadad408..a651d4ec1d4 100644 --- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php +++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php @@ -92,8 +92,7 @@ class RemotePluginTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->willReturnCallback( - function ($appName, $key, $default) use ($shareeEnumeration) - { + function ($appName, $key, $default) use ($shareeEnumeration) { if ($appName === 'core' && $key === 'shareapi_allow_share_dialog_user_enumeration') { return $shareeEnumeration ? 'yes' : 'no'; } diff --git a/tests/lib/Collaboration/Collaborators/SearchResultTest.php b/tests/lib/Collaboration/Collaborators/SearchResultTest.php index 45ce0b4c1b8..84d270de547 100644 --- a/tests/lib/Collaboration/Collaborators/SearchResultTest.php +++ b/tests/lib/Collaboration/Collaborators/SearchResultTest.php @@ -98,5 +98,4 @@ class SearchResultTest extends TestCase { $this->assertSame($expected, $result->hasResult(new SearchResultType($type), $id)); } - } diff --git a/tests/lib/Collaboration/Collaborators/SearchTest.php b/tests/lib/Collaboration/Collaborators/SearchTest.php index 521ea0737ed..1b68e8eacc1 100644 --- a/tests/lib/Collaboration/Collaborators/SearchTest.php +++ b/tests/lib/Collaboration/Collaborators/SearchTest.php @@ -94,10 +94,10 @@ class SearchTest extends TestCase { $remotePlugin->expects($this->any()) ->method('search') ->willReturnCallback(function () use ($searchResult, $mockedRemotesResult, $expectedMoreResults) { - if($mockedRemotesResult !== null) { + if ($mockedRemotesResult !== null) { $type = new SearchResultType('remotes'); $searchResult->addResultSet($type, $mockedRemotesResult['results'], $mockedRemotesResult['exact']); - if($mockedRemotesResult['exactIdMatch'] === true) { + if ($mockedRemotesResult['exactIdMatch'] === true) { $searchResult->markExactIdMatch($type); } } @@ -107,7 +107,7 @@ class SearchTest extends TestCase { $this->container->expects($this->any()) ->method('resolve') ->willReturnCallback(function ($class) use ($searchResult, $userPlugin, $groupPlugin, $remotePlugin) { - if($class === SearchResult::class) { + if ($class === SearchResult::class) { return $searchResult; } elseif ($class === $userPlugin) { return $userPlugin; diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php index bba061f8e2b..07bcce93529 100644 --- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php @@ -105,7 +105,6 @@ class UserPluginTest extends TestCase { return $default; } ); - } public function getUserMock($uid, $displayName, $enabled = true, $groups = []) { diff --git a/tests/lib/Command/BackgroundJobsTest.php b/tests/lib/Command/BackgroundJobsTest.php index 972daf51a7a..9d1741aff88 100644 --- a/tests/lib/Command/BackgroundJobsTest.php +++ b/tests/lib/Command/BackgroundJobsTest.php @@ -34,7 +34,6 @@ use Symfony\Component\Console\Output\NullOutput; use Test\TestCase; class BackgroundJobsTest extends TestCase { - public function testCronCommand() { $config = \OC::$server->getConfig(); $job = new Cron($config); diff --git a/tests/lib/Comments/CommentTest.php b/tests/lib/Comments/CommentTest.php index 733597c2b4c..245ca9693ea 100644 --- a/tests/lib/Comments/CommentTest.php +++ b/tests/lib/Comments/CommentTest.php @@ -174,11 +174,11 @@ class CommentTest extends TestCase { public function testMentions(string $message, array $expectedUids, ?string $author = null, array $expectedGuests = []): void { $comment = new Comment(); $comment->setMessage($message); - if(!is_null($author)) { + if (!is_null($author)) { $comment->setActor('user', $author); } $mentions = $comment->getMentions(); - while($mention = array_shift($mentions)) { + while ($mention = array_shift($mentions)) { if ($mention['type'] === 'user') { $id = array_shift($expectedUids); } elseif ($mention['type'] === 'guest') { @@ -192,7 +192,4 @@ class CommentTest extends TestCase { $this->assertEmpty($mentions); $this->assertEmpty($expectedUids); } - - - } diff --git a/tests/lib/Comments/FakeFactory.php b/tests/lib/Comments/FakeFactory.php index ff8dfd3a259..257e7dad93b 100644 --- a/tests/lib/Comments/FakeFactory.php +++ b/tests/lib/Comments/FakeFactory.php @@ -8,7 +8,6 @@ use OCP\IServerContainer; * Class FakeFactory */ class FakeFactory implements \OCP\Comments\ICommentsManagerFactory { - public function __construct(IServerContainer $serverContainer) { } diff --git a/tests/lib/Comments/FakeManager.php b/tests/lib/Comments/FakeManager.php index 5b74b54de50..b165b01c3c2 100644 --- a/tests/lib/Comments/FakeManager.php +++ b/tests/lib/Comments/FakeManager.php @@ -10,10 +10,11 @@ use OCP\IUser; * Class FakeManager */ class FakeManager implements ICommentsManager { + public function get($id) { + } - public function get($id) {} - - public function getTree($id, $limit = 0, $offset = 0) {} + public function getTree($id, $limit = 0, $offset = 0) { + } public function getForObject( $objectType, @@ -21,7 +22,8 @@ class FakeManager implements ICommentsManager { $limit = 0, $offset = 0, \DateTime $notOlderThan = null - ) {} + ) { + } public function getForObjectSince( string $objectType, @@ -29,39 +31,56 @@ class FakeManager implements ICommentsManager { int $lastKnownCommentId, string $sortDirection = 'asc', int $limit = 30 - ): array { return []; } + ): array { + return []; + } - public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null, $verb = '') {} + public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null, $verb = '') { + } public function search(string $search, string $objectType, string $objectId, string $verb, int $offset, int $limit = 50): array { return []; } - public function create($actorType, $actorId, $objectType, $objectId) {} + public function create($actorType, $actorId, $objectType, $objectId) { + } - public function delete($id) {} + public function delete($id) { + } - public function save(IComment $comment) {} + public function save(IComment $comment) { + } - public function deleteReferencesOfActor($actorType, $actorId) {} + public function deleteReferencesOfActor($actorType, $actorId) { + } - public function deleteCommentsAtObject($objectType, $objectId) {} + public function deleteCommentsAtObject($objectType, $objectId) { + } - public function setReadMark($objectType, $objectId, \DateTime $dateTime, IUser $user) {} + public function setReadMark($objectType, $objectId, \DateTime $dateTime, IUser $user) { + } - public function getReadMark($objectType, $objectId, IUser $user) {} + public function getReadMark($objectType, $objectId, IUser $user) { + } - public function deleteReadMarksFromUser(IUser $user) {} + public function deleteReadMarksFromUser(IUser $user) { + } - public function deleteReadMarksOnObject($objectType, $objectId) {} + public function deleteReadMarksOnObject($objectType, $objectId) { + } - public function registerEventHandler(\Closure $closure) {} + public function registerEventHandler(\Closure $closure) { + } - public function registerDisplayNameResolver($type, \Closure $closure) {} + public function registerDisplayNameResolver($type, \Closure $closure) { + } - public function resolveDisplayName($type, $id) {} + public function resolveDisplayName($type, $id) { + } - public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user) {} + public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user) { + } - public function getActorsInTree($id) {} + public function getActorsInTree($id) { + } } diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php index 9ae49d62f33..e2bf6180709 100644 --- a/tests/lib/Comments/ManagerTest.php +++ b/tests/lib/Comments/ManagerTest.php @@ -863,5 +863,4 @@ class ManagerTest extends TestCase { $manager->registerDisplayNameResolver('planet', $planetClosure); $this->assertTrue(is_string($manager->resolveDisplayName(1337, 'neptune'))); } - } diff --git a/tests/lib/ConfigTest.php b/tests/lib/ConfigTest.php index 58144b2c26a..d5e8bd28bb3 100644 --- a/tests/lib/ConfigTest.php +++ b/tests/lib/ConfigTest.php @@ -159,5 +159,4 @@ class ConfigTest extends TestCase { // Cleanup unlink($additionalConfigPath); } - } diff --git a/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php b/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php index 8e7f64ff9d1..d858eab4d11 100644 --- a/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php +++ b/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php @@ -63,5 +63,4 @@ class ActionFactoryTest extends TestCase { $this->assertEquals(10, $action->getPriority()); $this->assertEquals('mailto:user@example.com', $action->getHref()); } - } diff --git a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php index 6883ed2f98c..ee053ce40e5 100644 --- a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php +++ b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php @@ -129,5 +129,4 @@ class ActionProviderStoreTest extends TestCase { $this->actionProviderStore->getProviders($user); } - } diff --git a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php index da2d6ac4517..ed6e9ace403 100644 --- a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php +++ b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php @@ -28,7 +28,6 @@ use OC\Contacts\ContactsMenu\Actions\LinkAction; use Test\TestCase; class LinkActionTest extends TestCase { - private $action; protected function setUp(): void { @@ -86,5 +85,4 @@ class LinkActionTest extends TestCase { $this->assertEquals($expected, $json); } - } diff --git a/tests/lib/Contacts/ContactsMenu/EntryTest.php b/tests/lib/Contacts/ContactsMenu/EntryTest.php index 1ea4782a301..a8dd7fdc508 100644 --- a/tests/lib/Contacts/ContactsMenu/EntryTest.php +++ b/tests/lib/Contacts/ContactsMenu/EntryTest.php @@ -110,5 +110,4 @@ class EntryTest extends TestCase { $this->assertEquals($expectedJson, $json); } - } diff --git a/tests/lib/Contacts/ContactsMenu/ManagerTest.php b/tests/lib/Contacts/ContactsMenu/ManagerTest.php index b78420e5424..561051974b7 100644 --- a/tests/lib/Contacts/ContactsMenu/ManagerTest.php +++ b/tests/lib/Contacts/ContactsMenu/ManagerTest.php @@ -222,5 +222,4 @@ class ManagerTest extends TestCase { $this->assertEquals(null, $data); } - } diff --git a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php index ac90260d161..157f8574fa4 100644 --- a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php +++ b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php @@ -102,5 +102,4 @@ class EMailproviderTest extends TestCase { $this->provider->process($entry); } - } diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php index 099f27ce07b..4699d894e4b 100644 --- a/tests/lib/ContactsManagerTest.php +++ b/tests/lib/ContactsManagerTest.php @@ -146,7 +146,6 @@ class ContactsManagerTest extends \Test\TestCase { $this->cm->registerAddressBook($addressbook); $result = $this->cm->delete(1, 'noaddressbook'); $this->assertEquals($result, null); - } public function testCreateOrUpdateHavePermission() { @@ -184,7 +183,6 @@ class ContactsManagerTest extends \Test\TestCase { $this->cm->registerAddressBook($addressbook); $result = $this->cm->createOrUpdate([], $addressbook->getKey()); $this->assertEquals($result, null); - } public function testCreateOrUpdateNOAdressbook() { diff --git a/tests/lib/DB/ConnectionFactoryTest.php b/tests/lib/DB/ConnectionFactoryTest.php index 6a1a9b31c4b..de232bb1fdd 100644 --- a/tests/lib/DB/ConnectionFactoryTest.php +++ b/tests/lib/DB/ConnectionFactoryTest.php @@ -26,7 +26,6 @@ use OC\SystemConfig; use Test\TestCase; class ConnectionFactoryTest extends TestCase { - public function splitHostFromPortAndSocketData() { return [ ['127.0.0.1', ['host' => '127.0.0.1']], diff --git a/tests/lib/DB/ConnectionTest.php b/tests/lib/DB/ConnectionTest.php index 607674d7a38..c8b2b7ee13e 100644 --- a/tests/lib/DB/ConnectionTest.php +++ b/tests/lib/DB/ConnectionTest.php @@ -213,7 +213,7 @@ class ConnectionTest extends \Test\TestCase { ['user' => 'test2', 'category' => 'Coworkers', 'expectedResult' => 1], ]; - foreach($categoryEntries as $entry) { + foreach ($categoryEntries as $entry) { $result = $this->connection->insertIfNotExist('*PREFIX*table', [ 'textfield' => $entry['user'], @@ -236,7 +236,7 @@ class ConnectionTest extends \Test\TestCase { ['addressbookid' => 123, 'fullname' => 'test', 'expectedResult' => 1], ]; - foreach($categoryEntries as $entry) { + foreach ($categoryEntries as $entry) { $result = $this->connection->insertIfNotExist('*PREFIX*table', [ 'integerfield_default' => $entry['addressbookid'], @@ -347,5 +347,4 @@ class ConnectionTest extends \Test\TestCase { $this->connection->executeUpdate($testQuery, $testParams); $this->connection->executeUpdate($testQuery, $testParams); } - } diff --git a/tests/lib/DB/MDB2SchemaManagerTest.php b/tests/lib/DB/MDB2SchemaManagerTest.php index d83131a685f..18af9716502 100644 --- a/tests/lib/DB/MDB2SchemaManagerTest.php +++ b/tests/lib/DB/MDB2SchemaManagerTest.php @@ -19,7 +19,6 @@ use Doctrine\DBAL\Platforms\OraclePlatform; * @package Test\DB */ class MDB2SchemaManagerTest extends \Test\TestCase { - protected function tearDown(): void { // do not drop the table for Oracle as it will create a bogus transaction // that will break the following test suites requiring transactions @@ -31,7 +30,6 @@ class MDB2SchemaManagerTest extends \Test\TestCase { } public function testAutoIncrement() { - $connection = \OC::$server->getDatabaseConnection(); if ($connection->getDatabasePlatform() instanceof OraclePlatform) { $this->markTestSkipped('Adding auto increment columns in Oracle is not supported.'); @@ -48,5 +46,4 @@ class MDB2SchemaManagerTest extends \Test\TestCase { $this->addToAssertionCount(1); } - } diff --git a/tests/lib/DB/MigrationsTest.php b/tests/lib/DB/MigrationsTest.php index 52e849fd0a8..c4e9b1857fb 100644 --- a/tests/lib/DB/MigrationsTest.php +++ b/tests/lib/DB/MigrationsTest.php @@ -92,7 +92,6 @@ class MigrationsTest extends \Test\TestCase { } public function testExecuteStepWithSchemaChange() { - $schema = $this->createMock(Schema::class); $this->db->expects($this->any()) ->method('createSchema') @@ -136,7 +135,6 @@ class MigrationsTest extends \Test\TestCase { } public function testExecuteStepWithoutSchemaChange() { - $schema = $this->createMock(Schema::class); $this->db->expects($this->any()) ->method('createSchema') diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php index a438d0189df..b5021dcccf9 100644 --- a/tests/lib/DB/MigratorTest.php +++ b/tests/lib/DB/MigratorTest.php @@ -65,11 +65,13 @@ class MigratorTest extends \Test\TestCase { // Try to delete if exists (IF EXISTS NOT SUPPORTED IN ORACLE) try { $this->connection->exec('DROP TABLE ' . $this->connection->quoteIdentifier($this->tableNameTmp)); - } catch (\Doctrine\DBAL\DBALException $e) {} + } catch (\Doctrine\DBAL\DBALException $e) { + } try { $this->connection->exec('DROP TABLE ' . $this->connection->quoteIdentifier($this->tableName)); - } catch (\Doctrine\DBAL\DBALException $e) {} + } catch (\Doctrine\DBAL\DBALException $e) { + } parent::tearDown(); } diff --git a/tests/lib/DB/MySqlMigrationTest.php b/tests/lib/DB/MySqlMigrationTest.php index 5ebbd273c33..36ab8ef7319 100644 --- a/tests/lib/DB/MySqlMigrationTest.php +++ b/tests/lib/DB/MySqlMigrationTest.php @@ -45,5 +45,4 @@ class MySqlMigrationTest extends \Test\TestCase { $this->addToAssertionCount(1); } - } diff --git a/tests/lib/DB/OCPostgreSqlPlatformTest.php b/tests/lib/DB/OCPostgreSqlPlatformTest.php index 54701bdcec9..0821a988eb5 100644 --- a/tests/lib/DB/OCPostgreSqlPlatformTest.php +++ b/tests/lib/DB/OCPostgreSqlPlatformTest.php @@ -37,7 +37,6 @@ use Doctrine\DBAL\Types\Type; * @package Test\DB */ class OCPostgreSqlPlatformTest extends \Test\TestCase { - public function testAlterBigint() { $platform = new PostgreSqlPlatform(); $sourceSchema = new Schema(); @@ -71,5 +70,4 @@ class OCPostgreSqlPlatformTest extends \Test\TestCase { 'length' => 11, ]); } - } diff --git a/tests/lib/DB/SchemaDiffTest.php b/tests/lib/DB/SchemaDiffTest.php index c98cf173d8f..29d456805d5 100644 --- a/tests/lib/DB/SchemaDiffTest.php +++ b/tests/lib/DB/SchemaDiffTest.php @@ -71,7 +71,6 @@ class SchemaDiffTest extends TestCase { * @param string $xml */ public function testZeroChangeOnSchemaMigrations($xml) { - $xml = str_replace('*dbprefix*', $this->testPrefix, $xml); $schemaFile = $this->schemaFile; file_put_contents($schemaFile, $xml); diff --git a/tests/lib/DB/SqliteMigrationTest.php b/tests/lib/DB/SqliteMigrationTest.php index ecc6cbe0951..480a5ebe74f 100644 --- a/tests/lib/DB/SqliteMigrationTest.php +++ b/tests/lib/DB/SqliteMigrationTest.php @@ -45,5 +45,4 @@ class SqliteMigrationTest extends \Test\TestCase { $this->addToAssertionCount(1); } - } diff --git a/tests/lib/Diagnostics/EventLoggerTest.php b/tests/lib/Diagnostics/EventLoggerTest.php index 323ca5c20d7..c26ca2ce202 100644 --- a/tests/lib/Diagnostics/EventLoggerTest.php +++ b/tests/lib/Diagnostics/EventLoggerTest.php @@ -61,6 +61,5 @@ class EventLoggerTest extends TestCase { $this->assertSame("test3", $events['test3']->getId()); $this->assertSame("testevent3", $events['test3']->getDescription()); $this->assertSame(2, sizeof($events)); - } } diff --git a/tests/lib/Diagnostics/QueryLoggerTest.php b/tests/lib/Diagnostics/QueryLoggerTest.php index 545a706c3cf..50d62d3d0e6 100644 --- a/tests/lib/Diagnostics/QueryLoggerTest.php +++ b/tests/lib/Diagnostics/QueryLoggerTest.php @@ -49,6 +49,5 @@ class QueryLoggerTest extends TestCase { $queries = $this->logger->getQueries(); $this->assertSame(1, sizeof($queries)); - } } diff --git a/tests/lib/DirectEditing/ManagerTest.php b/tests/lib/DirectEditing/ManagerTest.php index ef72a4e81d3..84685d3a16b 100644 --- a/tests/lib/DirectEditing/ManagerTest.php +++ b/tests/lib/DirectEditing/ManagerTest.php @@ -21,8 +21,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class CreateEmpty extends ACreateEmpty { - - public function getId(): string { + public function getId(): string { return 'createEmpty'; } @@ -34,16 +33,15 @@ class CreateEmpty extends ACreateEmpty { return '.txt'; } - public function getMimetype(): string { + public function getMimetype(): string { return 'text/plain'; } } class Editor implements IEditor { - - public function getId(): string { + public function getId(): string { return 'testeditor'; - } + } public function getName(): string { return 'Test editor'; @@ -81,7 +79,6 @@ class Editor implements IEditor { * @group DB */ class ManagerTest extends TestCase { - private $manager; /** * @var Editor @@ -194,5 +191,4 @@ class ManagerTest extends TestCase { $this->manager->create('/File.txt', 'testeditor', 'createEmpty'); } - } diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index 8e53c4a92e1..3a16327ac18 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -107,7 +107,6 @@ class DecryptAllTest extends TestCase { * @param bool $userExistsChecked */ public function testDecryptAll($prepareResult, $user, $userExistsChecked) { - if ($userExistsChecked) { $this->userManager->expects($this->once())->method('userExists')->willReturn(true); } else { @@ -166,7 +165,6 @@ class DecryptAllTest extends TestCase { * @param bool $success */ public function testPrepareEncryptionModules($success) { - $user = 'user1'; $dummyEncryptionModule = $this->getMockBuilder('OCP\Encryption\IEncryptionModule') @@ -177,7 +175,9 @@ class DecryptAllTest extends TestCase { ->with($this->inputInterface, $this->outputInterface, $user) ->willReturn($success); - $callback = function () use ($dummyEncryptionModule) {return $dummyEncryptionModule;}; + $callback = function () use ($dummyEncryptionModule) { + return $dummyEncryptionModule; + }; $moduleDescription = [ 'id' => 'id', 'displayName' => 'displayName', @@ -305,14 +305,12 @@ class DecryptAllTest extends TestCase { $progressBar = new ProgressBar($output); $this->invokePrivate($instance, 'decryptUsersFiles', ['user1', $progressBar, '']); - } /** * @dataProvider dataTrueFalse */ public function testDecryptFile($isEncrypted) { - $path = 'test.txt'; /** @var DecryptAll | \PHPUnit_Framework_MockObject_MockObject $instance */ @@ -379,7 +377,9 @@ class DecryptAllTest extends TestCase { $this->view->expects($this->once()) ->method('copy') ->with($path, $path . '.decrypted.42') - ->willReturnCallback(function () { throw new DecryptionFailedException();}); + ->willReturnCallback(function () { + throw new DecryptionFailedException(); + }); $this->view->expects($this->never())->method('rename'); $this->view->expects($this->once()) @@ -394,5 +394,4 @@ class DecryptAllTest extends TestCase { $this->invokePrivate($instance, 'decryptFile', [$path]) ); } - } diff --git a/tests/lib/Encryption/EncryptionWrapperTest.php b/tests/lib/Encryption/EncryptionWrapperTest.php index 3fc18817327..06d9116255f 100644 --- a/tests/lib/Encryption/EncryptionWrapperTest.php +++ b/tests/lib/Encryption/EncryptionWrapperTest.php @@ -93,5 +93,4 @@ class EncryptionWrapperTest extends TestCase { [false, [Storage\IDisableEncryptionStorage::class]], ]; } - } diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php index 2233c25c8f1..fd33077c78b 100644 --- a/tests/lib/Encryption/Keys/StorageTest.php +++ b/tests/lib/Encryption/Keys/StorageTest.php @@ -339,7 +339,7 @@ class StorageTest extends TestCase { $this->util->expects($this->any()) ->method('isSystemWideMountPoint') ->willReturnCallback(function ($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { - if(strpos($path, 'source.txt') !== false) { + if (strpos($path, 'source.txt') !== false) { return $systemWideMountSource; } return $systemWideMountTarget; @@ -370,7 +370,7 @@ class StorageTest extends TestCase { $this->util->expects($this->any()) ->method('isSystemWideMountPoint') ->willReturnCallback(function ($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { - if(strpos($path, 'source.txt') !== false) { + if (strpos($path, 'source.txt') !== false) { return $systemWideMountSource; } return $systemWideMountTarget; @@ -427,7 +427,6 @@ class StorageTest extends TestCase { * @param string $expected */ public function testGetPathToKeys($path, $systemWideMountPoint, $storageRoot, $expected) { - $this->invokePrivate($this->storage, 'root_dir', [$storageRoot]); $this->util->expects($this->any()) @@ -485,7 +484,6 @@ class StorageTest extends TestCase { * @param string $expected */ public function testGetFileKeyDir($isSystemWideMountPoint, $storageRoot, $expected) { - $path = '/user1/files/foo/bar.txt'; $owner = 'user1'; $relativePath = '/foo/bar.txt'; @@ -500,7 +498,6 @@ class StorageTest extends TestCase { $this->assertSame($expected, $this->invokePrivate($this->storage, 'getFileKeyDir', ['OC_DEFAULT_MODULE', $path]) ); - } public function dataTestGetFileKeyDir() { @@ -518,7 +515,6 @@ class StorageTest extends TestCase { * @param bool $createBackupDir */ public function testBackupUserKeys($createBackupDir) { - $storage = $this->getMockBuilder('OC\Encryption\Keys\Storage') ->setConstructorArgs([$this->view, $this->util]) ->setMethods(['getTimestamp']) @@ -546,7 +542,6 @@ class StorageTest extends TestCase { )->willReturn(true); $this->assertTrue($storage->backupUserKeys('encryptionModule', 'test', 'user1')); - } public function dataTestBackupUserKeys() { @@ -554,5 +549,4 @@ class StorageTest extends TestCase { [true], [false] ]; } - } diff --git a/tests/lib/Encryption/ManagerTest.php b/tests/lib/Encryption/ManagerTest.php index 5a34e9cb392..47dd7fd01fb 100644 --- a/tests/lib/Encryption/ManagerTest.php +++ b/tests/lib/Encryption/ManagerTest.php @@ -60,7 +60,9 @@ class ManagerTest extends TestCase { $em = $this->createMock(IEncryptionModule::class); $em->expects($this->any())->method('getId')->willReturn('id'); $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0'); - $this->manager->registerEncryptionModule('id', 'TestDummyModule0', function () use ($em) {return $em;}); + $this->manager->registerEncryptionModule('id', 'TestDummyModule0', function () use ($em) { + return $em; + }); $this->assertFalse($this->manager->isEnabled()); } @@ -96,7 +98,6 @@ class ManagerTest extends TestCase { $this->manager->unregisterEncryptionModule('ID0'); $this->assertEmpty($this->manager->getEncryptionModules()); - } @@ -117,7 +118,10 @@ class ManagerTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->with('core', 'default_encryption_module') - ->willReturnCallback(function () { global $defaultId; return $defaultId; }); + ->willReturnCallback(function () { + global $defaultId; + return $defaultId; + }); $this->addNewEncryptionModule($this->manager, 0); $this->assertCount(1, $this->manager->getEncryptionModules()); @@ -138,7 +142,10 @@ class ManagerTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->with('core', 'default_encryption_module') - ->willReturnCallback(function () { global $defaultId; return $defaultId; }); + ->willReturnCallback(function () { + global $defaultId; + return $defaultId; + }); $this->addNewEncryptionModule($this->manager, 0); $defaultId = 'ID0'; @@ -160,7 +167,10 @@ class ManagerTest extends TestCase { $this->config->expects($this->any()) ->method('getAppValue') ->with('core', 'default_encryption_module') - ->willReturnCallback(function () { global $defaultId; return $defaultId; }); + ->willReturnCallback(function () { + global $defaultId; + return $defaultId; + }); $this->addNewEncryptionModule($this->manager, 0); $this->assertCount(1, $this->manager->getEncryptionModules()); diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php index a783c620a5b..d7aa24d1f67 100644 --- a/tests/lib/Encryption/UpdateTest.php +++ b/tests/lib/Encryption/UpdateTest.php @@ -88,7 +88,6 @@ class UpdateTest extends TestCase { * @param integer $numberOfFiles */ public function testUpdate($path, $isDir, $allFiles, $numberOfFiles) { - $this->encryptionManager->expects($this->once()) ->method('getEncryptionModule') ->willReturn($this->encryptionModule); @@ -97,7 +96,7 @@ class UpdateTest extends TestCase { ->method('is_dir') ->willReturn($isDir); - if($isDir) { + if ($isDir) { $this->util->expects($this->once()) ->method('getAllFiles') ->willReturn($allFiles); @@ -134,7 +133,6 @@ class UpdateTest extends TestCase { * @param boolean $encryptionEnabled */ public function testPostRename($source, $target, $encryptionEnabled) { - $updateMock = $this->getUpdateMock(['update', 'getOwnerPath']); $this->encryptionManager->expects($this->once()) @@ -153,7 +151,6 @@ class UpdateTest extends TestCase { $path, 'update needs to be executed for the target destination'); return ['owner', $path]; - }); $updateMock->expects($this->once())->method('update'); } @@ -184,7 +181,6 @@ class UpdateTest extends TestCase { * @param boolean $encryptionEnabled */ public function testPostRestore($encryptionEnabled) { - $updateMock = $this->getUpdateMock(['update']); $this->encryptionManager->expects($this->once()) @@ -193,7 +189,6 @@ class UpdateTest extends TestCase { if ($encryptionEnabled) { $updateMock->expects($this->once())->method('update'); - } else { $updateMock->expects($this->never())->method('update'); } @@ -232,5 +227,4 @@ class UpdateTest extends TestCase { ] )->setMethods($methods)->getMock(); } - } diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php index 0ac474faa0f..e1d898f5a86 100644 --- a/tests/lib/Encryption/UtilTest.php +++ b/tests/lib/Encryption/UtilTest.php @@ -56,7 +56,6 @@ class UtilTest extends TestCase { $this->groupManager, $this->config ); - } /** @@ -79,7 +78,6 @@ class UtilTest extends TestCase { * @dataProvider providesHeaders */ public function testCreateHeader($expected, $header, $moduleId) { - $em = $this->createMock(IEncryptionModule::class); $em->expects($this->any())->method('getId')->willReturn($moduleId); @@ -190,5 +188,4 @@ class UtilTest extends TestCase { ['/foo/test.txt.ocTransferId7567.part', '/foo/test.txt'], ]; } - } diff --git a/tests/lib/ErrorHandlerTest.php b/tests/lib/ErrorHandlerTest.php index 4cea21b4276..32112c19787 100644 --- a/tests/lib/ErrorHandlerTest.php +++ b/tests/lib/ErrorHandlerTest.php @@ -36,7 +36,6 @@ class ErrorHandlerTest extends \Test\TestCase { ['us:er', 'password'], ['user', 'pass:word'], ]; - } /** @@ -51,7 +50,6 @@ class ErrorHandlerTest extends \Test\TestCase { $this->assertEquals($expectedResult, $result); } - } /** diff --git a/tests/lib/FileChunkingTest.php b/tests/lib/FileChunkingTest.php index 7cbabe697a4..23f50a5b6f7 100644 --- a/tests/lib/FileChunkingTest.php +++ b/tests/lib/FileChunkingTest.php @@ -24,7 +24,6 @@ namespace Test; use OCP\ICache; class FileChunkingTest extends \Test\TestCase { - public function dataIsComplete() { return [ [1, [], false], diff --git a/tests/lib/Files/AppData/AppDataTest.php b/tests/lib/Files/AppData/AppDataTest.php index 1b3f705b9b6..a03be9e45e9 100644 --- a/tests/lib/Files/AppData/AppDataTest.php +++ b/tests/lib/Files/AppData/AppDataTest.php @@ -108,5 +108,4 @@ class AppDataTest extends \Test\TestCase { $this->assertCount(1, $result); $this->assertInstanceOf(ISimpleFolder::class, $result[0]); } - } diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php index dff21491052..f3e61e8e820 100644 --- a/tests/lib/Files/Cache/CacheTest.php +++ b/tests/lib/Files/Cache/CacheTest.php @@ -182,7 +182,6 @@ class CacheTest extends \Test\TestCase { } public function folderDataProvider() { - return [ ['folder'], // that was too easy, try something harder @@ -289,7 +288,6 @@ class CacheTest extends \Test\TestCase { * @param $fileName */ public function testPutWithAllKindOfQuotes($fileName) { - $this->assertEquals(\OC\Files\Cache\Cache::NOT_FOUND, $this->cache->get($fileName)); $this->cache->put($fileName, ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file', 'etag' => $fileName]); @@ -573,7 +571,6 @@ class CacheTest extends \Test\TestCase { * this test shows that there is no bug if we use the normalizer */ public function testWithNormalizer() { - if (!class_exists('Patchwork\PHP\Shim\Normalizer')) { $this->markTestSkipped('The 3rdparty Normalizer extension is not available.'); return; diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php index 52f6697cc6d..c51ce0388d5 100644 --- a/tests/lib/Files/Cache/ScannerTest.php +++ b/tests/lib/Files/Cache/ScannerTest.php @@ -406,5 +406,4 @@ class ScannerTest extends \Test\TestCase { ['/sub/folder/foo.txt', false], ]; } - } diff --git a/tests/lib/Files/Cache/UpdaterLegacyTest.php b/tests/lib/Files/Cache/UpdaterLegacyTest.php index 02cb6d79eb1..6d6cc08b3de 100644 --- a/tests/lib/Files/Cache/UpdaterLegacyTest.php +++ b/tests/lib/Files/Cache/UpdaterLegacyTest.php @@ -74,7 +74,9 @@ class UpdaterLegacyTest extends \Test\TestCase { $result = false; $user = \OC::$server->getUserManager()->get(self::$user); - if ($user !== null) { $result = $user->delete(); } + if ($user !== null) { + $result = $user->delete(); + } $this->assertTrue($result); $this->logout(); @@ -304,5 +306,4 @@ class UpdaterLegacyTest extends \Test\TestCase { $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']); $this->assertEquals($time, $cachedData['mtime']); } - } diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php index 5bf998df562..9fc3032fa28 100644 --- a/tests/lib/Files/FilesystemTest.php +++ b/tests/lib/Files/FilesystemTest.php @@ -59,7 +59,6 @@ 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"; @@ -299,7 +298,6 @@ class FilesystemTest extends \Test\TestCase { $userObj = \OC::$server->getUserManager()->get($user); \OC::$server->getUserSession()->setUser($userObj); \OC\Files\Filesystem::init($user, '/' . $user . '/files'); - } \OC_Hook::clear('OC_Filesystem'); \OC_Hook::connect('OC_Filesystem', 'post_write', $this, 'dummyHook'); @@ -396,7 +394,9 @@ class FilesystemTest extends \Test\TestCase { } $user = \OC::$server->getUserManager()->get($userId); - if ($user !== null) { $user->delete(); } + if ($user !== null) { + $user->delete(); + } } public function dummyHook($arguments) { @@ -425,7 +425,9 @@ class FilesystemTest extends \Test\TestCase { $this->assertTrue($storage->instanceOfStorage('\OCP\Files\IHomeStorage')); $this->assertEquals('cache', $internalPath); $user = \OC::$server->getUserManager()->get($userId); - if ($user !== null) { $user->delete(); } + if ($user !== null) { + $user->delete(); + } $config->setSystemValue('cache_path', $oldCachePath); } @@ -454,7 +456,9 @@ class FilesystemTest extends \Test\TestCase { $this->assertTrue($storage->instanceOfStorage('\OC\Files\Storage\Local')); $this->assertEquals('', $internalPath); $user = \OC::$server->getUserManager()->get($userId); - if ($user !== null) { $user->delete(); } + if ($user !== null) { + $user->delete(); + } $config->setSystemValue('cache_path', $oldCachePath); } diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php index 976ccc64d70..106a8f9a932 100644 --- a/tests/lib/Files/Mount/MountPointTest.php +++ b/tests/lib/Files/Mount/MountPointTest.php @@ -12,11 +12,9 @@ use OC\Files\Storage\StorageFactory; use OCP\Files\Storage; class DummyStorage { - } class MountPointTest extends \Test\TestCase { - public function testGetStorage() { $storage = $this->createMock(Storage::class); $storage->expects($this->once()) diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php index c6f468b796b..3fa988c89d8 100644 --- a/tests/lib/Files/Node/FileTest.php +++ b/tests/lib/Files/Node/FileTest.php @@ -287,6 +287,4 @@ class FileTest extends NodeTest { $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->fopen('w'); } - - } diff --git a/tests/lib/Files/ObjectStore/LocalTest.php b/tests/lib/Files/ObjectStore/LocalTest.php index 99aa23e065d..ceb21428e4b 100644 --- a/tests/lib/Files/ObjectStore/LocalTest.php +++ b/tests/lib/Files/ObjectStore/LocalTest.php @@ -32,5 +32,4 @@ class LocalTest extends ObjectStoreTest { $storage = new Temporary(); return new StorageObjectStore($storage); } - } diff --git a/tests/lib/Files/ObjectStore/MapperTest.php b/tests/lib/Files/ObjectStore/MapperTest.php index 50d3cd553aa..307096d8dbc 100644 --- a/tests/lib/Files/ObjectStore/MapperTest.php +++ b/tests/lib/Files/ObjectStore/MapperTest.php @@ -25,7 +25,6 @@ use OC\Files\ObjectStore\Mapper; use OCP\IUser; class MapperTest extends \Test\TestCase { - public function dataGetBucket() { return [ ['user', 64, '17'], diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php index 25ce5525361..fa8ec535061 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php @@ -56,7 +56,6 @@ class ObjectStoreStorageTest extends Storage { } public function testStat() { - $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $ctimeStart = time(); $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile)); diff --git a/tests/lib/Files/ObjectStore/ObjectStoreTest.php b/tests/lib/Files/ObjectStore/ObjectStoreTest.php index 67c41eb7ccc..9300a9bdef6 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreTest.php @@ -49,7 +49,6 @@ abstract class ObjectStoreTest extends TestCase { $instance->deleteObject('1'); $this->assertEquals('foobar', stream_get_contents($result)); - } public function testDelete() { diff --git a/tests/lib/Files/SimpleFS/SimpleFileTest.php b/tests/lib/Files/SimpleFS/SimpleFileTest.php index 8de5cf50aa3..b9a47c4d6e2 100644 --- a/tests/lib/Files/SimpleFS/SimpleFileTest.php +++ b/tests/lib/Files/SimpleFS/SimpleFileTest.php @@ -28,7 +28,7 @@ use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\NotFoundException; -class SimpleFileTest extends \Test\TestCase { +class SimpleFileTest extends \Test\TestCase { /** @var File|\PHPUnit_Framework_MockObject_MockObject */ private $file; diff --git a/tests/lib/Files/SimpleFS/SimpleFolderTest.php b/tests/lib/Files/SimpleFS/SimpleFolderTest.php index 4cab1136d82..50714b8356e 100644 --- a/tests/lib/Files/SimpleFS/SimpleFolderTest.php +++ b/tests/lib/Files/SimpleFS/SimpleFolderTest.php @@ -109,5 +109,4 @@ class SimpleFolderTest extends \Test\TestCase { $this->assertInstanceOf(ISimpleFile::class, $result[0]); $this->assertInstanceOf(ISimpleFile::class, $result[1]); } - } diff --git a/tests/lib/Files/Storage/CopyDirectoryTest.php b/tests/lib/Files/Storage/CopyDirectoryTest.php index d56cc37124d..25bdb016ead 100644 --- a/tests/lib/Files/Storage/CopyDirectoryTest.php +++ b/tests/lib/Files/Storage/CopyDirectoryTest.php @@ -44,7 +44,6 @@ class CopyDirectoryStorage extends StorageNoRecursiveCopy { * @package Test\Files\Storage */ class CopyDirectoryTest extends Storage { - protected function setUp(): void { parent::setUp(); $this->instance = new CopyDirectoryStorage([]); diff --git a/tests/lib/Files/Storage/HomeStorageQuotaTest.php b/tests/lib/Files/Storage/HomeStorageQuotaTest.php index 68fa4bb0bbb..cfee638d5f3 100644 --- a/tests/lib/Files/Storage/HomeStorageQuotaTest.php +++ b/tests/lib/Files/Storage/HomeStorageQuotaTest.php @@ -45,7 +45,9 @@ class HomeStorageQuotaTest extends \Test\TestCase { // clean up \OC_User::setUserId(''); $user = \OC::$server->getUserManager()->get($user1); - if ($user !== null) { $user->delete(); } + if ($user !== null) { + $user->delete(); + } \OC::$server->getConfig()->deleteAllUserValues($user1); \OC_Util::tearDownFS(); } @@ -73,9 +75,10 @@ class HomeStorageQuotaTest extends \Test\TestCase { // clean up \OC_User::setUserId(''); $user = \OC::$server->getUserManager()->get($user1); - if ($user !== null) { $user->delete(); } + if ($user !== null) { + $user->delete(); + } \OC::$server->getConfig()->deleteAllUserValues($user1); \OC_Util::tearDownFS(); } - } diff --git a/tests/lib/Files/Storage/Wrapper/EncodingTest.php b/tests/lib/Files/Storage/Wrapper/EncodingTest.php index 9060ca2dac3..1f199239a8e 100644 --- a/tests/lib/Files/Storage/Wrapper/EncodingTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncodingTest.php @@ -9,7 +9,6 @@ namespace Test\Files\Storage\Wrapper; class EncodingTest extends \Test\Files\Storage\Storage { - const NFD_NAME = 'ümlaut'; const NFC_NAME = 'ümlaut'; diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index c50015483fb..73de60e3652 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -110,7 +110,6 @@ class EncryptionTest extends Storage { private $dummySize = -1; protected function setUp(): void { - parent::setUp(); $mockModule = $this->buildMockModule(); @@ -174,7 +173,9 @@ class EncryptionTest extends Storage { ->disableOriginalConstructor()->getMock(); $this->cache->expects($this->any()) ->method('get') - ->willReturnCallback(function ($path) {return ['encrypted' => false, 'path' => $path];}); + ->willReturnCallback(function ($path) { + return ['encrypted' => false, 'path' => $path]; + }); $this->mountManager = $this->createMock(\OC\Files\Mount\Manager::class); $this->mountManager->method('findByStorageId') @@ -244,7 +245,6 @@ class EncryptionTest extends Storage { * @param array $expected */ public function testGetMetaData($path, $metaData, $encrypted, $unencryptedSizeSet, $storedUnencryptedSize, $expected) { - $sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); @@ -273,7 +273,7 @@ class EncryptionTest extends Storage { ->setMethods(['getCache', 'verifyUnencryptedSize']) ->getMock(); - if($unencryptedSizeSet) { + if ($unencryptedSizeSet) { $this->invokePrivate($this->instance, 'unencryptedSize', [[$path => $storedUnencryptedSize]]); } @@ -298,10 +298,10 @@ class EncryptionTest extends Storage { } $result = $this->instance->getMetaData($path); - if(isset($expected['encrypted'])) { + if (isset($expected['encrypted'])) { $this->assertSame($expected['encrypted'], (bool)$result['encrypted']); - if(isset($expected['encryptedVersion'])) { + if (isset($expected['encryptedVersion'])) { $this->assertSame($expected['encryptedVersion'], $result['encryptedVersion']); } } @@ -352,7 +352,6 @@ class EncryptionTest extends Storage { $this->assertSame(42, $this->instance->filesize('/test.txt') ); - } /** @@ -561,7 +560,6 @@ class EncryptionTest extends Storage { * @param string $strippedPath */ public function testGetHeader($path, $strippedPathExists, $strippedPath) { - $sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); @@ -629,7 +627,6 @@ class EncryptionTest extends Storage { * @dataProvider dataTestGetHeaderAddLegacyModule */ public function testGetHeaderAddLegacyModule($header, $isEncrypted, $exists, $expected) { - $sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor()->getMock(); @@ -645,7 +642,9 @@ class EncryptionTest extends Storage { ->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) ->method('get') - ->willReturnCallback(function ($path) use ($isEncrypted) {return ['encrypted' => $isEncrypted, 'path' => $path];}); + ->willReturnCallback(function ($path) use ($isEncrypted) { + return ['encrypted' => $isEncrypted, 'path' => $path]; + }); $instance = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Encryption') ->setConstructorArgs( @@ -792,7 +791,7 @@ class EncryptionTest extends Storage { }); $storage2->method('getId') ->willReturn('stroage2'); - if($expectedEncrypted) { + if ($expectedEncrypted) { $cache = $this->createMock(ICache::class); $cache->expects($this->once()) ->method('get') @@ -816,7 +815,7 @@ class EncryptionTest extends Storage { $expectedCachePut = [ 'encrypted' => $expectedEncrypted, ]; - if($expectedEncrypted === true) { + if ($expectedEncrypted === true) { $expectedCachePut['encryptedVersion'] = 1; } @@ -840,7 +839,6 @@ class EncryptionTest extends Storage { * @param bool $encrypted */ public function testCopyBetweenStorageVersions($sourceInternalPath, $targetInternalPath, $copyResult, $encrypted) { - $sourceStorage = $this->createMock(\OC\Files\Storage\Storage::class); $targetStorage = $this->createMock(\OC\Files\Storage\Storage::class); @@ -1043,5 +1041,4 @@ class EncryptionTest extends Storage { [true, null, false, true], ]; } - } diff --git a/tests/lib/Files/Stream/DummyEncryptionWrapper.php b/tests/lib/Files/Stream/DummyEncryptionWrapper.php index 599abf894ef..e66fae3d15d 100644 --- a/tests/lib/Files/Stream/DummyEncryptionWrapper.php +++ b/tests/lib/Files/Stream/DummyEncryptionWrapper.php @@ -32,5 +32,4 @@ class DummyEncryptionWrapper extends \OC\Files\Stream\Encryption { protected function parentStreamSeek($position) { return false; } - } diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php index f884aefb7d8..e1ad3ec68fa 100644 --- a/tests/lib/Files/Stream/EncryptionTest.php +++ b/tests/lib/Files/Stream/EncryptionTest.php @@ -216,7 +216,7 @@ class EncryptionTest extends \Test\TestCase { fclose($stream); unlink($fileName); -} + } public function testSeek() { $fileName = tempnam("/tmp", "FOO"); @@ -252,7 +252,6 @@ class EncryptionTest extends \Test\TestCase { * @dataProvider dataFilesProvider */ public function testWriteReadBigFile($testFile) { - $expectedData = file_get_contents(\OC::$SERVERROOT . '/tests/data/' . $testFile); // write it $fileName = tempnam("/tmp", "FOO"); @@ -290,7 +289,6 @@ class EncryptionTest extends \Test\TestCase { * @dataProvider dataFilesProvider */ public function testWriteToNonSeekableStorage($testFile) { - $wrapper = $this->getMockBuilder('\OC\Files\Stream\Encryption') ->setMethods(['parentSeekStream'])->getMock(); $wrapper->expects($this->any())->method('parentSeekStream')->willReturn(false); @@ -324,7 +322,6 @@ class EncryptionTest extends \Test\TestCase { $this->assertEquals($expectedData, $data); unlink($fileName); - } /** diff --git a/tests/lib/Files/Type/LoaderTest.php b/tests/lib/Files/Type/LoaderTest.php index a99c80dac47..ccd37cbb655 100644 --- a/tests/lib/Files/Type/LoaderTest.php +++ b/tests/lib/Files/Type/LoaderTest.php @@ -89,5 +89,4 @@ class LoaderTest extends \Test\TestCase { $this->assertEquals($mimetypeId, $mimetypeId2); } - } diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php index c5183ac3929..376e72e6811 100644 --- a/tests/lib/Files/Utils/ScannerTest.php +++ b/tests/lib/Files/Utils/ScannerTest.php @@ -241,5 +241,4 @@ class ScannerTest extends \Test\TestCase { $this->assertTrue($cache->inCache('folder/bar.txt')); $this->assertFalse($cache->inCache('folder/subfolder/foobar.txt')); } - } diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index 369c94c3530..9dbe2a4e10e 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -804,7 +804,6 @@ class ViewTest extends \Test\TestCase { } public function xtestLongPath() { - $storage = new Temporary([]); Filesystem::mount($storage, [], '/'); @@ -1210,7 +1209,6 @@ class ViewTest extends \Test\TestCase { // second file not moved/copied $this->assertFalse($storage2->file_exists('dirtomove/indir2.txt')); $this->assertFalse($storage2->getCache()->get('dirtomove/indir2.txt')); - } public function testDeleteFailKeepCache() { @@ -1541,7 +1539,6 @@ class ViewTest extends \Test\TestCase { $this->assertFalse($this->isFileLocked($view, '/test//sub', ILockingProvider::LOCK_SHARED)); $this->assertFalse($this->isFileLocked($view, '/test//sub', ILockingProvider::LOCK_EXCLUSIVE)); - } public function hookPathProvider() { diff --git a/tests/lib/GlobalScale/ConfigTest.php b/tests/lib/GlobalScale/ConfigTest.php index a9474f12d77..2f2e1c21855 100644 --- a/tests/lib/GlobalScale/ConfigTest.php +++ b/tests/lib/GlobalScale/ConfigTest.php @@ -41,7 +41,6 @@ class ConfigTest extends TestCase { * @return Config|\PHPUnit_Framework_MockObject_MockObject */ public function getInstance($mockMethods = []) { - if (!empty($mockMethods)) { return $this->getMockBuilder(Config::class) ->setConstructorArgs([$this->config]) @@ -89,5 +88,4 @@ class ConfigTest extends TestCase { [false, 'internal', false] ]; } - } diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php index 9437e62996c..05ffa7973c0 100644 --- a/tests/lib/Group/ManagerTest.php +++ b/tests/lib/Group/ManagerTest.php @@ -547,7 +547,7 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('inGroup') ->willReturnCallback(function ($uid, $gid) { - switch($uid) { + switch ($uid) { case 'user1': return false; case 'user2': return true; case 'user3': return false; @@ -561,7 +561,7 @@ class ManagerTest extends TestCase { ->method('searchDisplayName') ->with('user3') ->willReturnCallback(function ($search, $limit, $offset) { - switch($offset) { + switch ($offset) { case 0: return ['user3' => $this->getTestUser('user3'), 'user33' => $this->getTestUser('user33')]; case 2: return []; @@ -571,7 +571,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('get') ->willReturnCallback(function ($uid) { - switch($uid) { + switch ($uid) { case 'user1': return $this->getTestUser('user1'); case 'user2': return $this->getTestUser('user2'); case 'user3': return $this->getTestUser('user3'); @@ -602,10 +602,10 @@ class ManagerTest extends TestCase { ->with('testgroup') ->willReturn(true); - $backend->expects($this->any()) + $backend->expects($this->any()) ->method('inGroup') ->willReturnCallback(function ($uid, $gid) { - switch($uid) { + switch ($uid) { case 'user1': return false; case 'user2': return true; case 'user3': return false; @@ -620,7 +620,7 @@ class ManagerTest extends TestCase { ->method('searchDisplayName') ->with('user3') ->willReturnCallback(function ($search, $limit, $offset) { - switch($offset) { + switch ($offset) { case 0: return ['user3' => $this->getTestUser('user3'), 'user33' => $this->getTestUser('user33')]; case 2: return ['user333' => $this->getTestUser('user333')]; @@ -630,7 +630,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('get') ->willReturnCallback(function ($uid) { - switch($uid) { + switch ($uid) { case 'user1': return $this->getTestUser('user1'); case 'user2': return $this->getTestUser('user2'); case 'user3': return $this->getTestUser('user3'); @@ -666,7 +666,7 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('inGroup') ->willReturnCallback(function ($uid) { - switch($uid) { + switch ($uid) { case 'user1': return false; case 'user2': return true; case 'user3': return false; @@ -681,7 +681,7 @@ class ManagerTest extends TestCase { ->method('searchDisplayName') ->with('user3') ->willReturnCallback(function ($search, $limit, $offset) { - switch($offset) { + switch ($offset) { case 0: return [ 'user3' => $this->getTestUser('user3'), @@ -694,7 +694,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('get') ->willReturnCallback(function ($uid) { - switch($uid) { + switch ($uid) { case 'user1': return $this->getTestUser('user1'); case 'user2': return $this->getTestUser('user2'); case 'user3': return $this->getTestUser('user3'); @@ -727,7 +727,7 @@ class ManagerTest extends TestCase { ->with('testgroup') ->willReturn(true); - $backend->expects($this->once()) + $backend->expects($this->once()) ->method('usersInGroup') ->with('testgroup', '', -1, 0) ->willReturn(['user2', 'user33']); @@ -735,7 +735,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('get') ->willReturnCallback(function ($uid) { - switch($uid) { + switch ($uid) { case 'user1': return $this->getTestUser('user1'); case 'user2': return $this->getTestUser('user2'); case 'user3': return $this->getTestUser('user3'); @@ -774,7 +774,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('get') ->willReturnCallback(function ($uid) { - switch($uid) { + switch ($uid) { case 'user1': return $this->getTestUser('user1'); case 'user2': return $this->getTestUser('user2'); case 'user3': return $this->getTestUser('user3'); @@ -813,7 +813,7 @@ class ManagerTest extends TestCase { $this->userManager->expects($this->any()) ->method('get') ->willReturnCallback(function ($uid) { - switch($uid) { + switch ($uid) { case 'user1': return $this->getTestUser('user1'); case 'user2': return $this->getTestUser('user2'); case 'user3': return $this->getTestUser('user3'); @@ -965,5 +965,4 @@ class ManagerTest extends TestCase { $this->assertEquals('group2', $group->getGID()); $this->assertEquals('group2', $group->getDisplayName()); } - } diff --git a/tests/lib/HelperStorageTest.php b/tests/lib/HelperStorageTest.php index 22c5658e565..3169957fabb 100644 --- a/tests/lib/HelperStorageTest.php +++ b/tests/lib/HelperStorageTest.php @@ -51,7 +51,9 @@ class HelperStorageTest extends \Test\TestCase { \OC_User::setUserId(''); $user = \OC::$server->getUserManager()->get($this->user); - if ($user !== null) { $user->delete(); } + if ($user !== null) { + $user->delete(); + } \OC::$server->getConfig()->deleteAllUserValues($this->user); parent::tearDown(); diff --git a/tests/lib/Hooks/LegacyEmitterTest.php b/tests/lib/Hooks/LegacyEmitterTest.php index 3b9eb26ec50..e6b751c1f74 100644 --- a/tests/lib/Hooks/LegacyEmitterTest.php +++ b/tests/lib/Hooks/LegacyEmitterTest.php @@ -39,8 +39,9 @@ class LegacyEmitterTest extends BasicEmitterTest { } public static function staticLegacyArgumentsCallBack($arguments) { - if ($arguments['foo'] == 'foo' and $arguments['bar'] == 'bar') + if ($arguments['foo'] == 'foo' and $arguments['bar'] == 'bar') { self::$emitted = true; + } } public function testLegacyHook() { diff --git a/tests/lib/InfoXmlTest.php b/tests/lib/InfoXmlTest.php index 30f169eac0b..9dbeadf45d3 100644 --- a/tests/lib/InfoXmlTest.php +++ b/tests/lib/InfoXmlTest.php @@ -28,7 +28,6 @@ namespace Test; * @package Test */ class InfoXmlTest extends TestCase { - public function dataApps() { return [ ['admin_audit'], diff --git a/tests/lib/InitialStateServiceTest.php b/tests/lib/InitialStateServiceTest.php index 6859fbec4f8..2afa257d3be 100644 --- a/tests/lib/InitialStateServiceTest.php +++ b/tests/lib/InitialStateServiceTest.php @@ -94,5 +94,4 @@ class InitialStateServiceTest extends TestCase { $data ); } - } diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php index 5d86757020f..9c3c40c267e 100644 --- a/tests/lib/InstallerTest.php +++ b/tests/lib/InstallerTest.php @@ -24,7 +24,6 @@ use OCP\ITempManager; * @group DB */ class InstallerTest extends TestCase { - private static $appid = 'testapp'; private $appstore; /** @var AppFetcher|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php index b1b3e4eb029..f1cd7467169 100644 --- a/tests/lib/IntegrityCheck/CheckerTest.php +++ b/tests/lib/IntegrityCheck/CheckerTest.php @@ -547,10 +547,10 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', $this->callback(function ($signature) use ($expectedSignatureFileData) { - $expectedArray = json_decode($expectedSignatureFileData, true); - $actualArray = json_decode($signature, true); - $this->assertEquals($expectedArray, $actualArray); - return true; + $expectedArray = json_decode($expectedSignatureFileData, true); + $actualArray = json_decode($signature, true); + $this->assertEquals($expectedArray, $actualArray); + return true; }) ); @@ -1018,7 +1018,6 @@ class CheckerTest extends TestCase { ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $this->assertSame([], $this->checker->verifyCoreSignature()); - } public function testVerifyCoreSignatureWithValidSignatureDataAndNotAlphabeticOrder() { diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php index 73e38145d54..7e1fb8c8886 100644 --- a/tests/lib/L10N/FactoryTest.php +++ b/tests/lib/L10N/FactoryTest.php @@ -559,12 +559,11 @@ class FactoryTest extends TestCase { }); $factory->expects($this->any()) ->method('respectDefaultLanguage')->willReturnCallback(function ($app, $lang) { - return $lang; + return $lang; }); $lang = $factory->findLanguage(null); $this->assertSame($expected, $lang); - } public function dataTestRespectDefaultLanguage() { @@ -611,11 +610,11 @@ class FactoryTest extends TestCase { public function testGetLanguageIterator(bool $hasSession, IUser $iUserMock = null) { $factory = $this->getFactory(); - if($iUserMock === null) { + if ($iUserMock === null) { $matcher = $this->userSession->expects($this->once()) ->method('getUser'); - if($hasSession) { + if ($hasSession) { $matcher->willReturn($this->createMock(IUser::class)); } else { $this->expectException(\RuntimeException::class); @@ -625,5 +624,4 @@ class FactoryTest extends TestCase { $iterator = $factory->getLanguageIterator($iUserMock); $this->assertInstanceOf(ILanguageIterator::class, $iterator); } - } diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php index a2c2e011254..1940d4f2d01 100644 --- a/tests/lib/LegacyHelperTest.php +++ b/tests/lib/LegacyHelperTest.php @@ -27,14 +27,12 @@ class LegacyHelperTest extends \Test\TestCase { /** * @dataProvider humanFileSizeProvider */ - public function testHumanFileSize($expected, $input) - { + public function testHumanFileSize($expected, $input) { $result = OC_Helper::humanFileSize($input); $this->assertEquals($expected, $result); } - public function humanFileSizeProvider() - { + public function humanFileSizeProvider() { return [ ['0 B', 0], ['1 KB', 1024], @@ -169,7 +167,6 @@ class LegacyHelperTest extends \Test\TestCase { * @dataProvider streamCopyDataProvider */ public function testStreamCopy($expectedCount, $expectedResult, $source, $target) { - if (is_string($source)) { $source = fopen($source, 'r'); } diff --git a/tests/lib/Lockdown/Filesystem/NullStorageTest.php b/tests/lib/Lockdown/Filesystem/NullStorageTest.php index 5bdf3b44ba0..c0349814570 100644 --- a/tests/lib/Lockdown/Filesystem/NullStorageTest.php +++ b/tests/lib/Lockdown/Filesystem/NullStorageTest.php @@ -31,7 +31,7 @@ use OC\Lockdown\Filesystem\NullStorage; use OCP\Files\Storage; use Test\TestCase; -class NullStorageTest extends TestCase { +class NullStorageTest extends TestCase { /** @var NullStorage */ private $storage; diff --git a/tests/lib/Log/FileTest.php b/tests/lib/Log/FileTest.php index 35e118bf3b9..937b3c75448 100644 --- a/tests/lib/Log/FileTest.php +++ b/tests/lib/Log/FileTest.php @@ -24,8 +24,7 @@ use Test\TestCase; /** * Class FileTest */ -class FileTest extends TestCase -{ +class FileTest extends TestCase { private $restore_logfile; private $restore_logdateformat; @@ -75,8 +74,5 @@ class FileTest extends TestCase $values = (array) json_decode($line); $microseconds = $values['time']; $this->assertNotEquals(0, $microseconds); - } - - } diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php index 99743ab95bd..5ed7b4c9b38 100644 --- a/tests/lib/LoggerTest.php +++ b/tests/lib/LoggerTest.php @@ -96,7 +96,7 @@ class LoggerTest extends TestCase implements IWriter { $this->logger->logException($e); $logLines = $this->getLogs(); - foreach($logLines as $logLine) { + foreach ($logLines as $logLine) { if (is_array($logLine)) { $logLine = json_encode($logLine); } @@ -118,7 +118,7 @@ class LoggerTest extends TestCase implements IWriter { $this->logger->logException($e); $logLines = $this->getLogs(); - foreach($logLines as $logLine) { + foreach ($logLines as $logLine) { if (is_array($logLine)) { $logLine = json_encode($logLine); } @@ -140,7 +140,7 @@ class LoggerTest extends TestCase implements IWriter { $this->logger->logException($e); $logLines = $this->getLogs(); - foreach($logLines as $logLine) { + foreach ($logLines as $logLine) { if (is_array($logLine)) { $logLine = json_encode($logLine); } @@ -162,7 +162,7 @@ class LoggerTest extends TestCase implements IWriter { $this->logger->logException($e); $logLines = $this->getLogs(); - foreach($logLines as $logLine) { + foreach ($logLines as $logLine) { if (is_array($logLine)) { $logLine = json_encode($logLine); } @@ -189,7 +189,7 @@ class LoggerTest extends TestCase implements IWriter { } $logLines = $this->getLogs(); - foreach($logLines as $logLine) { + foreach ($logLines as $logLine) { if (is_array($logLine)) { $logLine = json_encode($logLine); } diff --git a/tests/lib/Mail/EMailTemplateTest.php b/tests/lib/Mail/EMailTemplateTest.php index d48826ff5c5..4b4ff616d4e 100644 --- a/tests/lib/Mail/EMailTemplateTest.php +++ b/tests/lib/Mail/EMailTemplateTest.php @@ -227,6 +227,4 @@ class EMailTemplateTest extends TestCase { $expectedTXT = file_get_contents(\OC::$SERVERROOT . '/tests/data/emails/new-account-email-custom-text-alternative.txt'); $this->assertSame($expectedTXT, $this->emailTemplate->renderText()); } - - } diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php index bf469e87b94..996048452bb 100644 --- a/tests/lib/Mail/MailerTest.php +++ b/tests/lib/Mail/MailerTest.php @@ -204,7 +204,6 @@ class MailerTest extends TestCase { $mailer = self::invokePrivate($this->mailer, 'getInstance'); $this->assertEquals(1, count($mailer->getTransport()->getStreamOptions())); $this->assertTrue(isset($mailer->getTransport()->getStreamOptions()['foo'])); - } public function testStreamingOptionsWrongType() { diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php index 173d9414cda..2172a327234 100644 --- a/tests/lib/Mail/MessageTest.php +++ b/tests/lib/Mail/MessageTest.php @@ -252,5 +252,4 @@ class MessageTest extends TestCase { $message->useTemplate($template); } - } diff --git a/tests/lib/Memcache/APCuTest.php b/tests/lib/Memcache/APCuTest.php index 199acbe263b..704f9f1c433 100644 --- a/tests/lib/Memcache/APCuTest.php +++ b/tests/lib/Memcache/APCuTest.php @@ -13,7 +13,7 @@ class APCuTest extends Cache { protected function setUp(): void { parent::setUp(); - if(!\OC\Memcache\APCu::isAvailable()) { + if (!\OC\Memcache\APCu::isAvailable()) { $this->markTestSkipped('The APCu extension is not available.'); return; } diff --git a/tests/lib/NaturalSortTest.php b/tests/lib/NaturalSortTest.php index 30e439655d7..f8e7f31a285 100644 --- a/tests/lib/NaturalSortTest.php +++ b/tests/lib/NaturalSortTest.php @@ -13,9 +13,8 @@ class NaturalSortTest extends \Test\TestCase { /** * @dataProvider naturalSortDataProvider */ - public function testNaturalSortCompare($array, $sorted) - { - if(!class_exists('Collator')) { + public function testNaturalSortCompare($array, $sorted) { + if (!class_exists('Collator')) { $this->markTestSkipped('The intl module is not available, natural sorting might not work as expected.'); return; } @@ -27,8 +26,7 @@ class NaturalSortTest extends \Test\TestCase { /** * @dataProvider defaultCollatorDataProvider */ - public function testDefaultCollatorCompare($array, $sorted) - { + public function testDefaultCollatorCompare($array, $sorted) { $comparator = new \OC\NaturalSort(new \OC\NaturalSort_DefaultCollator()); usort($array, [$comparator, 'compare']); $this->assertEquals($sorted, $array); @@ -39,8 +37,7 @@ class NaturalSortTest extends \Test\TestCase { * Must provide the same result as in core/js/tests/specs/coreSpec.js * @return array test cases */ - public function naturalSortDataProvider() - { + public function naturalSortDataProvider() { return [ // different casing [ @@ -194,8 +191,7 @@ class NaturalSortTest extends \Test\TestCase { * Must provide the same result as in core/js/tests/specs/coreSpec.js * @return array test cases */ - public function defaultCollatorDataProvider() - { + public function defaultCollatorDataProvider() { return [ // different casing [ diff --git a/tests/lib/NavigationManagerTest.php b/tests/lib/NavigationManagerTest.php index e2ab0e3fddc..4f1cabc3cba 100644 --- a/tests/lib/NavigationManagerTest.php +++ b/tests/lib/NavigationManagerTest.php @@ -206,7 +206,6 @@ class NavigationManagerTest extends TestCase { * @dataProvider providesNavigationConfig */ public function testWithAppManager($expected, $navigation, $isAdmin = false) { - $l = $this->createMock(IL10N::class); $l->expects($this->any())->method('t')->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); diff --git a/tests/lib/Notification/ManagerTest.php b/tests/lib/Notification/ManagerTest.php index a8a94631137..57c7557e86c 100644 --- a/tests/lib/Notification/ManagerTest.php +++ b/tests/lib/Notification/ManagerTest.php @@ -46,7 +46,6 @@ class ManagerTest extends TestCase { } public function testRegisterApp() { - $this->assertEquals([], self::invokePrivate($this->manager, 'getApps')); $this->manager->registerApp(DummyApp::class); diff --git a/tests/lib/Notification/NotificationTest.php b/tests/lib/Notification/NotificationTest.php index 12c6818588c..f8d80a0ab56 100644 --- a/tests/lib/Notification/NotificationTest.php +++ b/tests/lib/Notification/NotificationTest.php @@ -1,6 +1,6 @@ <?php -declare (strict_types = 1); +declare(strict_types = 1); /** * @author Joas Schilling <nickvergessen@owncloud.com> * diff --git a/tests/lib/OCS/DiscoveryServiceTest.php b/tests/lib/OCS/DiscoveryServiceTest.php index 4b31de3f0a3..d5baa1be2e2 100644 --- a/tests/lib/OCS/DiscoveryServiceTest.php +++ b/tests/lib/OCS/DiscoveryServiceTest.php @@ -93,5 +93,4 @@ class DiscoveryServiceTest extends TestCase { [['services' => ['myService' => ['endpoints' => ['foo' => '/bar</foo']]]], 'myService', []], ]; } - } diff --git a/tests/lib/Preview/BackgroundCleanupJobTest.php b/tests/lib/Preview/BackgroundCleanupJobTest.php index 5536204dd20..db2bf09b6e5 100644 --- a/tests/lib/Preview/BackgroundCleanupJobTest.php +++ b/tests/lib/Preview/BackgroundCleanupJobTest.php @@ -38,7 +38,6 @@ use Test\Traits\UserTrait; * @package Test\Preview */ class BackgroundCleanupJobTest extends \Test\TestCase { - use MountProviderTrait; use UserTrait; diff --git a/tests/lib/Preview/BitmapTest.php b/tests/lib/Preview/BitmapTest.php index 952f72b276a..554e499ee84 100644 --- a/tests/lib/Preview/BitmapTest.php +++ b/tests/lib/Preview/BitmapTest.php @@ -29,7 +29,6 @@ namespace Test\Preview; * @package Test\Preview */ class BitmapTest extends Provider { - protected function setUp(): void { parent::setUp(); @@ -39,5 +38,4 @@ class BitmapTest extends Provider { $this->height = 1707; $this->provider = new \OC\Preview\Postscript; } - } diff --git a/tests/lib/Preview/HEICTest.php b/tests/lib/Preview/HEICTest.php index ea937f4df3c..18571dc52ea 100644 --- a/tests/lib/Preview/HEICTest.php +++ b/tests/lib/Preview/HEICTest.php @@ -29,7 +29,6 @@ namespace Test\Preview; * @package Test\Preview */ class HEICTest extends Provider { - protected function setUp(): void { if (!in_array("HEIC", \Imagick::queryFormats("HEI*"))) { $this->markTestSkipped('ImageMagick is not HEIC aware. Skipping tests'); @@ -42,7 +41,5 @@ class HEICTest extends Provider { $this->height = 1050; $this->provider = new \OC\Preview\HEIC; } - } - } diff --git a/tests/lib/Preview/ImageTest.php b/tests/lib/Preview/ImageTest.php index 40267538804..d58e4ca91ba 100644 --- a/tests/lib/Preview/ImageTest.php +++ b/tests/lib/Preview/ImageTest.php @@ -29,7 +29,6 @@ namespace Test\Preview; * @package Test\Preview */ class ImageTest extends Provider { - protected function setUp(): void { parent::setUp(); @@ -39,5 +38,4 @@ class ImageTest extends Provider { $this->height = 1050; $this->provider = new \OC\Preview\JPEG(); } - } diff --git a/tests/lib/Preview/MP3Test.php b/tests/lib/Preview/MP3Test.php index 15915ac2578..6e841e29ec4 100644 --- a/tests/lib/Preview/MP3Test.php +++ b/tests/lib/Preview/MP3Test.php @@ -29,7 +29,6 @@ namespace Test\Preview; * @package Test\Preview */ class MP3Test extends Provider { - protected function setUp(): void { parent::setUp(); @@ -39,5 +38,4 @@ class MP3Test extends Provider { $this->height = 200; $this->provider = new \OC\Preview\MP3; } - } diff --git a/tests/lib/Preview/MovieTest.php b/tests/lib/Preview/MovieTest.php index 2415102a83d..767ce130ae4 100644 --- a/tests/lib/Preview/MovieTest.php +++ b/tests/lib/Preview/MovieTest.php @@ -29,7 +29,6 @@ namespace Test\Preview; * @package Test\Preview */ class MovieTest extends Provider { - protected function setUp(): void { $avconvBinary = \OC_Helper::findBinaryPath('avconv'); $ffmpegBinary = ($avconvBinary) ? null : \OC_Helper::findBinaryPath('ffmpeg'); @@ -49,5 +48,4 @@ class MovieTest extends Provider { $this->markTestSkipped('No Movie provider present'); } } - } diff --git a/tests/lib/Preview/OfficeTest.php b/tests/lib/Preview/OfficeTest.php index 555b3f77747..c37e5b95a75 100644 --- a/tests/lib/Preview/OfficeTest.php +++ b/tests/lib/Preview/OfficeTest.php @@ -29,7 +29,6 @@ namespace Test\Preview; * @package Test\Preview */ class OfficeTest extends Provider { - protected function setUp(): void { $libreofficeBinary = \OC_Helper::findBinaryPath('libreoffice'); $openofficeBinary = ($libreofficeBinary) ? null : \OC_Helper::findBinaryPath('openoffice'); @@ -46,5 +45,4 @@ class OfficeTest extends Provider { $this->markTestSkipped('No Office provider present'); } } - } diff --git a/tests/lib/Preview/SVGTest.php b/tests/lib/Preview/SVGTest.php index 73ccbc0b136..e48018a301b 100644 --- a/tests/lib/Preview/SVGTest.php +++ b/tests/lib/Preview/SVGTest.php @@ -29,7 +29,6 @@ namespace Test\Preview; * @package Test\Preview */ class SVGTest extends Provider { - protected function setUp(): void { $checkImagick = new \Imagick(); if (count($checkImagick->queryFormats('SVG')) === 1) { @@ -44,5 +43,4 @@ class SVGTest extends Provider { $this->markTestSkipped('No SVG provider present'); } } - } diff --git a/tests/lib/Preview/TXTTest.php b/tests/lib/Preview/TXTTest.php index e4c6e76c47f..785fe8c2526 100644 --- a/tests/lib/Preview/TXTTest.php +++ b/tests/lib/Preview/TXTTest.php @@ -29,7 +29,6 @@ namespace Test\Preview; * @package Test\Preview */ class TXTTest extends Provider { - protected function setUp(): void { parent::setUp(); @@ -40,5 +39,4 @@ class TXTTest extends Provider { $this->height = 200; $this->provider = new \OC\Preview\TXT; } - } diff --git a/tests/lib/PublicNamespace/UtilTest.php b/tests/lib/PublicNamespace/UtilTest.php index e4e830468f2..9699d7a0ed2 100644 --- a/tests/lib/PublicNamespace/UtilTest.php +++ b/tests/lib/PublicNamespace/UtilTest.php @@ -22,11 +22,11 @@ namespace Test\PublicNamespace; class UtilTest extends \Test\TestCase { - /** - * @dataProvider channelProvider - * - * @param string $channel - */ + /** + * @dataProvider channelProvider + * + * @param string $channel + */ public function testOverrideChannel($channel) { \OCP\Util::setChannel($channel); $actual = \OCP\Util::getChannel($channel); diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php index d7525a09b18..e6c6fdebf42 100644 --- a/tests/lib/Repair/RepairMimeTypesTest.php +++ b/tests/lib/Repair/RepairMimeTypesTest.php @@ -87,7 +87,6 @@ class RepairMimeTypesTest extends \Test\TestCase { ] ); } - } private function checkEntries($entries) { diff --git a/tests/lib/RepairStepTest.php b/tests/lib/RepairStepTest.php index 00506e5dba7..9a569f8af6d 100644 --- a/tests/lib/RepairStepTest.php +++ b/tests/lib/RepairStepTest.php @@ -25,8 +25,7 @@ class RepairStepTest implements IRepairStep { public function run(\OCP\Migration\IOutput $out) { if ($this->warning) { $out->warning('Simulated warning'); - } - else { + } else { $out->info('Simulated info'); } } @@ -59,7 +58,6 @@ class RepairTest extends TestCase { } public function testRunRepairStep() { - $this->repair->addStep(new TestRepairStep(false)); $this->repair->run(); @@ -73,7 +71,6 @@ class RepairTest extends TestCase { } public function testRunRepairStepThatFail() { - $this->repair->addStep(new TestRepairStep(true)); $this->repair->run(); @@ -101,8 +98,7 @@ class RepairTest extends TestCase { $thrown = false; try { $this->repair->run(); - } - catch (\Exception $e) { + } catch (\Exception $e) { $thrown = true; } diff --git a/tests/lib/RichObjectStrings/DefinitionsTest.php b/tests/lib/RichObjectStrings/DefinitionsTest.php index acf5256a7f3..a17585079f2 100644 --- a/tests/lib/RichObjectStrings/DefinitionsTest.php +++ b/tests/lib/RichObjectStrings/DefinitionsTest.php @@ -25,7 +25,6 @@ use OCP\RichObjectStrings\Definitions; use Test\TestCase; class DefinitionsTest extends TestCase { - public function dataGetDefinition() { $definitions = new Definitions(); $testsuite = []; @@ -87,6 +86,5 @@ class DefinitionsTest extends TestCase { $this->assertNotEquals('', $data['description'], 'Description of parameter ' . $parameter . ' must not be empty'); $this->assertArrayHasKey('example', $data); $this->assertNotEquals('', $data['example'], 'Example of parameter ' . $parameter . ' must not be empty'); - } } diff --git a/tests/lib/RichObjectStrings/ValidatorTest.php b/tests/lib/RichObjectStrings/ValidatorTest.php index 63ad22c8200..45c6f745bdd 100644 --- a/tests/lib/RichObjectStrings/ValidatorTest.php +++ b/tests/lib/RichObjectStrings/ValidatorTest.php @@ -26,7 +26,6 @@ use OCP\RichObjectStrings\Definitions; use Test\TestCase; class ValidatorTest extends TestCase { - public function test() { $v = new Validator(new Definitions()); $v->validate('test', []); @@ -50,5 +49,4 @@ class ValidatorTest extends TestCase { ]); $this->addToAssertionCount(2); } - } diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php index 21e29c910c4..2fc7a53e78d 100644 --- a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php +++ b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php @@ -119,5 +119,4 @@ class ContentSecurityPolicyManagerTest extends TestCase { $this->assertEquals($expected, $this->contentSecurityPolicyManager->getDefaultPolicy()); $this->assertSame($expectedStringPolicy, $this->contentSecurityPolicyManager->getDefaultPolicy()->buildPolicy()); } - } diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php index 346ace943d9..783eb35eef9 100644 --- a/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php +++ b/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php @@ -27,7 +27,7 @@ use OC\Security\CSRF\CsrfToken; use OC\Security\CSRF\CsrfTokenManager; use Test\TestCase; -class ContentSecurityPolicyNonceManagerTest extends TestCase { +class ContentSecurityPolicyNonceManagerTest extends TestCase { /** @var CsrfTokenManager */ private $csrfTokenManager; /** @var Request */ diff --git a/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php index 5ab15c73bf2..10ab0f00c94 100644 --- a/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php +++ b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php @@ -32,7 +32,6 @@ class CsrfTokenGeneratorTest extends \Test\TestCase { $this->random = $this->getMockBuilder('\OCP\Security\ISecureRandom') ->disableOriginalConstructor()->getMock(); $this->csrfTokenGenerator = new \OC\Security\CSRF\CsrfTokenGenerator($this->random); - } public function testGenerateTokenWithCustomNumber() { diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php index 579a15f483a..6a93657f8c8 100644 --- a/tests/lib/Security/CertificateManagerTest.php +++ b/tests/lib/Security/CertificateManagerTest.php @@ -152,7 +152,6 @@ class CertificateManagerTest extends \Test\TestCase { $targetBundleExists, $expected ) { - $view = $this->getMockBuilder(View::class) ->disableOriginalConstructor()->getMock(); $config = $this->createMock(IConfig::class); @@ -177,7 +176,6 @@ class CertificateManagerTest extends \Test\TestCase { if ($uid !== null && $targetBundleExists) { $certificateManager->expects($this->at(2))->method('getCertificateBundle') ->with(null)->willReturn('SystemBundlePath'); - } $view->expects($this->any())->method('filemtime') @@ -194,7 +192,6 @@ class CertificateManagerTest extends \Test\TestCase { $this->assertSame($expected, $this->invokePrivate($certificateManager, 'needsRebundling', [$uid]) ); - } function dataTestNeedRebundling() { diff --git a/tests/lib/Security/CredentialsManagerTest.php b/tests/lib/Security/CredentialsManagerTest.php index 5ebcac7756a..8b58542f8c3 100644 --- a/tests/lib/Security/CredentialsManagerTest.php +++ b/tests/lib/Security/CredentialsManagerTest.php @@ -106,5 +106,4 @@ class CredentialsManagerTest extends \Test\TestCase { $this->manager->retrieve($userId, $identifier); } - } diff --git a/tests/lib/Security/CryptoTest.php b/tests/lib/Security/CryptoTest.php index 5e079c8018f..2a2e6adac3e 100644 --- a/tests/lib/Security/CryptoTest.php +++ b/tests/lib/Security/CryptoTest.php @@ -11,9 +11,7 @@ namespace Test\Security; use OC\Security\Crypto; class CryptoTest extends \Test\TestCase { - - public function defaultEncryptionProvider() - { + public function defaultEncryptionProvider() { return [ ['Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'], [''], diff --git a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php index 15bbc803f5a..b8f558719dc 100644 --- a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php +++ b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php @@ -86,5 +86,4 @@ class FeaturePolicyManagerTest extends TestCase { $this->assertEquals($expected, $this->manager->getDefaultPolicy()); $this->assertSame($expectedStringPolicy, $this->manager->getDefaultPolicy()->buildPolicy()); } - } diff --git a/tests/lib/Security/HasherTest.php b/tests/lib/Security/HasherTest.php index 76f880c1c12..cc5cb786088 100644 --- a/tests/lib/Security/HasherTest.php +++ b/tests/lib/Security/HasherTest.php @@ -19,8 +19,7 @@ class HasherTest extends \Test\TestCase { /** * @return array */ - public function versionHashProvider() - { + public function versionHashProvider() { return [ ['asf32äà$$a.|3', null], ['asf32äà$$a.|3|5', null], @@ -30,8 +29,7 @@ class HasherTest extends \Test\TestCase { ]; } - public function hashProviders70_71(): array - { + public function hashProviders70_71(): array { return [ // Valid SHA1 strings ['password', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', true], @@ -140,7 +138,7 @@ class HasherTest extends \Test\TestCase { ->expects($this->any()) ->method('getSystemValue') ->willReturnCallback(function ($key, $default) { - if($key === 'passwordsalt') { + if ($key === 'passwordsalt') { return '6Wow67q1wZQZpUUeI6G2LsWUu4XKx'; } return $default; @@ -259,6 +257,5 @@ class HasherTest extends \Test\TestCase { $info = password_get_info($relativePath['hash']); $this->assertEquals(PASSWORD_BCRYPT, $info['algo']); - } } diff --git a/tests/lib/Security/IdentityProof/ManagerTest.php b/tests/lib/Security/IdentityProof/ManagerTest.php index 5f96782bae8..5fd1d709c2f 100644 --- a/tests/lib/Security/IdentityProof/ManagerTest.php +++ b/tests/lib/Security/IdentityProof/ManagerTest.php @@ -35,7 +35,7 @@ use OCP\Security\ICrypto; use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; -class ManagerTest extends TestCase { +class ManagerTest extends TestCase { /** @var Factory|MockObject */ private $factory; /** @var IAppData|MockObject */ @@ -214,7 +214,6 @@ class ManagerTest extends TestCase { ->willReturn($key); $this->assertSame($key, $manager->getSystemKey()); - } diff --git a/tests/lib/Security/IdentityProof/SignerTest.php b/tests/lib/Security/IdentityProof/SignerTest.php index 884065e6a1a..913ab7c15f5 100644 --- a/tests/lib/Security/IdentityProof/SignerTest.php +++ b/tests/lib/Security/IdentityProof/SignerTest.php @@ -200,6 +200,4 @@ gQIDAQAB $this->assertFalse($this->signer->verify($data)); } - - } diff --git a/tests/lib/Security/Normalizer/IpAddressTest.php b/tests/lib/Security/Normalizer/IpAddressTest.php index 97a8737ea9e..16be71cb225 100644 --- a/tests/lib/Security/Normalizer/IpAddressTest.php +++ b/tests/lib/Security/Normalizer/IpAddressTest.php @@ -25,7 +25,6 @@ use OC\Security\Normalizer\IpAddress; use Test\TestCase; class IpAddressTest extends TestCase { - public function subnetDataProvider() { return [ [ diff --git a/tests/lib/Security/SecureRandomTest.php b/tests/lib/Security/SecureRandomTest.php index 6898c1d8b0f..4075a1c7109 100644 --- a/tests/lib/Security/SecureRandomTest.php +++ b/tests/lib/Security/SecureRandomTest.php @@ -11,7 +11,6 @@ namespace Test\Security; use OC\Security\SecureRandom; class SecureRandomTest extends \Test\TestCase { - public function stringGenerationProvider() { return [ [0, 0], diff --git a/tests/lib/Session/MemoryTest.php b/tests/lib/Session/MemoryTest.php index 79053ccb1c8..fab7292ae00 100644 --- a/tests/lib/Session/MemoryTest.php +++ b/tests/lib/Session/MemoryTest.php @@ -10,7 +10,6 @@ namespace Test\Session; class MemoryTest extends Session { - protected function setUp(): void { parent::setUp(); $this->instance = new \OC\Session\Memory($this->getUniqueID()); @@ -22,5 +21,4 @@ class MemoryTest extends Session { $this->instance->getId(); } - } diff --git a/tests/lib/Share/Backend.php b/tests/lib/Share/Backend.php index a0d45b9b782..661da326e4c 100644 --- a/tests/lib/Share/Backend.php +++ b/tests/lib/Share/Backend.php @@ -22,7 +22,6 @@ namespace Test\Share; class Backend implements \OCP\Share_Backend { - const FORMAT_SOURCE = 0; const FORMAT_TARGET = 1; const FORMAT_PERMISSIONS = 2; @@ -66,7 +65,6 @@ class Backend implements \OCP\Share_Backend { $i++; } $target = $name.$append.$ext; - } return $target; @@ -89,5 +87,4 @@ class Backend implements \OCP\Share_Backend { public function isShareTypeAllowed($shareType) { return true; } - } diff --git a/tests/lib/Share/HelperTest.php b/tests/lib/Share/HelperTest.php index 941cb5b737d..44bd70e7e29 100644 --- a/tests/lib/Share/HelperTest.php +++ b/tests/lib/Share/HelperTest.php @@ -26,7 +26,6 @@ namespace Test\Share; * Class Helper */ class HelperTest extends \Test\TestCase { - public function expireDateProvider() { return [ // no default expire date, we take the users expire date diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php index b90e18a6238..57d174cab46 100644 --- a/tests/lib/Share/ShareTest.php +++ b/tests/lib/Share/ShareTest.php @@ -33,7 +33,6 @@ use OCP\IUserManager; * @group DB */ class ShareTest extends \Test\TestCase { - protected $itemType; /** @var IUser */ @@ -247,11 +246,9 @@ class ShareTest extends \Test\TestCase { * @param array $grouped */ function testGroupItems($ungrouped, $grouped) { - $result = DummyShareClass::groupItemsTest($ungrouped); $this->compareArrays($grouped, $result); - } function compareArrays($result, $expectedResult) { diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index c0a869d0793..33c64265f7b 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -125,17 +125,39 @@ class DefaultShareProviderTest extends \Test\TestCase { $qb = $this->dbConn->getQueryBuilder(); $qb->insert('share'); - if ($shareType) $qb->setValue('share_type', $qb->expr()->literal($shareType)); - if ($sharedWith) $qb->setValue('share_with', $qb->expr()->literal($sharedWith)); - if ($sharedBy) $qb->setValue('uid_initiator', $qb->expr()->literal($sharedBy)); - if ($shareOwner) $qb->setValue('uid_owner', $qb->expr()->literal($shareOwner)); - if ($itemType) $qb->setValue('item_type', $qb->expr()->literal($itemType)); - if ($fileSource) $qb->setValue('file_source', $qb->expr()->literal($fileSource)); - if ($fileTarget) $qb->setValue('file_target', $qb->expr()->literal($fileTarget)); - if ($permissions) $qb->setValue('permissions', $qb->expr()->literal($permissions)); - if ($token) $qb->setValue('token', $qb->expr()->literal($token)); - if ($expiration) $qb->setValue('expiration', $qb->createNamedParameter($expiration, IQueryBuilder::PARAM_DATE)); - if ($parent) $qb->setValue('parent', $qb->expr()->literal($parent)); + if ($shareType) { + $qb->setValue('share_type', $qb->expr()->literal($shareType)); + } + if ($sharedWith) { + $qb->setValue('share_with', $qb->expr()->literal($sharedWith)); + } + if ($sharedBy) { + $qb->setValue('uid_initiator', $qb->expr()->literal($sharedBy)); + } + if ($shareOwner) { + $qb->setValue('uid_owner', $qb->expr()->literal($shareOwner)); + } + if ($itemType) { + $qb->setValue('item_type', $qb->expr()->literal($itemType)); + } + if ($fileSource) { + $qb->setValue('file_source', $qb->expr()->literal($fileSource)); + } + if ($fileTarget) { + $qb->setValue('file_target', $qb->expr()->literal($fileTarget)); + } + if ($permissions) { + $qb->setValue('permissions', $qb->expr()->literal($permissions)); + } + if ($token) { + $qb->setValue('token', $qb->expr()->literal($token)); + } + if ($expiration) { + $qb->setValue('expiration', $qb->createNamedParameter($expiration, IQueryBuilder::PARAM_DATE)); + } + if ($parent) { + $qb->setValue('parent', $qb->expr()->literal($parent)); + } $this->assertEquals(1, $qb->execute()); return$qb->getLastInsertId(); @@ -743,7 +765,6 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertSame('/path/to/image.svg', $share->getSharedWithAvatar()); $this->assertSame(null, $share2->getSharedWithDisplayName()); $this->assertSame(null, $share2->getSharedWithAvatar()); - } public function testCreateLinkShare() { @@ -964,7 +985,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $id = $qb->getLastInsertId(); $groups = []; - foreach(range(0, 100) as $i) { + foreach (range(0, 100) as $i) { $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'.$i); $groups[] = $group; @@ -1224,7 +1245,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder->method('getById')->with($deletedFileId)->willReturn([$file]); $groups = []; - foreach(range(0, 100) as $i) { + foreach (range(0, 100) as $i) { $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'.$i); $groups[] = $group; @@ -1759,7 +1780,7 @@ class DefaultShareProviderTest extends \Test\TestCase { 'file', 42, 'target', 31, null, null); $users = []; - for($i = 0; $i < 6; $i++) { + for ($i = 0; $i < 6; $i++) { $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('user'.$i); $user->method('getDisplayName')->willReturn('user' . $i); @@ -1817,7 +1838,7 @@ class DefaultShareProviderTest extends \Test\TestCase { 'file', 42, 'target', 31, null, null); $users = []; - for($i = 0; $i < 6; $i++) { + for ($i = 0; $i < 6; $i++) { $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('user'.$i); $users['user'.$i] = $user; @@ -1883,7 +1904,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertEquals(1, $qb->execute()); $users = []; - for($i = 0; $i < 6; $i++) { + for ($i = 0; $i < 6; $i++) { $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('user'.$i); $users['user'.$i] = $user; @@ -1940,7 +1961,7 @@ class DefaultShareProviderTest extends \Test\TestCase { 'file', 42, 'target', 31, null, null); $users = []; - for($i = 0; $i < 6; $i++) { + for ($i = 0; $i < 6; $i++) { $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('user'.$i); $users['user'.$i] = $user; @@ -1953,7 +1974,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ); $groups = []; - for($i = 0; $i < 2; $i++) { + for ($i = 0; $i < 2; $i++) { $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'.$i); $groups['group'.$i] = $group; @@ -2018,7 +2039,7 @@ class DefaultShareProviderTest extends \Test\TestCase { 'file', 42, 'mytarget2', 0, null, null, $id); $users = []; - for($i = 0; $i < 6; $i++) { + for ($i = 0; $i < 6; $i++) { $user = $this->createMock(IUser::class); $user->method('getUID')->willReturn('user'.$i); $users['user'.$i] = $user; @@ -2031,7 +2052,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ); $groups = []; - for($i = 0; $i < 2; $i++) { + for ($i = 0; $i < 2; $i++) { $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'.$i); $groups['group'.$i] = $group; diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index 96bebc196f6..4a7b0e9ae4b 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -105,7 +105,6 @@ class ManagerTest extends \Test\TestCase { protected $defaults; protected function setUp(): void { - $this->logger = $this->createMock(ILogger::class); $this->config = $this->createMock(IConfig::class); $this->secureRandom = $this->createMock(ISecureRandom::class); @@ -720,7 +719,7 @@ class ManagerTest extends \Test\TestCase { } catch (\OCP\Share\Exceptions\GenericShareException $e) { $this->assertEquals($exceptionMessage, $e->getHint()); $thrown = true; - } catch(\InvalidArgumentException $e) { + } catch (\InvalidArgumentException $e) { $this->assertEquals($exceptionMessage, $e->getMessage()); $thrown = true; } @@ -1627,10 +1626,12 @@ class ManagerTest extends \Test\TestCase { ->willReturn(true); $manager->expects($this->once()) ->method('generalCreateChecks') - ->with($share);; + ->with($share); + ; $manager->expects($this->once()) ->method('userCreateChecks') - ->with($share);; + ->with($share); + ; $manager->expects($this->once()) ->method('pathCreateChecks') ->with($path); @@ -1680,10 +1681,12 @@ class ManagerTest extends \Test\TestCase { ->willReturn(true); $manager->expects($this->once()) ->method('generalCreateChecks') - ->with($share);; + ->with($share); + ; $manager->expects($this->once()) ->method('groupCreateChecks') - ->with($share);; + ->with($share); + ; $manager->expects($this->once()) ->method('pathCreateChecks') ->with($path); @@ -1743,10 +1746,12 @@ class ManagerTest extends \Test\TestCase { ->willReturn(true); $manager->expects($this->once()) ->method('generalCreateChecks') - ->with($share);; + ->with($share); + ; $manager->expects($this->once()) ->method('linkCreateChecks') - ->with($share);; + ->with($share); + ; $manager->expects($this->once()) ->method('pathCreateChecks') ->with($path); @@ -1862,7 +1867,8 @@ class ManagerTest extends \Test\TestCase { ->willReturn(true); $manager->expects($this->once()) ->method('generalCreateChecks') - ->with($share);; + ->with($share); + ; $manager->expects($this->never()) ->method('linkCreateChecks'); $manager->expects($this->once()) @@ -1972,10 +1978,12 @@ class ManagerTest extends \Test\TestCase { ->willReturn(true); $manager->expects($this->once()) ->method('generalCreateChecks') - ->with($share);; + ->with($share); + ; $manager->expects($this->once()) ->method('userCreateChecks') - ->with($share);; + ->with($share); + ; $manager->expects($this->once()) ->method('pathCreateChecks') ->with($path); @@ -1994,9 +2002,9 @@ class ManagerTest extends \Test\TestCase { $this->equalTo('OCP\Share::preShare'), $this->isInstanceOf(GenericEvent::class) )->willReturnCallback(function ($name, GenericEvent $e) { - $e->setArgument('error', 'I won\'t let you share!'); - $e->stopPropagation(); - } + $e->setArgument('error', 'I won\'t let you share!'); + $e->stopPropagation(); + } ); $manager->createShare($share); @@ -2050,10 +2058,12 @@ class ManagerTest extends \Test\TestCase { ->willReturn(true); $manager->expects($this->once()) ->method('generalCreateChecks') - ->with($share);; + ->with($share); + ; $manager->expects($this->once()) ->method('userCreateChecks') - ->with($share);; + ->with($share); + ; $manager->expects($this->once()) ->method('pathCreateChecks') ->with($path); @@ -2154,7 +2164,7 @@ class ManagerTest extends \Test\TestCase { */ $manager->method('deleteShare') ->willReturnCallback(function ($share) use (&$shares2) { - for($i = 0; $i < count($shares2); $i++) { + for ($i = 0; $i < count($shares2); $i++) { if ($shares2[$i]->getId() === $share->getId()) { array_splice($shares2, $i, 1); break; @@ -2563,7 +2573,6 @@ class ManagerTest extends \Test\TestCase { } public function testUpdateShareUser() { - $this->userManager->expects($this->any())->method('userExists')->willReturn(true); $manager = $this->createManagerMock() @@ -3362,7 +3371,6 @@ class ManagerTest extends \Test\TestCase { * @dataProvider dataTestShareProviderExists */ public function testShareProviderExists($shareType, $expected) { - $factory = $this->getMockBuilder('OCP\Share\IProviderFactory')->getMock(); $factory->expects($this->any())->method('getProviderForType') ->willReturnCallback(function ($id) { @@ -3580,7 +3588,6 @@ class ManagerTest extends \Test\TestCase { $this->assertSame($expected['public'], $result['public']); $this->assertSame($expected['remote'], $result['remote']); $this->assertSame($expected['users'], $result['users']); - } public function testGetAccessListWithCurrentAccess() { @@ -3706,7 +3713,6 @@ class ManagerTest extends \Test\TestCase { $this->assertSame($expected['public'], $result['public']); $this->assertSame($expected['remote'], $result['remote']); $this->assertSame($expected['users'], $result['users']); - } public function testGetAllShares() { @@ -3768,7 +3774,6 @@ class DummyFactory implements IProviderFactory { protected $provider; public function __construct(\OCP\IServerContainer $serverContainer) { - } /** diff --git a/tests/lib/SubAdminTest.php b/tests/lib/SubAdminTest.php index 23207c8f721..06c319d1f48 100644 --- a/tests/lib/SubAdminTest.php +++ b/tests/lib/SubAdminTest.php @@ -84,11 +84,11 @@ class SubAdminTest extends \Test\TestCase { } protected function tearDown(): void { - foreach($this->users as $user) { + foreach ($this->users as $user) { $user->delete(); } - foreach($this->groups as $group) { + foreach ($this->groups as $group) { $group->delete(); } @@ -242,14 +242,13 @@ class SubAdminTest extends \Test\TestCase { $this->groupManager->get('admin')->addUser($this->users[1]); $this->assertFalse($subAdmin->isUserAccessible($this->users[0], $this->users[1])); - } public function testPostDeleteUser() { $subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn); $user = array_shift($this->users); - foreach($this->groups as $group) { + foreach ($this->groups as $group) { $subAdmin->createSubAdmin($user, $group); } @@ -261,7 +260,7 @@ class SubAdminTest extends \Test\TestCase { $subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn); $group = array_shift($this->groups); - foreach($this->users as $user) { + foreach ($this->users as $user) { $subAdmin->createSubAdmin($user, $group); } @@ -295,5 +294,4 @@ class SubAdminTest extends \Test\TestCase { $subAdmin->deleteSubAdmin($u, $g); $this->assertEquals(2, $count); } - } diff --git a/tests/lib/Support/CrashReport/RegistryTest.php b/tests/lib/Support/CrashReport/RegistryTest.php index c45848b6186..d85b006509e 100644 --- a/tests/lib/Support/CrashReport/RegistryTest.php +++ b/tests/lib/Support/CrashReport/RegistryTest.php @@ -94,5 +94,4 @@ class RegistryTest extends TestCase { $this->registry->register($reporter2); $this->registry->delegateMessage($message); } - } diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php index 9eea05b7966..698c2582b83 100644 --- a/tests/lib/SystemTag/SystemTagManagerTest.php +++ b/tests/lib/SystemTag/SystemTagManagerTest.php @@ -537,5 +537,4 @@ class SystemTagManagerTest extends TestCase { $this->assertEquals($tag1->isUserVisible(), $tag2->isUserVisible()); $this->assertEquals($tag1->isUserAssignable(), $tag2->isUserAssignable()); } - } diff --git a/tests/lib/TagsTest.php b/tests/lib/TagsTest.php index 54a8b85289d..fd6283d2f27 100644 --- a/tests/lib/TagsTest.php +++ b/tests/lib/TagsTest.php @@ -31,7 +31,6 @@ use OCP\IUserSession; * @group DB */ class TagsTest extends \Test\TestCase { - protected $objectType; /** @var \OCP\IUser */ protected $user; @@ -63,7 +62,6 @@ class TagsTest extends \Test\TestCase { $this->objectType = $this->getUniqueID('type_'); $this->tagMapper = new \OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection()); $this->tagMgr = new \OC\TagManager($this->tagMapper, $this->userSession); - } protected function tearDown(): void { @@ -97,7 +95,7 @@ class TagsTest extends \Test\TestCase { $tagger = $this->tagMgr->load($this->objectType); - foreach($tags as $tag) { + foreach ($tags as $tag) { $result = $tagger->add($tag); $this->assertGreaterThan(0, $result, 'add() returned an ID <= 0'); $this->assertTrue((bool)$result); @@ -114,20 +112,20 @@ class TagsTest extends \Test\TestCase { $tagger = $this->tagMgr->load($this->objectType); - foreach($tags as $tag) { + foreach ($tags as $tag) { $this->assertFalse($tagger->hasTag($tag)); } $result = $tagger->addMultiple($tags); $this->assertTrue((bool)$result); - foreach($tags as $tag) { + foreach ($tags as $tag) { $this->assertTrue($tagger->hasTag($tag)); } $tagMaps = $tagger->getTags(); $this->assertCount(4, $tagMaps, 'Not all tags added'); - foreach($tagMaps as $tagMap) { + foreach ($tagMaps as $tagMap) { $this->assertEquals(null, $tagMap['id']); } @@ -143,14 +141,14 @@ class TagsTest extends \Test\TestCase { $this->assertTrue((bool)$result); $tagMaps = $tagger->getTags(); - foreach($tagMaps as $tagMap) { + foreach ($tagMaps as $tagMap) { $this->assertNotEquals(null, $tagMap['id']); } // Reload the tagger. $tagger = $this->tagMgr->load($this->objectType); - foreach($tags as $tag) { + foreach ($tags as $tag) { $this->assertTrue($tagger->hasTag($tag)); } @@ -215,7 +213,7 @@ class TagsTest extends \Test\TestCase { // insert lots of entries $idsArray = []; - for($i = 1; $i <= 1500; $i++) { + for ($i = 1; $i <= 1500; $i++) { $statement->execute([$i, $tagId, $tagType]); $idsArray[] = $i; } @@ -253,7 +251,7 @@ class TagsTest extends \Test\TestCase { $tagger = $this->tagMgr->load($this->objectType); - foreach($objids as $id) { + foreach ($objids as $id) { $this->assertTrue($tagger->tagAs($id, 'Family')); } @@ -271,7 +269,7 @@ class TagsTest extends \Test\TestCase { $this->testTagAs(); $tagger = $this->tagMgr->load($this->objectType); - foreach($objIds as $id) { + foreach ($objIds as $id) { $this->assertTrue(in_array($id, $tagger->getIdsForTag('Family'))); $tagger->unTag($id, 'Family'); $this->assertFalse(in_array($id, $tagger->getIdsForTag('Family'))); @@ -323,5 +321,4 @@ class TagsTest extends \Test\TestCase { $this->assertTrue($otherTagger->hasTag($testTag)); $this->assertContains(1, $otherTagger->getIdsForTag($testTag)); } - } diff --git a/tests/lib/TempManagerTest.php b/tests/lib/TempManagerTest.php index f43573c1e3a..a1b5e732b40 100644 --- a/tests/lib/TempManagerTest.php +++ b/tests/lib/TempManagerTest.php @@ -23,7 +23,6 @@ class NullLogger extends Log { } class TempManagerTest extends \Test\TestCase { - protected $baseDir = null; protected function setUp(): void { diff --git a/tests/lib/Template/CSSResourceLocatorTest.php b/tests/lib/Template/CSSResourceLocatorTest.php index 8c1eb66d303..01f2285670e 100644 --- a/tests/lib/Template/CSSResourceLocatorTest.php +++ b/tests/lib/Template/CSSResourceLocatorTest.php @@ -69,8 +69,8 @@ class CSSResourceLocatorTest extends \Test\TestCase { private function cssResourceLocator() { /** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */ - $factory = $this->createMock(Factory::class); - $factory->method('get')->with('css')->willReturn($this->appData); + $factory = $this->createMock(Factory::class); + $factory->method('get')->with('css')->willReturn($this->appData); $scssCacher = new SCSSCacher( $this->logger, $factory, diff --git a/tests/lib/Template/IconsCacherTest.php b/tests/lib/Template/IconsCacherTest.php index eacb5c812bc..4b5c6a73ef8 100644 --- a/tests/lib/Template/IconsCacherTest.php +++ b/tests/lib/Template/IconsCacherTest.php @@ -1,6 +1,6 @@ <?php -declare (strict_types = 1); +declare(strict_types = 1); /** * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com) * @@ -148,5 +148,4 @@ class IconsCacherTest extends \Test\TestCase { $actual = $this->iconsCacher->setIconsCss($actual); $this->assertEquals($expected, $actual); } - } diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php index abafc583ccf..0cdea95fd6f 100644 --- a/tests/lib/Template/JSCombinerTest.php +++ b/tests/lib/Template/JSCombinerTest.php @@ -70,7 +70,6 @@ class JSCombinerTest extends \Test\TestCase { $this->config, $this->logger ); - } public function testProcessDebugMode() { @@ -560,5 +559,4 @@ var b = \'world\'; $this->jsCombiner->resetCache(); } - } diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php index 09ab9363d95..9dfd8d20fea 100644 --- a/tests/lib/Template/SCSSCacherTest.php +++ b/tests/lib/Template/SCSSCacherTest.php @@ -167,7 +167,7 @@ class SCSSCacherTest extends \Test\TestCase { throw new NotFoundException(); } elseif ($path === $filePrefix.'styles.css.gzip') { return $gzfile; - }else { + } else { $this->fail(); } }); @@ -539,6 +539,4 @@ class SCSSCacherTest extends \Test\TestCase { $this->scssCacher->resetCache(); } - - } diff --git a/tests/lib/TemplateFunctionsTest.php b/tests/lib/TemplateFunctionsTest.php index a6385670487..caecdfc76ac 100644 --- a/tests/lib/TemplateFunctionsTest.php +++ b/tests/lib/TemplateFunctionsTest.php @@ -23,7 +23,6 @@ namespace Test; class TemplateFunctionsTest extends \Test\TestCase { - protected function setUp(): void { parent::setUp(); diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index c4ff92c223f..9c9eb8cc04f 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -449,7 +449,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { } $annotations = $this->getAnnotations(); if (isset($annotations['class']['group'])) { - if(in_array('DB', $annotations['class']['group']) || in_array('SLOWDB', $annotations['class']['group'])) { + if (in_array('DB', $annotations['class']['group']) || in_array('SLOWDB', $annotations['class']['group'])) { return true; } } @@ -463,7 +463,6 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * @param array $vars */ protected function assertTemplate($expectedHtml, $template, $vars = []) { - require_once __DIR__.'/../../lib/private/legacy/template/functions.php'; $requestToken = 12345; @@ -513,7 +512,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { private function removeWhitespaces(DOMNode $domNode) { foreach ($domNode->childNodes as $node) { - if($node->hasChildNodes()) { + if ($node->hasChildNodes()) { $this->removeWhitespaces($node); } else { if ($node instanceof \DOMText && $node->isWhitespaceInElementContent()) { diff --git a/tests/lib/Updater/ChangesCheckTest.php b/tests/lib/Updater/ChangesCheckTest.php index b3897ebbd07..4d7dce43ee1 100644 --- a/tests/lib/Updater/ChangesCheckTest.php +++ b/tests/lib/Updater/ChangesCheckTest.php @@ -77,7 +77,7 @@ class ChangesCheckTest extends TestCase { ->method('getStatusCode') ->willReturn($statusCode); - if(!in_array($statusCode, [200, 304, 404])) { + if (!in_array($statusCode, [200, 304, 404])) { $this->logger->expects($this->once()) ->method('debug'); } @@ -348,8 +348,12 @@ class ChangesCheckTest extends TestCase { public function changeDataProvider():array { $testDataFound = $testDataNotFound = $this->versionProvider(); - array_walk($testDataFound, function (&$params) { $params[] = true; }); - array_walk($testDataNotFound, function (&$params) { $params[] = false; }); + array_walk($testDataFound, function (&$params) { + $params[] = true; + }); + array_walk($testDataNotFound, function (&$params) { + $params[] = false; + }); return array_merge($testDataFound, $testDataNotFound); } @@ -362,7 +366,7 @@ class ChangesCheckTest extends TestCase { ->method('getChanges') ->with($normalizedVersion); - if(!$isFound) { + if (!$isFound) { $this->expectException(DoesNotExistException::class); $mocker->willThrowException(new DoesNotExistException('Changes info is not present')); } else { diff --git a/tests/lib/UpdaterTest.php b/tests/lib/UpdaterTest.php index 1732cf4c1cf..3ccf4c8b8c7 100644 --- a/tests/lib/UpdaterTest.php +++ b/tests/lib/UpdaterTest.php @@ -114,5 +114,4 @@ class UpdaterTest extends TestCase { $this->assertSame($result, $this->updater->isUpgradePossible($oldVersion, $newVersion, $allowedVersions)); } - } diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php index 438835f2c3f..0baacda53d1 100644 --- a/tests/lib/UrlGeneratorTest.php +++ b/tests/lib/UrlGeneratorTest.php @@ -179,6 +179,4 @@ class UrlGeneratorTest extends \Test\TestCase { ['core.WhatsNew.dismiss', 'http://localhost/nextcloud/ocs/v2.php/core/whatsnew'], ]; } - - } diff --git a/tests/lib/User/DatabaseTest.php b/tests/lib/User/DatabaseTest.php index 3546cb17d2f..1c63190890b 100644 --- a/tests/lib/User/DatabaseTest.php +++ b/tests/lib/User/DatabaseTest.php @@ -56,10 +56,10 @@ class DatabaseTest extends Backend { } protected function tearDown(): void { - if(!isset($this->users)) { + if (!isset($this->users)) { return; } - foreach($this->users as $user) { + foreach ($this->users as $user) { $this->backend->deleteUser($user); } parent::tearDown(); diff --git a/tests/lib/Util/Group/Dummy.php b/tests/lib/Util/Group/Dummy.php index f75aef5737e..293c8f48945 100644 --- a/tests/lib/Util/Group/Dummy.php +++ b/tests/lib/Util/Group/Dummy.php @@ -45,10 +45,10 @@ class Dummy extends Backend { * be returned. */ public function createGroup($gid) { - if(!isset($this->groups[$gid])) { + if (!isset($this->groups[$gid])) { $this->groups[$gid]=[]; return true; - }else{ + } else { return false; } } @@ -61,10 +61,10 @@ class Dummy extends Backend { * Deletes a group and removes it from the group_user-table */ public function deleteGroup($gid) { - if(isset($this->groups[$gid])) { + if (isset($this->groups[$gid])) { unset($this->groups[$gid]); return true; - }else{ + } else { return false; } } @@ -78,9 +78,9 @@ class Dummy extends Backend { * Checks whether the user is member of a group or not. */ public function inGroup($uid, $gid) { - if(isset($this->groups[$gid])) { + if (isset($this->groups[$gid])) { return (array_search($uid, $this->groups[$gid])!==false); - }else{ + } else { return false; } } @@ -94,14 +94,14 @@ class Dummy extends Backend { * Adds a user to a group. */ public function addToGroup($uid, $gid) { - if(isset($this->groups[$gid])) { - if(array_search($uid, $this->groups[$gid])===false) { + if (isset($this->groups[$gid])) { + if (array_search($uid, $this->groups[$gid])===false) { $this->groups[$gid][]=$uid; return true; - }else{ + } else { return false; } - }else{ + } else { return false; } } @@ -115,14 +115,14 @@ class Dummy extends Backend { * removes the user from a group. */ public function removeFromGroup($uid, $gid) { - if(isset($this->groups[$gid])) { - if(($index=array_search($uid, $this->groups[$gid]))!==false) { + if (isset($this->groups[$gid])) { + if (($index=array_search($uid, $this->groups[$gid]))!==false) { unset($this->groups[$gid][$index]); return true; - }else{ + } else { return false; } - }else{ + } else { return false; } } @@ -138,8 +138,8 @@ class Dummy extends Backend { public function getUserGroups($uid) { $groups=[]; $allGroups=array_keys($this->groups); - foreach($allGroups as $group) { - if($this->inGroup($uid, $group)) { + foreach ($allGroups as $group) { + if ($this->inGroup($uid, $group)) { $groups[]=$group; } } @@ -154,12 +154,12 @@ class Dummy extends Backend { * @return array an array of group names */ public function getGroups($search = '', $limit = -1, $offset = 0) { - if(empty($search)) { + if (empty($search)) { return array_keys($this->groups); } $result = []; - foreach(array_keys($this->groups) as $group) { - if(stripos($group, $search) !== false) { + foreach (array_keys($this->groups) as $group) { + if (stripos($group, $search) !== false) { $result[] = $group; } } @@ -175,19 +175,19 @@ class Dummy extends Backend { * @return array an array of user IDs */ public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { - if(isset($this->groups[$gid])) { - if(empty($search)) { + if (isset($this->groups[$gid])) { + if (empty($search)) { $length = $limit < 0 ? null : $limit; return array_slice($this->groups[$gid], $offset, $length); } $result = []; - foreach($this->groups[$gid] as $user) { - if(stripos($user, $search) !== false) { + foreach ($this->groups[$gid] as $user) { + if (stripos($user, $search) !== false) { $result[] = $user; } } return $result; - }else{ + } else { return []; } } @@ -201,18 +201,17 @@ class Dummy extends Backend { * @return int */ public function countUsersInGroup($gid, $search = '', $limit = -1, $offset = 0) { - if(isset($this->groups[$gid])) { - if(empty($search)) { + if (isset($this->groups[$gid])) { + if (empty($search)) { return count($this->groups[$gid]); } $count = 0; - foreach($this->groups[$gid] as $user) { - if(stripos($user, $search) !== false) { + foreach ($this->groups[$gid] as $user) { + if (stripos($user, $search) !== false) { $count++; } } return $count; } } - } diff --git a/tests/lib/Util/User/Dummy.php b/tests/lib/Util/User/Dummy.php index 3e6372ca033..478b7599701 100644 --- a/tests/lib/Util/User/Dummy.php +++ b/tests/lib/Util/User/Dummy.php @@ -109,7 +109,7 @@ class Dummy extends Backend implements \OCP\IUserBackend { } public function loginName2UserName($loginName) { - if(isset($this->users[strtolower($loginName)])) { + if (isset($this->users[strtolower($loginName)])) { return strtolower($loginName); } return false; diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php index e822c394930..b5a05535009 100644 --- a/tests/lib/UtilCheckServerTest.php +++ b/tests/lib/UtilCheckServerTest.php @@ -14,7 +14,6 @@ namespace Test; * @group DB */ class UtilCheckServerTest extends \Test\TestCase { - private $datadir; /** diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index 767ada3ae03..75f62163f1e 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -235,7 +235,7 @@ class UtilTest extends \Test\TestCase { ->method('isEnabledForUser') ->willReturnCallback(function ($appId) use ($enabledApps) { return in_array($appId, $enabledApps); - }); + }); Dummy_OC_Util::$appManager = $appManager; // need to set a user id to make sure enabled apps are read from cache |