Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): Bump nextcloud/coding-standard from 1.2.1 to 1.2.3 #586

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected function translatePath(IStorage $storage, string $path): string {
return 'files/' . $innerPath;
} elseif ($folder === 'thumbnails') {
[$fileId,] = explode('/', $innerPath, 2);
$innerPath = $storage->getCache()->getPathById((int) $fileId);
$innerPath = $storage->getCache()->getPathById((int)$fileId);

if ($innerPath !== null) {
return 'files/' . $innerPath;
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function theWebdavResponseShouldHaveAStatusCode($statusCode) {
if (str_contains($statusCode, '|')) {
$statusCodes = array_map('intval', explode('|', $statusCode));
} else {
$statusCodes = [(int) $statusCode];
$statusCodes = [(int)$statusCode];
}
if (!in_array($this->response->getStatusCode(), $statusCodes, true)) {
throw new \Exception("Expected $statusCode, got ".$this->response->getStatusCode());
Expand Down
86 changes: 43 additions & 43 deletions tests/Integration/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

trait WebDav {
/** @var string */
private $davPath = "remote.php/webdav";
private $davPath = 'remote.php/webdav';
/** @var boolean */
private $usingOldDavPath = true;
/** @var array map with user as key and another map as value, which has path as key and etag as value */
Expand All @@ -30,15 +30,15 @@ public function usingDavPath($davPath) {
* @Given /^using old dav path$/
*/
public function usingOldDavPath() {
$this->davPath = "remote.php/webdav";
$this->davPath = 'remote.php/webdav';
$this->usingOldDavPath = true;
}

/**
* @Given /^using new dav path$/
*/
public function usingNewDavPath() {
$this->davPath = "remote.php/dav";
$this->davPath = 'remote.php/dav';
$this->usingOldDavPath = false;
}

Expand All @@ -50,10 +50,10 @@ public function getDavFilesPath($user) {
}
}

public function makeDavRequest($user, $method, $path, $headers, $body = null, $type = "files") {
if ($type === "files") {
public function makeDavRequest($user, $method, $path, $headers, $body = null, $type = 'files') {
if ($type === 'files') {
$fullUrl = $this->baseUrl . $this->getDavFilesPath($user) . "$path";
} elseif ($type === "uploads") {
} elseif ($type === 'uploads') {
$fullUrl = $this->baseUrl . $this->davPath . "$path";
} else {
$fullUrl = $this->baseUrl . $this->davPath . '/' . $type . "$path";
Expand All @@ -80,7 +80,7 @@ public function makeDavRequest($user, $method, $path, $headers, $body = null, $t
public function userMovedFile($user, $entry, $fileSource, $fileDestination) {
$fullUrl = $this->baseUrl . $this->getDavFilesPath($user);
$headers['Destination'] = $fullUrl . $fileDestination;
$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
$this->response = $this->makeDavRequest($user, 'MOVE', $fileSource, $headers);
Assert::assertEquals(201, $this->response->getStatusCode());
}

Expand All @@ -94,7 +94,7 @@ public function userMovesFile($user, $entry, $fileSource, $fileDestination) {
$fullUrl = $this->baseUrl . $this->getDavFilesPath($user);
$headers['Destination'] = $fullUrl . $fileDestination;
try {
$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
$this->response = $this->makeDavRequest($user, 'MOVE', $fileSource, $headers);
} catch (\GuzzleHttp\Exception\ClientException $e) {
$this->response = $e->getResponse();
}
Expand Down Expand Up @@ -126,7 +126,7 @@ public function userCopiesFileTo($user, $entry, $fileSource, $fileDestination) {
public function downloadFileWithRange($fileSource, $range) {
$headers['Range'] = $range;
try {
$this->response = $this->makeDavRequest($this->currentUser, "GET", $fileSource, $headers);
$this->response = $this->makeDavRequest($this->currentUser, 'GET', $fileSource, $headers);
} catch (\GuzzleHttp\Exception\ClientException $e) {
$this->response = $e->getResponse();
}
Expand All @@ -138,16 +138,16 @@ public function downloadFileWithRange($fileSource, $range) {
*/
public function downloadPublicFileWithRange($range) {
$token = $this->lastShareData->data->token;
$fullUrl = $this->baseUrl . "public.php/webdav";
$fullUrl = $this->baseUrl . 'public.php/webdav';

$client = new GClient();
$options = [];
$options['auth'] = [$token, ""];
$options['auth'] = [$token, ''];
$options['headers'] = [
'Range' => $range
];

$this->response = $client->request("GET", $fullUrl, $options);
$this->response = $client->request('GET', $fullUrl, $options);
}

/**
Expand All @@ -156,17 +156,17 @@ public function downloadPublicFileWithRange($range) {
*/
public function downloadPublicFileInsideAFolderWithRange($path, $range) {
$token = $this->lastShareData->data->token;
$fullUrl = $this->baseUrl . "public.php/webdav" . "$path";
$fullUrl = $this->baseUrl . 'public.php/webdav' . "$path";

$client = new GClient();
$options = [
'headers' => [
'Range' => $range
]
];
$options['auth'] = [$token, ""];
$options['auth'] = [$token, ''];

$this->response = $client->request("GET", $fullUrl, $options);
$this->response = $client->request('GET', $fullUrl, $options);
}

/**
Expand Down Expand Up @@ -314,7 +314,7 @@ public function theSingleResponseShouldContainAPropertyWithValue($key, $expected
public function theResponseShouldContainAShareTypesPropertyWith($table) {
$keys = $this->response;
if (!array_key_exists('{http://owncloud.org/ns}share-types', $keys)) {
throw new \Exception("Cannot find property \"{http://owncloud.org/ns}share-types\"");
throw new \Exception('Cannot find property "{http://owncloud.org/ns}share-types"');
}

$foundTypes = [];
Expand Down Expand Up @@ -481,7 +481,7 @@ public function searchFile(string $user, ?string $properties = null, ?string $sc
</d:searchrequest>';

try {
$this->response = $this->makeDavRequest($user, "SEARCH", '', [
$this->response = $this->makeDavRequest($user, 'SEARCH', '', [
'Content-Type' => 'text/xml'
], $body, '');
} catch (\GuzzleHttp\Exception\ServerException $e) {
Expand Down Expand Up @@ -555,9 +555,9 @@ public function checkElementList($user, $expectedElements) {
$elementRows = $expectedElements->getRows();
$elementsSimplified = $this->simplifyArray($elementRows);
foreach ($elementsSimplified as $expectedElement) {
$webdavPath = "/" . $this->getDavFilesPath($user) . $expectedElement;
$webdavPath = '/' . $this->getDavFilesPath($user) . $expectedElement;
if (!array_key_exists($webdavPath, $elementList)) {
Assert::fail("$webdavPath" . " is not in propfind answer");
Assert::fail("$webdavPath" . ' is not in propfind answer');
}
}
}
Expand All @@ -572,7 +572,7 @@ public function checkElementList($user, $expectedElements) {
public function userUploadsAFileTo($user, $source, $destination) {
$file = \GuzzleHttp\Psr7\Utils::streamFor(fopen($source, 'r'));
try {
$this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file);
$this->response = $this->makeDavRequest($user, 'PUT', $destination, [], $file);
} catch (\GuzzleHttp\Exception\ServerException $e) {
// 5xx responses cause a server exception
$this->response = $e->getResponse();
Expand All @@ -589,11 +589,11 @@ public function userUploadsAFileTo($user, $source, $destination) {
* @param string $destination
*/
public function userAddsAFileTo($user, $bytes, $destination) {
$filename = "filespecificSize.txt";
$filename = 'filespecificSize.txt';
$this->createFileSpecificSize($filename, $bytes);
Assert::assertEquals(1, file_exists("work/$filename"));
$this->userUploadsAFileTo($user, "work/$filename", $destination);
$this->removeFile("work/", $filename);
$this->removeFile('work/', $filename);
$expectedElements = new \Behat\Gherkin\Node\TableNode([["$destination"]]);
$this->checkElementList($user, $expectedElements);
}
Expand All @@ -604,7 +604,7 @@ public function userAddsAFileTo($user, $bytes, $destination) {
public function userUploadsAFileWithContentTo($user, $content, $destination) {
$file = \GuzzleHttp\Psr7\Utils::streamFor($content);
try {
$this->response = $this->makeDavRequest($user, "PUT", $destination, [], $file);
$this->response = $this->makeDavRequest($user, 'PUT', $destination, [], $file);
} catch (\GuzzleHttp\Exception\ServerException $e) {
// 5xx responses cause a server exception
$this->response = $e->getResponse();
Expand Down Expand Up @@ -650,7 +650,7 @@ public function emptyTrashbin($user) {
public function userCreatedAFolder($user, $destination) {
try {
$destination = '/' . ltrim($destination, '/');
$this->response = $this->makeDavRequest($user, "MKCOL", $destination, []);
$this->response = $this->makeDavRequest($user, 'MKCOL', $destination, []);
} catch (\GuzzleHttp\Exception\ServerException $e) {
// 5xx responses cause a server exception
$this->response = $e->getResponse();
Expand All @@ -672,7 +672,7 @@ public function userUploadsChunkFileOfWithToWithChecksum($user, $num, $total, $d
$num -= 1;
$data = \GuzzleHttp\Psr7\Utils::streamFor($data);
$file = $destination . '-chunking-42-' . $total . '-' . $num;
$this->makeDavRequest($user, 'PUT', $file, ['OC-Chunked' => '1'], $data, "uploads");
$this->makeDavRequest($user, 'PUT', $file, ['OC-Chunked' => '1'], $data, 'uploads');
}

/**
Expand All @@ -686,28 +686,28 @@ public function userUploadsChunkFileOfWithToWithChecksum($user, $num, $total, $d
* @param string $content3
*/
public function userUploadsBulkedFiles($user, $name1, $content1, $name2, $content2, $name3, $content3) {
$boundary = "boundary_azertyuiop";
$boundary = 'boundary_azertyuiop';

$body = "";
$body = '';
$body .= '--'.$boundary."\r\n";
$body .= "X-File-Path: ".$name1."\r\n";
$body .= 'X-File-Path: '.$name1."\r\n";
$body .= "X-File-MD5: f6a6263167c92de8644ac998b3c4e4d1\r\n";
$body .= "X-OC-Mtime: 1111111111\r\n";
$body .= "Content-Length: ".strlen($content1)."\r\n";
$body .= 'Content-Length: '.strlen($content1)."\r\n";
$body .= "\r\n";
$body .= $content1."\r\n";
$body .= '--'.$boundary."\r\n";
$body .= "X-File-Path: ".$name2."\r\n";
$body .= 'X-File-Path: '.$name2."\r\n";
$body .= "X-File-MD5: 87c7d4068be07d390a1fffd21bf1e944\r\n";
$body .= "X-OC-Mtime: 2222222222\r\n";
$body .= "Content-Length: ".strlen($content2)."\r\n";
$body .= 'Content-Length: '.strlen($content2)."\r\n";
$body .= "\r\n";
$body .= $content2."\r\n";
$body .= '--'.$boundary."\r\n";
$body .= "X-File-Path: ".$name3."\r\n";
$body .= 'X-File-Path: '.$name3."\r\n";
$body .= "X-File-MD5: e86a1cf0678099986a901c79086f5617\r\n";
$body .= "X-File-Mtime: 3333333333\r\n";
$body .= "Content-Length: ".strlen($content3)."\r\n";
$body .= 'Content-Length: '.strlen($content3)."\r\n";
$body .= "\r\n";
$body .= $content3."\r\n";
$body .= '--'.$boundary."--\r\n";
Expand All @@ -726,15 +726,15 @@ public function userUploadsBulkedFiles($user, $name1, $content1, $name2, $conten
'body' => $body
];

return $client->request("POST", $this->baseUrl . "remote.php/dav/bulk", $options);
return $client->request('POST', $this->baseUrl . 'remote.php/dav/bulk', $options);
}

/**
* @Given user :user creates a new chunking upload with id :id
*/
public function userCreatesANewChunkingUploadWithId($user, $id) {
$destination = '/uploads/' . $user . '/' . $id;
$this->makeDavRequest($user, 'MKCOL', $destination, [], null, "uploads");
$this->makeDavRequest($user, 'MKCOL', $destination, [], null, 'uploads');
}

/**
Expand All @@ -743,7 +743,7 @@ public function userCreatesANewChunkingUploadWithId($user, $id) {
public function userUploadsNewChunkFileOfWithToId($user, $num, $data, $id) {
$data = \GuzzleHttp\Psr7\Utils::streamFor($data);
$destination = '/uploads/' . $user . '/' . $id . '/' . $num;
$this->makeDavRequest($user, 'PUT', $destination, [], $data, "uploads");
$this->makeDavRequest($user, 'PUT', $destination, [], $data, 'uploads');
}

/**
Expand All @@ -754,7 +754,7 @@ public function userMovesNewChunkFileWithIdToMychunkedfile($user, $id, $dest) {
$destination = $this->baseUrl . $this->getDavFilesPath($user) . $dest;
$this->makeDavRequest($user, 'MOVE', $source, [
'Destination' => $destination
], null, "uploads");
], null, 'uploads');
}

/**
Expand All @@ -768,7 +768,7 @@ public function userMovesNewChunkFileWithIdToMychunkedfileWithSize($user, $id, $
$this->response = $this->makeDavRequest($user, 'MOVE', $source, [
'Destination' => $destination,
'OC-Total-Length' => $size
], null, "uploads");
], null, 'uploads');
} catch (\GuzzleHttp\Exception\BadResponseException $ex) {
$this->response = $ex->getResponse();
}
Expand Down Expand Up @@ -906,9 +906,9 @@ public function checkFavoritedElements($user, $folder, $expectedElements) {
$elementRows = $expectedElements->getRows();
$elementsSimplified = $this->simplifyArray($elementRows);
foreach ($elementsSimplified as $expectedElement) {
$webdavPath = "/" . $this->getDavFilesPath($user) . $expectedElement;
$webdavPath = '/' . $this->getDavFilesPath($user) . $expectedElement;
if (!array_key_exists($webdavPath, $elementList)) {
Assert::fail("$webdavPath" . " is not in report answer");
Assert::fail("$webdavPath" . ' is not in report answer');
}
}
}
Expand All @@ -923,12 +923,12 @@ public function userDeletesEverythingInFolder($user, $folder) {
$elementList = $this->listFolder($user, $folder, 1);
$elementListKeys = array_keys($elementList);
array_shift($elementListKeys);
$davPrefix = "/" . $this->getDavFilesPath($user);
$davPrefix = '/' . $this->getDavFilesPath($user);
foreach ($elementListKeys as $element) {
if (substr($element, 0, strlen($davPrefix)) == $davPrefix) {
$element = substr($element, strlen($davPrefix));
}
$this->userDeletesFile($user, "element", $element);
$this->userDeletesFile($user, 'element', $element);
}
}

Expand Down Expand Up @@ -963,7 +963,7 @@ public function userSeesNoFilesInTheTrashbin($user) {
* @return int
*/
private function getFileIdForPath($user, $path) {
$propertiesTable = new \Behat\Gherkin\Node\TableNode([["{http://owncloud.org/ns}fileid"]]);
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{http://owncloud.org/ns}fileid']]);
$this->asGetsPropertiesOfFolderWith($user, 'file', $path, $propertiesTable);
return (int)$this->response['{http://owncloud.org/ns}fileid'];
}
Expand Down
Loading