Check style update

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
pull/30508/head
Carl Schwan 2 years ago
parent aeecb72e96
commit 6312c0df69
No known key found for this signature in database
GPG Key ID: 06B35D38387B67BE

@ -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);

@ -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');

@ -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('<error>Can not go back to previous migration without debug enabled</error>');
return 1;
}

@ -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('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>');
return 1;
}

@ -247,8 +247,7 @@ class Upgrade extends Command {
$output->write('<comment>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.</comment>'
, true);
. 'config.php and call this script again.</comment>', true);
return self::ERROR_MAINTENANCE_MODE;
} else {
$output->writeln('<info>Nextcloud is already latest version</info>');

@ -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("<error>Passwords did not match!</error>");

@ -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') {

@ -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,
]);

@ -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()]);

@ -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);

@ -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,

@ -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];
}

@ -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(

@ -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();
}

@ -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);

@ -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);
}

@ -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)) {

@ -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;
}

@ -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;

@ -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'
]);

@ -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));

@ -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) === '') {

@ -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

@ -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',
]);

@ -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) {

@ -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');

@ -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);

@ -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) {

@ -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);
}

@ -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

@ -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');

@ -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();

@ -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());
}
/**

@ -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);

@ -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);
}
}

@ -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')

@ -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');

@ -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');

@ -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)))

@ -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)],

@ -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);

@ -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() {

@ -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');
}

@ -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));

@ -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')

@ -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]);

@ -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);
}

@ -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);

@ -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);
}

Loading…
Cancel
Save