diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 2db51d8b22f..faebb471ae6 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -585,7 +585,7 @@ trait WebDav { $body .= $content3."\r\n"; $body .= '--'.$boundary."--\r\n"; - $stream = fopen('php://temp','r+'); + $stream = fopen('php://temp', 'r+'); fwrite($stream, $body); rewind($stream); diff --git a/core/Command/Config/System/GetConfig.php b/core/Command/Config/System/GetConfig.php index f7e573f6869..265fc70900f 100644 --- a/core/Command/Config/System/GetConfig.php +++ b/core/Command/Config/System/GetConfig.php @@ -67,7 +67,7 @@ class GetConfig extends Base { * @param OutputInterface $output An OutputInterface instance * @return int 0 if everything went fine, or an error code */ - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $configNames = $input->getArgument('name'); $configName = array_shift($configNames); $defaultValue = $input->getOption('default-value'); diff --git a/core/Command/Db/Migrations/ExecuteCommand.php b/core/Command/Db/Migrations/ExecuteCommand.php index a2dc2b92418..6f4559ee7b4 100644 --- a/core/Command/Db/Migrations/ExecuteCommand.php +++ b/core/Command/Db/Migrations/ExecuteCommand.php @@ -79,7 +79,7 @@ class ExecuteCommand extends Command implements CompletionAwareInterface { $olderVersions = $ms->getMigratedVersions(); $olderVersions[] = '0'; $olderVersions[] = 'prev'; - if (in_array($version, $olderVersions, true)) { + if (in_array($version, $olderVersions, true)) { $output->writeln('Can not go back to previous migration without debug enabled'); return 1; } diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php index b352e86ec62..47777b1561e 100644 --- a/core/Command/Db/Migrations/GenerateCommand.php +++ b/core/Command/Db/Migrations/GenerateCommand.php @@ -113,7 +113,7 @@ class {{classname}} extends SimpleMigrationStep { $appName = $input->getArgument('app'); $version = $input->getArgument('version'); - if (!preg_match('/^\d{1,16}$/',$version)) { + if (!preg_match('/^\d{1,16}$/', $version)) { $output->writeln('The given version is invalid. Only 0-9 are allowed (max. 16 digits)'); return 1; } diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index efc7124f2ea..0591132e37f 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -247,8 +247,7 @@ class Upgrade extends Command { $output->write('Maybe an upgrade is already in process. Please check the ' . 'logfile (data/nextcloud.log). If you want to re-run the ' . 'upgrade procedure, remove the "maintenance mode" from ' - . 'config.php and call this script again.' - , true); + . 'config.php and call this script again.', true); return self::ERROR_MAINTENANCE_MODE; } else { $output->writeln('Nextcloud is already latest version'); diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php index bb11a1ea5c9..574be6e421c 100644 --- a/core/Command/User/Add.php +++ b/core/Command/User/Add.php @@ -107,7 +107,7 @@ class Add extends Command { $question = new Question('Confirm password: '); $question->setHidden(true); - $confirm = $helper->ask($input, $output,$question); + $confirm = $helper->ask($input, $output, $question); if ($password !== $confirm) { $output->writeln("Passwords did not match!"); diff --git a/core/Command/User/Setting.php b/core/Command/User/Setting.php index b677540d170..04488cdeff1 100644 --- a/core/Command/User/Setting.php +++ b/core/Command/User/Setting.php @@ -178,7 +178,7 @@ class Setting extends Base { return 1; } - if ($app === 'settings' && in_array($key , ['email', 'display_name'])) { + if ($app === 'settings' && in_array($key, ['email', 'display_name'])) { $user = $this->userManager->get($uid); if ($user instanceof IUser) { if ($key === 'email') { @@ -208,7 +208,7 @@ class Setting extends Base { return 1; } - if ($app === 'settings' && in_array($key , ['email', 'display_name'])) { + if ($app === 'settings' && in_array($key, ['email', 'display_name'])) { $user = $this->userManager->get($uid); if ($user instanceof IUser) { if ($key === 'email') { diff --git a/core/Migrations/Version15000Date20180926101451.php b/core/Migrations/Version15000Date20180926101451.php index e379b12490d..f70a786bbcd 100644 --- a/core/Migrations/Version15000Date20180926101451.php +++ b/core/Migrations/Version15000Date20180926101451.php @@ -44,7 +44,7 @@ class Version15000Date20180926101451 extends SimpleMigrationStep { $schema = $schemaClosure(); $table = $schema->getTable('authtoken'); - $table->addColumn('password_invalid','boolean', [ + $table->addColumn('password_invalid', 'boolean', [ 'default' => 0, 'notnull' => false, ]); diff --git a/index.php b/index.php index 7c7400a0564..7b62f17e5bd 100644 --- a/index.php +++ b/index.php @@ -60,7 +60,7 @@ try { * not return a webpage, so we only print the error page when html is accepted, * otherwise we reply with a JSON array like the SecurityMiddleware would do. */ - if (stripos($request->getHeader('Accept'),'html') === false) { + if (stripos($request->getHeader('Accept'), 'html') === false) { http_response_code(401); header('Content-Type: application/json; charset=utf-8'); echo json_encode(['message' => $ex->getMessage()]); diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 2c7641243fa..66137727699 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -630,7 +630,7 @@ class AccountManager implements IAccountManager { } // the value col is limited to 255 bytes. It is used for searches only. - $value = $property['value'] ? Util::shortenMultibyteString($property['value'], 255) : ''; + $value = $property['value'] ? Util::shortenMultibyteString($property['value'], 255) : ''; $query->setParameter('name', $property['name']) ->setParameter('value', $value); diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php index 6bbab42cb79..0f12dbda629 100644 --- a/lib/private/AppFramework/Http/Dispatcher.php +++ b/lib/private/AppFramework/Http/Dispatcher.php @@ -131,7 +131,7 @@ class Dispatcher { $numExecuted = $databaseStatsAfter['executed'] - $databaseStatsBefore['executed']; if ($numBuilt > 50) { - $this->logger->debug('Controller {class}::{method} created {count} QueryBuilder objects, please check if they are created inside a loop by accident.' , [ + $this->logger->debug('Controller {class}::{method} created {count} QueryBuilder objects, please check if they are created inside a loop by accident.', [ 'class' => get_class($controller), 'method' => $methodName, 'count' => $numBuilt, @@ -139,7 +139,7 @@ class Dispatcher { } if ($numExecuted > 100) { - $this->logger->warning('Controller {class}::{method} executed {count} queries.' , [ + $this->logger->warning('Controller {class}::{method} executed {count} queries.', [ 'class' => get_class($controller), 'method' => $methodName, 'count' => $numExecuted, diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index c67500bcaa4..21af2bc46f4 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -303,7 +303,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @return string */ public function getHeader(string $name): string { - $name = strtoupper(str_replace('-', '_',$name)); + $name = strtoupper(str_replace('-', '_', $name)); if (isset($this->server['HTTP_' . $name])) { return $this->server['HTTP_' . $name]; } diff --git a/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php b/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php index 8bdbacda20b..5f683fa38ac 100644 --- a/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php @@ -109,7 +109,7 @@ class RateLimitingMiddleware extends Middleware { */ public function afterException($controller, $methodName, \Exception $exception) { if ($exception instanceof RateLimitExceededException) { - if (stripos($this->request->getHeader('Accept'),'html') === false) { + if (stripos($this->request->getHeader('Accept'), 'html') === false) { $response = new DataResponse([], $exception->getCode()); } else { $response = new TemplateResponse( diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index 9442bd9eca9..3dbcf518f1e 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -356,8 +356,8 @@ class JobList implements IJobList { public function resetBackgroundJob(IJob $job): void { $query = $this->connection->getQueryBuilder(); $query->update('jobs') - ->set('last_run', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)) - ->set('reserved_at', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)) + ->set('last_run', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)) + ->set('reserved_at', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)) ->where($query->expr()->eq('id', $query->createNamedParameter($job->getId()), IQueryBuilder::PARAM_INT)); $query->executeStatement(); } diff --git a/lib/private/DB/Adapter.php b/lib/private/DB/Adapter.php index 4d9b43d0787..334006d1706 100644 --- a/lib/private/DB/Adapter.php +++ b/lib/private/DB/Adapter.php @@ -136,7 +136,7 @@ class Adapter { /** * @throws \OCP\DB\Exception */ - public function insertIgnoreConflict(string $table,array $values) : int { + public function insertIgnoreConflict(string $table, array $values) : int { try { $builder = $this->conn->getQueryBuilder(); $builder->insert($table); diff --git a/lib/private/DB/AdapterPgSql.php b/lib/private/DB/AdapterPgSql.php index 1262fd4f1ab..9045aa7f879 100644 --- a/lib/private/DB/AdapterPgSql.php +++ b/lib/private/DB/AdapterPgSql.php @@ -43,7 +43,7 @@ class AdapterPgSql extends Adapter { return $statement; } - public function insertIgnoreConflict(string $table,array $values) : int { + public function insertIgnoreConflict(string $table, array $values) : int { if ($this->isPre9_5CompatMode() === true) { return parent::insertIgnoreConflict($table, $values); } diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 72de70a8248..271b7a27321 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1182,7 +1182,7 @@ class View { if ($result && in_array('delete', $hooks) and $result) { $this->removeUpdate($storage, $internalPath); } - if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { + if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { $this->writeUpdate($storage, $internalPath); } if ($result && in_array('touch', $hooks)) { diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index 1189907eac9..61f506d2676 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -244,7 +244,7 @@ class Mailer implements IMailer { } [$name, $domain] = explode('@', $email, 2); - $domain = idn_to_ascii($domain, 0,INTL_IDNA_VARIANT_UTS46); + $domain = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46); return $name.'@'.$domain; } diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php index 87b71223280..50f3fa66ab3 100644 --- a/lib/private/Memcache/Memcached.php +++ b/lib/private/Memcache/Memcached.php @@ -66,7 +66,7 @@ class Memcached extends Cache implements IMemcache { //\Memcached::OPT_BINARY_PROTOCOL => true, ]; // by default enable igbinary serializer if available - /** @psalm-suppress RedundantCondition */ + /** @psalm-suppress RedundantCondition */ if (\Memcached::HAVE_IGBINARY) { $defaultOptions[\Memcached::OPT_SERIALIZER] = \Memcached::SERIALIZER_IGBINARY; diff --git a/lib/private/Migration/BackgroundRepair.php b/lib/private/Migration/BackgroundRepair.php index 25026575d38..03a3d3f4a7c 100644 --- a/lib/private/Migration/BackgroundRepair.php +++ b/lib/private/Migration/BackgroundRepair.php @@ -97,7 +97,7 @@ class BackgroundRepair extends TimedJob { try { $repair->addStep($step); } catch (\Exception $ex) { - $this->logger->logException($ex,[ + $this->logger->logException($ex, [ 'app' => 'migration' ]); diff --git a/lib/private/Preview/MarkDown.php b/lib/private/Preview/MarkDown.php index e24bdb5959b..929f319f57d 100644 --- a/lib/private/Preview/MarkDown.php +++ b/lib/private/Preview/MarkDown.php @@ -43,7 +43,7 @@ class MarkDown extends TXT { return null; } - $content = stream_get_contents($content,3000); + $content = stream_get_contents($content, 3000); //don't create previews of empty text files if (trim($content) === '') { @@ -119,7 +119,7 @@ class MarkDown extends TXT { // Get rid of markdown symbols that we still needed for the font size $line = preg_replace('/^#*\s/', '', $line); - $wrappedText = wordwrap($line, $wordWrap,"\n"); + $wrappedText = wordwrap($line, $wordWrap, "\n"); $linesWrapped = count(explode("\n", $wrappedText)); imagettftext($image, $actualFontSize, 0, $x, $y, $textColor, $actualFontSize === $fontSize ? $fontFile : $fontFileBold, $wrappedText); $nextLineStart = (int)($linesWrapped * ceil($actualFontSize * 2)); diff --git a/lib/private/Preview/TXT.php b/lib/private/Preview/TXT.php index d55d32386a7..bb3af6b90de 100644 --- a/lib/private/Preview/TXT.php +++ b/lib/private/Preview/TXT.php @@ -62,7 +62,7 @@ class TXT extends ProviderV2 { return null; } - $content = stream_get_contents($content,3000); + $content = stream_get_contents($content, 3000); //don't create previews of empty text files if (trim($content) === '') { diff --git a/lib/private/Security/TrustedDomainHelper.php b/lib/private/Security/TrustedDomainHelper.php index 175e4cbd356..0688ebba5b3 100644 --- a/lib/private/Security/TrustedDomainHelper.php +++ b/lib/private/Security/TrustedDomainHelper.php @@ -98,7 +98,7 @@ class TrustedDomainHelper implements ITrustedDomainHelper { return true; } // Reject misformed domains in any case - if (strpos($domain,'-') === 0 || strpos($domain,'..') !== false) { + if (strpos($domain, '-') === 0 || strpos($domain, '..') !== false) { return false; } // Match, allowing for * wildcards diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index 8a12465fd8d..920baf3e4ee 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -125,7 +125,7 @@ class MySQL extends AbstractDatabase { $connection->executeUpdate($query); } } catch (\Exception $ex) { - $this->logger->error('Database user creation failed.',[ + $this->logger->error('Database user creation failed.', [ 'exception' => $ex, 'app' => 'mysql.setup', ]); diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 548c8a2c451..47b09982f3a 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -847,7 +847,7 @@ class Share extends Constants { * @param array $parameters additional format parameters * @return array format result */ - private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) { + private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE, $parameters = null) { if ($format === self::FORMAT_NONE) { return $items; } elseif ($format === self::FORMAT_STATUSES) { diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index ec0f25cbae5..6e8d9105a76 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -670,7 +670,7 @@ class DefaultShareProvider implements IShareProvider { ); } - $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid')); + $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')); $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); $qb->orderBy('id'); diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index 382179b23e0..753a4a217d1 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -187,7 +187,7 @@ class URLGenerator implements IURLGenerator { $theme = \OC_Util::getTheme(); //if a theme has a png but not an svg always use the png - $basename = substr(basename($file),0,-4); + $basename = substr(basename($file), 0, -4); $appPath = \OC_App::getAppPath($appName); diff --git a/lib/private/legacy/OC_DB.php b/lib/private/legacy/OC_DB.php index 1fbc233f535..39faf8e80aa 100644 --- a/lib/private/legacy/OC_DB.php +++ b/lib/private/legacy/OC_DB.php @@ -42,7 +42,7 @@ class OC_DB { * * SQL query via Doctrine prepare(), needs to be execute()'d! */ - public static function prepare($query , $limit = null, $offset = null, $isManipulation = null) { + public static function prepare($query, $limit = null, $offset = null, $isManipulation = null) { $connection = \OC::$server->getDatabaseConnection(); if ($isManipulation === null) { diff --git a/lib/private/legacy/OC_DB_StatementWrapper.php b/lib/private/legacy/OC_DB_StatementWrapper.php index d8e8f0ae37f..d6214a49a33 100644 --- a/lib/private/legacy/OC_DB_StatementWrapper.php +++ b/lib/private/legacy/OC_DB_StatementWrapper.php @@ -59,7 +59,7 @@ class OC_DB_StatementWrapper { /** * pass all other function directly to the \Doctrine\DBAL\Driver\Statement */ - public function __call($name,$arguments) { + public function __call($name, $arguments) { return call_user_func_array([$this->statement,$name], $arguments); } diff --git a/lib/public/IDBConnection.php b/lib/public/IDBConnection.php index 2fa7fa1ad36..d12baa400c0 100644 --- a/lib/public/IDBConnection.php +++ b/lib/public/IDBConnection.php @@ -188,7 +188,7 @@ interface IDBConnection { * @return int number of inserted rows * @since 16.0.0 */ - public function insertIgnoreConflict(string $table,array $values) : int; + public function insertIgnoreConflict(string $table, array $values) : int; /** * Insert or update a row value diff --git a/ocs/providers.php b/ocs/providers.php index 34f931ad940..ca0217d8e91 100644 --- a/ocs/providers.php +++ b/ocs/providers.php @@ -34,7 +34,7 @@ $url = $request->getServerProtocol() . '://' . substr($request->getServerHost() $writer = new XMLWriter(); $writer->openURI('php://output'); -$writer->startDocument('1.0','UTF-8'); +$writer->startDocument('1.0', 'UTF-8'); $writer->setIndent(true); $writer->startElement('providers'); $writer->startElement('provider'); diff --git a/tests/lib/AppFramework/Db/QBMapperTest.php b/tests/lib/AppFramework/Db/QBMapperTest.php index 7865979ef41..b03034056d2 100644 --- a/tests/lib/AppFramework/Db/QBMapperTest.php +++ b/tests/lib/AppFramework/Db/QBMapperTest.php @@ -109,11 +109,11 @@ class QBMapperTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); - $this->qb = $this->getMockBuilder(IQueryBuilder:: class) + $this->qb = $this->getMockBuilder(IQueryBuilder::class) ->disableOriginalConstructor() ->getMock(); - $this->expr = $this->getMockBuilder(IExpressionBuilder:: class) + $this->expr = $this->getMockBuilder(IExpressionBuilder::class) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index 7260b31b27e..a4a03b6479c 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -1062,7 +1062,7 @@ class RequestTest extends \Test\TestCase { $this->stream ); - $this->assertSame('from.server.name:8080', $request->getInsecureServerHost()); + $this->assertSame('from.server.name:8080', $request->getInsecureServerHost()); } public function testInsecureServerHostHttpHostHeader() { @@ -1079,7 +1079,7 @@ class RequestTest extends \Test\TestCase { $this->stream ); - $this->assertSame('from.host.header:8080', $request->getInsecureServerHost()); + $this->assertSame('from.host.header:8080', $request->getInsecureServerHost()); } public function testInsecureServerHostHttpFromForwardedHeaderSingle() { @@ -1108,7 +1108,7 @@ class RequestTest extends \Test\TestCase { $this->stream ); - $this->assertSame('from.forwarded.host:8080', $request->getInsecureServerHost()); + $this->assertSame('from.forwarded.host:8080', $request->getInsecureServerHost()); } public function testInsecureServerHostHttpFromForwardedHeaderStacked() { @@ -1137,7 +1137,7 @@ class RequestTest extends \Test\TestCase { $this->stream ); - $this->assertSame('from.forwarded.host2:8080', $request->getInsecureServerHost()); + $this->assertSame('from.forwarded.host2:8080', $request->getInsecureServerHost()); } public function testGetServerHostWithOverwriteHost() { @@ -1161,7 +1161,7 @@ class RequestTest extends \Test\TestCase { $this->stream ); - $this->assertSame('my.overwritten.host', $request->getServerHost()); + $this->assertSame('my.overwritten.host', $request->getServerHost()); } public function testGetServerHostWithTrustedDomain() { @@ -1190,7 +1190,7 @@ class RequestTest extends \Test\TestCase { $this->stream ); - $this->assertSame('my.trusted.host', $request->getServerHost()); + $this->assertSame('my.trusted.host', $request->getServerHost()); } public function testGetServerHostWithUntrustedDomain() { @@ -1219,7 +1219,7 @@ class RequestTest extends \Test\TestCase { $this->stream ); - $this->assertSame('my.trusted.host', $request->getServerHost()); + $this->assertSame('my.trusted.host', $request->getServerHost()); } public function testGetServerHostWithNoTrustedDomain() { @@ -1245,7 +1245,7 @@ class RequestTest extends \Test\TestCase { $this->stream ); - $this->assertSame('', $request->getServerHost()); + $this->assertSame('', $request->getServerHost()); } /** diff --git a/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php b/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php index 3eeac3ef103..5dd13942097 100644 --- a/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php @@ -68,7 +68,7 @@ class CompressionMiddlewareTest extends \Test\TestCase { ->willReturn(Http::STATUS_OK); $this->middleWare->beforeController($this->controller, 'myMethod'); - $this->middleWare->afterController($this->controller,'myMethod', $response); + $this->middleWare->afterController($this->controller, 'myMethod', $response); $output = 'myoutput'; $result = $this->middleWare->beforeOutput($this->controller, 'myMethod', $output); @@ -90,7 +90,7 @@ class CompressionMiddlewareTest extends \Test\TestCase { ->willReturn(Http::STATUS_OK); $this->middleWare->beforeController($this->controller, 'myMethod'); - $this->middleWare->afterController($this->controller,'myMethod', $response); + $this->middleWare->afterController($this->controller, 'myMethod', $response); $output = 'myoutput'; $result = $this->middleWare->beforeOutput($this->controller, 'myMethod', $output); @@ -112,7 +112,7 @@ class CompressionMiddlewareTest extends \Test\TestCase { ->willReturn(Http::STATUS_OK); $this->middleWare->beforeController($this->controller, 'myMethod'); - $this->middleWare->afterController($this->controller,'myMethod', $response); + $this->middleWare->afterController($this->controller, 'myMethod', $response); $output = 'myoutput'; $result = $this->middleWare->beforeOutput($this->controller, 'myMethod', $output); @@ -132,7 +132,7 @@ class CompressionMiddlewareTest extends \Test\TestCase { $response->method('getStatus') ->willReturn(Http::STATUS_OK); $this->middleWare->beforeController($this->controller, 'myMethod'); - $this->middleWare->afterController($this->controller,'myMethod', $response); + $this->middleWare->afterController($this->controller, 'myMethod', $response); $output = 'myoutput'; $result = $this->middleWare->beforeOutput($this->controller, 'myMethod', $output); @@ -153,7 +153,7 @@ class CompressionMiddlewareTest extends \Test\TestCase { ->willReturn(Http::STATUS_NOT_FOUND); $this->middleWare->beforeController($this->controller, 'myMethod'); - $this->middleWare->afterController($this->controller,'myMethod', $response); + $this->middleWare->afterController($this->controller, 'myMethod', $response); $output = 'myoutput'; $result = $this->middleWare->beforeOutput($this->controller, 'myMethod', $output); diff --git a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php index 786bac6d856..cc04992ae18 100644 --- a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php @@ -135,7 +135,7 @@ class BruteForceMiddlewareTest extends TestCase { /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */ $controller = $this->createMock(Controller::class); - $this->bruteForceMiddleware->afterController($controller, 'testMethod' ,$response); + $this->bruteForceMiddleware->afterController($controller, 'testMethod', $response); } public function testAfterControllerWithAnnotationAndNotThrottledRequest() { @@ -165,7 +165,7 @@ class BruteForceMiddlewareTest extends TestCase { /** @var Controller|\PHPUnit\Framework\MockObject\MockObject $controller */ $controller = $this->createMock(Controller::class); - $this->bruteForceMiddleware->afterController($controller, 'testMethod' ,$response); + $this->bruteForceMiddleware->afterController($controller, 'testMethod', $response); } public function testAfterControllerWithoutAnnotation() { @@ -188,6 +188,6 @@ class BruteForceMiddlewareTest extends TestCase { $controller = $this->createMock(Controller::class); /** @var Response|\PHPUnit\Framework\MockObject\MockObject $response */ $response = $this->createMock(Response::class); - $this->bruteForceMiddleware->afterController($controller, 'testMethod' ,$response); + $this->bruteForceMiddleware->afterController($controller, 'testMethod', $response); } } diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index bf84a631f74..1af2b2b9f1c 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -446,7 +446,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { * @SubAdminRequired */ public function testIsNotSubAdminCheck() { - $this->reader->reflect(__CLASS__,__FUNCTION__); + $this->reader->reflect(__CLASS__, __FUNCTION__); $sec = $this->getMiddleware(true, false, false); $this->expectException(SecurityException::class); @@ -458,7 +458,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { * @SubAdminRequired */ public function testIsSubAdminCheck() { - $this->reader->reflect(__CLASS__,__FUNCTION__); + $this->reader->reflect(__CLASS__, __FUNCTION__); $sec = $this->getMiddleware(true, false, true); $sec->beforeController($this, __METHOD__); @@ -470,7 +470,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { * @SubAdminRequired */ public function testIsSubAdminAndAdminCheck() { - $this->reader->reflect(__CLASS__,__FUNCTION__); + $this->reader->reflect(__CLASS__, __FUNCTION__); $sec = $this->getMiddleware(true, true, true); $sec->beforeController($this, __METHOD__); @@ -523,7 +523,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { new NotLoggedInException() ); $expected = new RedirectResponse('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp'); - $this->assertEquals($expected , $response); + $this->assertEquals($expected, $response); } public function testAfterExceptionRedirectsToWebRootAfterStrictCookieFail() { @@ -546,7 +546,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ); $expected = new RedirectResponse(\OC::$WEBROOT . '/'); - $this->assertEquals($expected , $response); + $this->assertEquals($expected, $response); } @@ -594,7 +594,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ); $expected = new TemplateResponse('core', '403', ['message' => $exception->getMessage()], 'guest'); $expected->setStatus($exception->getCode()); - $this->assertEquals($expected , $response); + $this->assertEquals($expected, $response); } public function testAfterAjaxExceptionReturnsJSONError() { @@ -624,7 +624,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { */ public function testRestrictedAppLoggedInPublicPage() { $middleware = $this->getMiddleware(true, false, false); - $this->reader->reflect(__CLASS__,__FUNCTION__); + $this->reader->reflect(__CLASS__, __FUNCTION__); $this->appManager->method('getAppPath') ->with('files') @@ -645,7 +645,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { */ public function testRestrictedAppNotLoggedInPublicPage() { $middleware = $this->getMiddleware(false, false, false); - $this->reader->reflect(__CLASS__,__FUNCTION__); + $this->reader->reflect(__CLASS__, __FUNCTION__); $this->appManager->method('getAppPath') ->with('files') @@ -665,7 +665,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { */ public function testRestrictedAppLoggedIn() { $middleware = $this->getMiddleware(true, false, false, false); - $this->reader->reflect(__CLASS__,__FUNCTION__); + $this->reader->reflect(__CLASS__, __FUNCTION__); $this->appManager->method('getAppPath') ->with('files') diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php index 7833e3a4953..dd5f25163f2 100644 --- a/tests/lib/Avatar/UserAvatarTest.php +++ b/tests/lib/Avatar/UserAvatarTest.php @@ -258,8 +258,8 @@ class UserAvatarTest extends \Test\TestCase { } public function testMixPalette() { - $colorFrom = new \OC\Color(0,0,0); - $colorTo = new \OC\Color(6,12,18); + $colorFrom = new \OC\Color(0, 0, 0); + $colorTo = new \OC\Color(6, 12, 18); $steps = 6; $palette = $this->invokePrivate($this->avatar, 'mixPalette', [$steps, $colorFrom, $colorTo]); foreach ($palette as $j => $color) { @@ -268,7 +268,7 @@ class UserAvatarTest extends \Test\TestCase { $incG = $colorTo->g / $steps * $j; $incB = $colorTo->b / $steps * $j; // ensure everything is equal - $this->assertEquals($color, new \OC\Color($incR, $incG,$incB)); + $this->assertEquals($color, new \OC\Color($incR, $incG, $incB)); } $hashToInt = $this->invokePrivate($this->avatar, 'hashToInt', ['abcdef', 18]); $this->assertTrue(gettype($hashToInt) === 'integer'); diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php index c9eafeca280..5791e28eb0c 100644 --- a/tests/lib/Cache/FileCacheTest.php +++ b/tests/lib/Cache/FileCacheTest.php @@ -63,7 +63,7 @@ class FileCacheTest extends TestCache { $this->storage = \OC\Files\Filesystem::getStorage('/'); \OC\Files\Filesystem::clearMounts(); $storage = new \OC\Files\Storage\Temporary([]); - \OC\Files\Filesystem::mount($storage,[],'/'); + \OC\Files\Filesystem::mount($storage, [], '/'); $datadir = str_replace('local::', '', $storage->getId()); $config = \OC::$server->getConfig(); $this->datadir = $config->getSystemValue('cachedirectory', \OC::$SERVERROOT.'/data/cache'); diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php index 6a568d7e01b..4a168cb0143 100644 --- a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php +++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php @@ -122,8 +122,7 @@ class ExpressionBuilderDBTest extends TestCase { $query->createFunction( '(' . $query->expr()->castColumn('configvalue', IQueryBuilder::PARAM_INT) . ' + 1)' - ) - , IQueryBuilder::PARAM_STR + ), IQueryBuilder::PARAM_STR ) ) ->where($query->expr()->eq('appid', $query->createNamedParameter($appId))) diff --git a/tests/lib/DateTimeFormatterTest.php b/tests/lib/DateTimeFormatterTest.php index 78ef0ef3ace..2ca880ec132 100644 --- a/tests/lib/DateTimeFormatterTest.php +++ b/tests/lib/DateTimeFormatterTest.php @@ -100,7 +100,7 @@ class DateTimeFormatterTest extends TestCase { ['in 2 years', $time, $this->getTimestampAgo($time, 0, 0, 0, 0, 2)], // Test with compare timestamp - ['today', $this->getTimestampAgo($time, 0, 0, 0, 0, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], + ['today', $this->getTimestampAgo($time, 0, 0, 0, 0, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], ['yesterday', $this->getTimestampAgo($time, 30, 15, 3, 1, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], ['4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], ['5 months ago', $this->getTimestampAgo($time, 30, 15, 3, 155, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php index fdfa08d87c4..30680646f73 100644 --- a/tests/lib/Encryption/Keys/StorageTest.php +++ b/tests/lib/Encryption/Keys/StorageTest.php @@ -452,7 +452,7 @@ class StorageTest extends TestCase { /** * @dataProvider dataProviderCopyRename */ - public function testCopyKeys($source, $target, $systemWideMountSource, $systemWideMountTarget , $expectedSource, $expectedTarget) { + public function testCopyKeys($source, $target, $systemWideMountSource, $systemWideMountTarget, $expectedSource, $expectedTarget) { $this->view->expects($this->any()) ->method('file_exists') ->willReturn(true); diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php index 744a779288d..7f8e1af1577 100644 --- a/tests/lib/Files/Cache/CacheTest.php +++ b/tests/lib/Files/Cache/CacheTest.php @@ -399,23 +399,17 @@ class CacheTest extends \Test\TestCase { $user = $this->createMock(IUser::class); $this->assertCount(1, $this->cache->searchQuery(new SearchQuery( - new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', 'foo') - , 10, 0, [], $user))); + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', 'foo'), 10, 0, [], $user))); $this->assertCount(2, $this->cache->searchQuery(new SearchQuery( - new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', 'foo%') - , 10, 0, [], $user))); + new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', 'foo%'), 10, 0, [], $user))); $this->assertCount(2, $this->cache->searchQuery(new SearchQuery( - new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'foo/file') - , 10, 0, [], $user))); + new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'foo/file'), 10, 0, [], $user))); $this->assertCount(3, $this->cache->searchQuery(new SearchQuery( - new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', 'foo/%') - , 10, 0, [], $user))); + new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', 'foo/%'), 10, 0, [], $user))); $this->assertCount(1, $this->cache->searchQuery(new SearchQuery( - new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, 'size', 100) - , 10, 0, [], $user))); + new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, 'size', 100), 10, 0, [], $user))); $this->assertCount(2, $this->cache->searchQuery(new SearchQuery( - new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN_EQUAL, 'size', 100) - , 10, 0, [], $user))); + new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN_EQUAL, 'size', 100), 10, 0, [], $user))); } public function movePathProvider() { diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php index 85a68be3daf..5ebfd48d1a6 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php @@ -89,7 +89,7 @@ class ObjectStoreStorageTest extends Storage { */ public function testMove($source, $target) { $this->initSourceAndTarget($source); - $sourceId = $this->instance->getCache()->getId(ltrim('/',$source)); + $sourceId = $this->instance->getCache()->getId(ltrim('/', $source)); $this->assertNotEquals(-1, $sourceId); $this->instance->rename($source, $target); @@ -98,7 +98,7 @@ class ObjectStoreStorageTest extends Storage { $this->assertFalse($this->instance->file_exists($source), $source.' still exists'); $this->assertSameAsLorem($target); - $targetId = $this->instance->getCache()->getId(ltrim('/',$target)); + $targetId = $this->instance->getCache()->getId(ltrim('/', $target)); $this->assertSame($sourceId, $targetId, 'fileid must be stable on move or shares will break'); } diff --git a/tests/lib/L10N/L10nTest.php b/tests/lib/L10N/L10nTest.php index 3fb22b3f66e..9f6337ba804 100644 --- a/tests/lib/L10N/L10nTest.php +++ b/tests/lib/L10N/L10nTest.php @@ -45,7 +45,7 @@ class L10nTest extends TestCase { public function testRussianPluralTranslations() { $transFile = \OC::$SERVERROOT.'/tests/data/l10n/ru.json'; - $l = new L10N($this->getFactory(), 'test', 'ru', 'ru_UA',[$transFile]); + $l = new L10N($this->getFactory(), 'test', 'ru', 'ru_UA', [$transFile]); $this->assertEquals('1 файл', (string)$l->n('%n file', '%n files', 1)); $this->assertEquals('2 файла', (string)$l->n('%n file', '%n files', 2)); diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php index b0641ae332f..f30630824fc 100644 --- a/tests/lib/Mail/MessageTest.php +++ b/tests/lib/Mail/MessageTest.php @@ -113,7 +113,7 @@ class MessageTest extends TestCase { /** * @dataProvider getMailAddressProvider */ - public function testGetTo($swiftresult,$return) { + public function testGetTo($swiftresult, $return) { $this->swiftMessage ->expects($this->once()) ->method('getTo') @@ -133,7 +133,7 @@ class MessageTest extends TestCase { /** * @dataProvider getMailAddressProvider */ - public function testGetCc($swiftresult,$return) { + public function testGetCc($swiftresult, $return) { $this->swiftMessage ->expects($this->once()) ->method('getCc') @@ -153,7 +153,7 @@ class MessageTest extends TestCase { /** * @dataProvider getMailAddressProvider */ - public function testGetBcc($swiftresult,$return) { + public function testGetBcc($swiftresult, $return) { $this->swiftMessage ->expects($this->once()) ->method('getBcc') diff --git a/tests/lib/Security/HasherTest.php b/tests/lib/Security/HasherTest.php index 5836703504e..a81f98533ce 100644 --- a/tests/lib/Security/HasherTest.php +++ b/tests/lib/Security/HasherTest.php @@ -197,7 +197,7 @@ class HasherTest extends \Test\TestCase { } - $this->assertTrue($this->hasher->verify($message, $blowfish,$newHash)); + $this->assertTrue($this->hasher->verify($message, $blowfish, $newHash)); $this->assertTrue($this->hasher->verify($message, $argon2)); $relativePath = self::invokePrivate($this->hasher, 'splitHash', [$newHash]); diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index 40626bdb571..03e1bdb4346 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -951,7 +951,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId)->willReturn([$file]); - $share = $this->provider->getSharedWith('sharedWith', IShare::TYPE_USER, null, 1 , 0); + $share = $this->provider->getSharedWith('sharedWith', IShare::TYPE_USER, null, 1, 0); $this->assertCount(1, $share); $share = $share[0]; @@ -1023,7 +1023,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId)->willReturn([$file]); - $share = $this->provider->getSharedWith('sharedWith', IShare::TYPE_GROUP, null, 20 , 1); + $share = $this->provider->getSharedWith('sharedWith', IShare::TYPE_GROUP, null, 20, 1); $this->assertCount(1, $share); $share = $share[0]; @@ -1267,7 +1267,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ]); $this->groupManager->method('getUserGroupIds')->with($user)->willReturn($groups); - $share = $this->provider->getSharedWith('sharedWith', $shareType, null, 1 , 0); + $share = $this->provider->getSharedWith('sharedWith', $shareType, null, 1, 0); $this->assertCount(0, $share); } diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index f1a53200f5f..93f33fe30b9 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -481,7 +481,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $date = new \DateTime(); - $date->setTime(0,0,0); + $date->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($date) @@ -594,30 +594,30 @@ class ManagerTest extends \Test\TestCase { ->willReturn($storage); $data = [ - [$this->createShare(null, IShare::TYPE_USER, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], - [$this->createShare(null, IShare::TYPE_USER, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], - [$this->createShare(null, IShare::TYPE_USER, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], + [$this->createShare(null, IShare::TYPE_USER, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], + [$this->createShare(null, IShare::TYPE_USER, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], + [$this->createShare(null, IShare::TYPE_USER, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], [$this->createShare(null, IShare::TYPE_GROUP, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], [$this->createShare(null, IShare::TYPE_GROUP, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], [$this->createShare(null, IShare::TYPE_GROUP, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], - [$this->createShare(null, IShare::TYPE_LINK, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], - [$this->createShare(null, IShare::TYPE_LINK, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], - [$this->createShare(null, IShare::TYPE_LINK, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith should be empty', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith should be empty', true], [$this->createShare(null, -1, $file, null, $user0, $user0, 31, null, null), 'unknown share type', true], - [$this->createShare(null, IShare::TYPE_USER, $file, $user2, null, $user0, 31, null, null), 'SharedBy should be set', true], + [$this->createShare(null, IShare::TYPE_USER, $file, $user2, null, $user0, 31, null, null), 'SharedBy should be set', true], [$this->createShare(null, IShare::TYPE_GROUP, $file, $group0, null, $user0, 31, null, null), 'SharedBy should be set', true], - [$this->createShare(null, IShare::TYPE_LINK, $file, null, null, $user0, 31, null, null), 'SharedBy should be set', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, null, null, $user0, 31, null, null), 'SharedBy should be set', true], - [$this->createShare(null, IShare::TYPE_USER, $file, $user0, $user0, $user0, 31, null, null), 'Cannot share with yourself', true], + [$this->createShare(null, IShare::TYPE_USER, $file, $user0, $user0, $user0, 31, null, null), 'Cannot share with yourself', true], - [$this->createShare(null, IShare::TYPE_USER, null, $user2, $user0, $user0, 31, null, null), 'Path should be set', true], + [$this->createShare(null, IShare::TYPE_USER, null, $user2, $user0, $user0, 31, null, null), 'Path should be set', true], [$this->createShare(null, IShare::TYPE_GROUP, null, $group0, $user0, $user0, 31, null, null), 'Path should be set', true], - [$this->createShare(null, IShare::TYPE_LINK, null, null, $user0, $user0, 31, null, null), 'Path should be set', true], + [$this->createShare(null, IShare::TYPE_LINK, null, null, $user0, $user0, 31, null, null), 'Path should be set', true], - [$this->createShare(null, IShare::TYPE_USER, $node, $user2, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], + [$this->createShare(null, IShare::TYPE_USER, $node, $user2, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], [$this->createShare(null, IShare::TYPE_GROUP, $node, $group0, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], - [$this->createShare(null, IShare::TYPE_LINK, $node, null, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], + [$this->createShare(null, IShare::TYPE_LINK, $node, null, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], ]; $nonShareAble = $this->createMock(Folder::class); @@ -629,9 +629,9 @@ class ManagerTest extends \Test\TestCase { $nonShareAble->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonShareAble, $user2, $user0, $user0, 31, null, null), 'You are not allowed to share name', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonShareAble, $user2, $user0, $user0, 31, null, null), 'You are not allowed to share name', true]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $nonShareAble, $group0, $user0, $user0, 31, null, null), 'You are not allowed to share name', true]; - $data[] = [$this->createShare(null, IShare::TYPE_LINK, $nonShareAble, null, $user0, $user0, 31, null, null), 'You are not allowed to share name', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $nonShareAble, null, $user0, $user0, 31, null, null), 'You are not allowed to share name', true]; $limitedPermssions = $this->createMock(File::class); $limitedPermssions->method('isShareable')->willReturn(true); @@ -644,17 +644,17 @@ class ManagerTest extends \Test\TestCase { $limitedPermssions->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, null, null, null), 'A share requires permissions', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, null, null, null), 'A share requires permissions', true]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, null, null, null), 'A share requires permissions', true]; - $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, null, null, null), 'A share requires permissions', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, null, null, null), 'A share requires permissions', true]; $mount = $this->createMock(MoveableMount::class); $limitedPermssions->method('getMountPoint')->willReturn($mount); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, 31, null, null), 'Cannot increase permissions of path', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, 31, null, null), 'Cannot increase permissions of path', true]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, 17, null, null), 'Cannot increase permissions of path', true]; - $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, 3, null, null), 'Cannot increase permissions of path', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, 3, null, null), 'Cannot increase permissions of path', true]; $nonMoveableMountPermssions = $this->createMock(Folder::class); $nonMoveableMountPermssions->method('isShareable')->willReturn(true); @@ -667,7 +667,7 @@ class ManagerTest extends \Test\TestCase { $nonMoveableMountPermssions->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonMoveableMountPermssions, $user2, $user0, $user0, 11, null, null), 'Cannot increase permissions of path', false]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonMoveableMountPermssions, $user2, $user0, $user0, 11, null, null), 'Cannot increase permissions of path', false]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $nonMoveableMountPermssions, $group0, $user0, $user0, 11, null, null), 'Cannot increase permissions of path', false]; $rootFolder = $this->createMock(Folder::class); @@ -675,9 +675,9 @@ class ManagerTest extends \Test\TestCase { $rootFolder->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_ALL); $rootFolder->method('getId')->willReturn(42); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $rootFolder, $user2, $user0, $user0, 30, null, null), 'You cannot share your root folder', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $rootFolder, $user2, $user0, $user0, 30, null, null), 'You cannot share your root folder', true]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $rootFolder, $group0, $user0, $user0, 2, null, null), 'You cannot share your root folder', true]; - $data[] = [$this->createShare(null, IShare::TYPE_LINK, $rootFolder, null, $user0, $user0, 16, null, null), 'You cannot share your root folder', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $rootFolder, null, $user0, $user0, 16, null, null), 'You cannot share your root folder', true]; $allPermssions = $this->createMock(Folder::class); $allPermssions->method('isShareable')->willReturn(true); @@ -688,12 +688,12 @@ class ManagerTest extends \Test\TestCase { $allPermssions->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 30, null, null), 'Shares need at least read permissions', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 30, null, null), 'Shares need at least read permissions', true]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 2, null, null), 'Shares need at least read permissions', true]; - $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 31, null, null), null, false]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 31, null, null), null, false]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 3, null, null), null, false]; - $data[] = [$this->createShare(null, IShare::TYPE_LINK, $allPermssions, null, $user0, $user0, 17, null, null), null, false]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $allPermssions, null, $user0, $user0, 17, null, null), null, false]; $remoteStorage = $this->createMock(Storage\IStorage::class); @@ -889,7 +889,7 @@ class ManagerTest extends \Test\TestCase { } $expected = new \DateTime(); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $expected->add(new \DateInterval('P3D')); self::invokePrivate($this->manager, 'validateExpirationDateInternal', [$share]); @@ -924,7 +924,7 @@ class ManagerTest extends \Test\TestCase { } $expected = new \DateTime(); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $expected->add(new \DateInterval('P1D')); self::invokePrivate($this->manager, 'validateExpirationDateInternal', [$share]); @@ -972,10 +972,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateInternalEnforceValid($shareType) { $future = new \DateTime(); $future->add(new \DateInterval('P2D')); - $future->setTime(1,2,3); + $future->setTime(1, 2, 3); $expected = clone $future; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setShareType($shareType); @@ -1014,10 +1014,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateInternalNoDefault($shareType) { $date = new \DateTime(); $date->add(new \DateInterval('P5D')); - $date->setTime(1,2,3); + $date->setTime(1, 2, 3); $expected = clone $date; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setShareType($shareType); @@ -1062,7 +1062,7 @@ class ManagerTest extends \Test\TestCase { $expected = new \DateTime(); $expected->add(new \DateInterval('P3D')); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); if ($shareType === IShare::TYPE_USER) { $this->config->method('getAppValue') @@ -1097,10 +1097,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateInternalDefault($shareType) { $future = new \DateTime(); $future->add(new \DateInterval('P5D')); - $future->setTime(1,2,3); + $future->setTime(1, 2, 3); $expected = clone $future; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setShareType($shareType); @@ -1139,7 +1139,7 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateInternalHookModification($shareType) { $nextWeek = new \DateTime(); $nextWeek->add(new \DateInterval('P7D')); - $nextWeek->setTime(0,0,0); + $nextWeek->setTime(0, 0, 0); $save = clone $nextWeek; @@ -1168,7 +1168,7 @@ class ManagerTest extends \Test\TestCase { $nextWeek = new \DateTime(); $nextWeek->add(new \DateInterval('P7D')); - $nextWeek->setTime(0,0,0); + $nextWeek->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setShareType($shareType); @@ -1267,7 +1267,7 @@ class ManagerTest extends \Test\TestCase { ]); $expected = new \DateTime(); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $expected->add(new \DateInterval('P3D')); self::invokePrivate($this->manager, 'validateExpirationDateLink', [$share]); @@ -1288,7 +1288,7 @@ class ManagerTest extends \Test\TestCase { ]); $expected = new \DateTime(); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $expected->add(new \DateInterval('P1D')); self::invokePrivate($this->manager, 'validateExpirationDateLink', [$share]); @@ -1320,10 +1320,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateEnforceValid() { $future = new \DateTime(); $future->add(new \DateInterval('P2D')); - $future->setTime(1,2,3); + $future->setTime(1, 2, 3); $expected = clone $future; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($future); @@ -1349,10 +1349,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateNoDefault() { $date = new \DateTime(); $date->add(new \DateInterval('P5D')); - $date->setTime(1,2,3); + $date->setTime(1, 2, 3); $expected = clone $date; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($date); @@ -1388,7 +1388,7 @@ class ManagerTest extends \Test\TestCase { $expected = new \DateTime(); $expected->add(new \DateInterval('P3D')); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $this->config->method('getAppValue') ->willReturnMap([ @@ -1411,10 +1411,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateDefault() { $future = new \DateTime(); $future->add(new \DateInterval('P5D')); - $future->setTime(1,2,3); + $future->setTime(1, 2, 3); $expected = clone $future; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($future); @@ -1440,7 +1440,7 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateHookModification() { $nextWeek = new \DateTime(); $nextWeek->add(new \DateInterval('P7D')); - $nextWeek->setTime(0,0,0); + $nextWeek->setTime(0, 0, 0); $save = clone $nextWeek; @@ -1465,7 +1465,7 @@ class ManagerTest extends \Test\TestCase { $nextWeek = new \DateTime(); $nextWeek->add(new \DateInterval('P7D')); - $nextWeek->setTime(0,0,0); + $nextWeek->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($nextWeek); @@ -2623,7 +2623,7 @@ class ManagerTest extends \Test\TestCase { } $today = new \DateTime(); - $today->setTime(0,0,0); + $today->setTime(0, 0, 0); /* * Set the expiration date to today for some shares @@ -2851,7 +2851,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $date = new \DateTime(); - $date->setTime(0,0,0); + $date->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($date); @@ -2875,7 +2875,7 @@ class ManagerTest extends \Test\TestCase { ->willReturn('yes'); $date = new \DateTime(); - $date->setTime(0,0,0); + $date->setTime(0, 0, 0); $date->add(new \DateInterval('P2D')); $share = $this->manager->newShare(); $share->setExpirationDate($date); @@ -3195,7 +3195,7 @@ class ManagerTest extends \Test\TestCase { ->setPermissions(15); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3276,7 +3276,7 @@ class ManagerTest extends \Test\TestCase { ->setPermissions(15); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3342,7 +3342,7 @@ class ManagerTest extends \Test\TestCase { ->setPermissions(\OCP\Constants::PERMISSION_ALL); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3424,7 +3424,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3507,7 +3507,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3598,7 +3598,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3671,7 +3671,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3744,7 +3744,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3817,7 +3817,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3891,7 +3891,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(true); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3965,7 +3965,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(true); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php index ad8b01555ea..aa56959d3cb 100644 --- a/tests/lib/User/UserTest.php +++ b/tests/lib/User/UserTest.php @@ -117,7 +117,7 @@ class UserTest extends TestCase { }); $user = new User('foo', $backend, $this->dispatcher); - $this->assertTrue($user->setPassword('bar','')); + $this->assertTrue($user->setPassword('bar', '')); } public function testSetPasswordNotSupported() { @@ -133,7 +133,7 @@ class UserTest extends TestCase { ->willReturn(false); $user = new User('foo', $backend, $this->dispatcher); - $this->assertFalse($user->setPassword('bar','')); + $this->assertFalse($user->setPassword('bar', '')); } public function testChangeAvatarSupportedYes() { @@ -389,12 +389,12 @@ class UserTest extends TestCase { $backend->expects($this->once()) ->method('setDisplayName') - ->with('foo','Foo') + ->with('foo', 'Foo') ->willReturn(true); $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->setDisplayName('Foo')); - $this->assertEquals('Foo',$user->getDisplayName()); + $this->assertEquals('Foo', $user->getDisplayName()); } /** @@ -418,7 +418,7 @@ class UserTest extends TestCase { $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->setDisplayName(' ')); - $this->assertEquals('foo',$user->getDisplayName()); + $this->assertEquals('foo', $user->getDisplayName()); } public function testSetDisplayNameNotSupported() { @@ -436,7 +436,7 @@ class UserTest extends TestCase { $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->setDisplayName('Foo')); - $this->assertEquals('foo',$user->getDisplayName()); + $this->assertEquals('foo', $user->getDisplayName()); } public function testSetPasswordHooks() { @@ -476,7 +476,7 @@ class UserTest extends TestCase { $user = new User('foo', $backend, $this->dispatcher, $emitter); - $user->setPassword('bar',''); + $user->setPassword('bar', ''); $this->assertEquals(2, $hooksCalled); }