Merge pull request #6236 from nextcloud/dependabot/composer/nextcloud/coding-standard-1.2.3
This commit is contained in:
24
composer.lock
generated
24
composer.lock
generated
@@ -399,16 +399,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nextcloud/coding-standard",
|
||||
"version": "v1.2.1",
|
||||
"version": "v1.2.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nextcloud/coding-standard.git",
|
||||
"reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e"
|
||||
"reference": "bc9c53a5306114b60c4363057aff9c2ed10a54da"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e",
|
||||
"reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e",
|
||||
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/bc9c53a5306114b60c4363057aff9c2ed10a54da",
|
||||
"reference": "bc9c53a5306114b60c4363057aff9c2ed10a54da",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -434,9 +434,9 @@
|
||||
"description": "Nextcloud coding standards for the php cs fixer",
|
||||
"support": {
|
||||
"issues": "https://github.com/nextcloud/coding-standard/issues",
|
||||
"source": "https://github.com/nextcloud/coding-standard/tree/v1.2.1"
|
||||
"source": "https://github.com/nextcloud/coding-standard/tree/v1.2.3"
|
||||
},
|
||||
"time": "2024-02-01T14:54:37+00:00"
|
||||
"time": "2024-08-23T14:32:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nextcloud/ocp",
|
||||
@@ -661,16 +661,16 @@
|
||||
},
|
||||
{
|
||||
"name": "php-cs-fixer/shim",
|
||||
"version": "v3.49.0",
|
||||
"version": "v3.62.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHP-CS-Fixer/shim.git",
|
||||
"reference": "f7d3219cac46632f12362c9aa7c2ac0d2fe92c52"
|
||||
"reference": "7a91d5ce45c486f5b445d95901228507a02f60ae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f7d3219cac46632f12362c9aa7c2ac0d2fe92c52",
|
||||
"reference": "f7d3219cac46632f12362c9aa7c2ac0d2fe92c52",
|
||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/7a91d5ce45c486f5b445d95901228507a02f60ae",
|
||||
"reference": "7a91d5ce45c486f5b445d95901228507a02f60ae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -707,9 +707,9 @@
|
||||
"description": "A tool to automatically fix PHP code style",
|
||||
"support": {
|
||||
"issues": "https://github.com/PHP-CS-Fixer/shim/issues",
|
||||
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.49.0"
|
||||
"source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.62.0"
|
||||
},
|
||||
"time": "2024-02-02T00:42:09+00:00"
|
||||
"time": "2024-08-07T17:03:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
|
||||
@@ -39,8 +39,8 @@ class Filter implements \OCP\Activity\IFilter {
|
||||
|
||||
/**
|
||||
* @return int whether the filter should be rather on the top or bottom of
|
||||
* the admin section. The filters are arranged in ascending order of the
|
||||
* priority values. It is required to return a value between 0 and 100.
|
||||
* the admin section. The filters are arranged in ascending order of the
|
||||
* priority values. It is required to return a value between 0 and 100.
|
||||
* @since 11.0.0
|
||||
*/
|
||||
public function getPriority(): int {
|
||||
|
||||
@@ -47,8 +47,8 @@ abstract class SettingBase extends ActivitySettings {
|
||||
|
||||
/**
|
||||
* @return int whether the filter should be rather on the top or bottom of
|
||||
* the admin section. The filters are arranged in ascending order of the
|
||||
* priority values. It is required to return a value between 0 and 100.
|
||||
* the admin section. The filters are arranged in ascending order of the
|
||||
* priority values. It is required to return a value between 0 and 100.
|
||||
* @since 11.0.0
|
||||
*/
|
||||
public function getPriority(): int {
|
||||
|
||||
@@ -25,8 +25,8 @@ class SettingChanges extends SettingBase {
|
||||
|
||||
/**
|
||||
* @return int whether the filter should be rather on the top or bottom of
|
||||
* the admin section. The filters are arranged in ascending order of the
|
||||
* priority values. It is required to return a value between 0 and 100.
|
||||
* the admin section. The filters are arranged in ascending order of the
|
||||
* priority values. It is required to return a value between 0 and 100.
|
||||
* @since 11.0.0
|
||||
*/
|
||||
public function getPriority(): int {
|
||||
|
||||
@@ -176,7 +176,7 @@ class Application extends App implements IBootstrap {
|
||||
$permissionService = $this->getContainer()->get(PermissionService::class);
|
||||
|
||||
try {
|
||||
return $permissionService->checkPermission($cardMapper, (int) $name, Acl::PERMISSION_READ);
|
||||
return $permissionService->checkPermission($cardMapper, (int)$name, Acl::PERMISSION_READ);
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class Capabilities implements ICapability {
|
||||
|
||||
/** @var IAppManager */
|
||||
private $appManager;
|
||||
/** @var PermissionService */
|
||||
/** @var PermissionService */
|
||||
private $permissionService;
|
||||
|
||||
|
||||
|
||||
@@ -72,17 +72,17 @@ final class TransferOwnership extends Command {
|
||||
try {
|
||||
$board = $boardId ? $this->boardMapper->find($boardId) : null;
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln("Could not find a board for the provided id.");
|
||||
$output->writeln('Could not find a board for the provided id.');
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($boardId !== null && $board->getOwner() !== $owner) {
|
||||
$output->writeln("$owner is not the owner of the board $boardId (" . $board->getTitle() . ")");
|
||||
$output->writeln("$owner is not the owner of the board $boardId (" . $board->getTitle() . ')');
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($boardId) {
|
||||
$output->writeln("Transfer board " . $board->getTitle() . " from ". $board->getOwner() ." to $newOwner");
|
||||
$output->writeln('Transfer board ' . $board->getTitle() . ' from '. $board->getOwner() ." to $newOwner");
|
||||
} else {
|
||||
$output->writeln("Transfer all boards from $owner to $newOwner");
|
||||
}
|
||||
@@ -94,12 +94,12 @@ final class TransferOwnership extends Command {
|
||||
|
||||
if ($boardId) {
|
||||
$this->boardService->transferBoardOwnership($boardId, $newOwner, $remapAssignment);
|
||||
$output->writeln("<info>Board " . $board->getTitle() . " from ". $board->getOwner() ." transferred to $newOwner completed</info>");
|
||||
$output->writeln('<info>Board ' . $board->getTitle() . ' from '. $board->getOwner() ." transferred to $newOwner completed</info>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
foreach ($this->boardService->transferOwnership($owner, $newOwner, $remapAssignment) as $board) {
|
||||
$output->writeln(" - " . $board->getTitle() . " transferred");
|
||||
$output->writeln(' - ' . $board->getTitle() . ' transferred');
|
||||
}
|
||||
$output->writeln("<info>All boards from $owner to $newOwner transferred</info>");
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class Calendar extends ExternalCalendar {
|
||||
private $children;
|
||||
/** @var DeckCalendarBackend */
|
||||
private $backend;
|
||||
/** @var Board */
|
||||
/** @var Board */
|
||||
private $board;
|
||||
|
||||
public function __construct(string $principalUri, string $calendarUri, Board $board, DeckCalendarBackend $backend) {
|
||||
|
||||
@@ -75,7 +75,7 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
|
||||
try {
|
||||
$entity = $this->find($id);
|
||||
return $entity->getBoardId();
|
||||
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
|
||||
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
|
||||
public function findByData($cardId, $data) {
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
$qb->select('*')
|
||||
->from($this->getTableName())
|
||||
->where($qb->expr()->eq('card_id', $qb->createNamedParameter($cardId, IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($qb->expr()->eq('data', $qb->createNamedParameter($data, IQueryBuilder::PARAM_STR)));
|
||||
->from($this->getTableName())
|
||||
->where($qb->expr()->eq('card_id', $qb->createNamedParameter($cardId, IQueryBuilder::PARAM_INT)))
|
||||
->andWhere($qb->expr()->eq('data', $qb->createNamedParameter($data, IQueryBuilder::PARAM_STR)));
|
||||
|
||||
return $this->findEntity($qb);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ class Card extends RelationalEntity {
|
||||
$matchDate->setTime(0, 0);
|
||||
|
||||
$diff = $today->diff($matchDate);
|
||||
return (int) $diff->format('%R%a'); // Extract days count in interval
|
||||
return (int)$diff->format('%R%a'); // Extract days count in interval
|
||||
}
|
||||
|
||||
public function getCalendarPrefix(): string {
|
||||
|
||||
@@ -410,7 +410,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
||||
foreach ($query->getDuedate() as $duedate) {
|
||||
$dueDateColumn = $this->databaseType === 'sqlite3' ? $qb->createFunction('DATETIME(`c`.`duedate`)') : 'c.duedate';
|
||||
$date = $duedate->getValue();
|
||||
if ($date === "") {
|
||||
if ($date === '') {
|
||||
$qb->andWhere($qb->expr()->isNotNull('c.duedate'));
|
||||
continue;
|
||||
}
|
||||
@@ -461,7 +461,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
||||
foreach ($query->getAssigned() as $index => $assignment) {
|
||||
$qb->innerJoin('c', 'deck_assigned_users', 'au' . $index, $qb->expr()->eq('c.id', 'au' . $index . '.card_id'));
|
||||
$assignedQueryValue = $assignment->getValue();
|
||||
if ($assignedQueryValue === "") {
|
||||
if ($assignedQueryValue === '') {
|
||||
$qb->andWhere($qb->expr()->isNotNull('au' . $index . '.participant'));
|
||||
continue;
|
||||
}
|
||||
@@ -589,7 +589,7 @@ class CardMapper extends QBMapper implements IPermissionMapper {
|
||||
}
|
||||
$this->cache->set('findBoardId:' . $id, $result);
|
||||
}
|
||||
return $result !== false ? (int) $result : null;
|
||||
return $result !== false ? (int)$result : null;
|
||||
}
|
||||
|
||||
public function mapOwner(Card &$card) {
|
||||
|
||||
@@ -89,7 +89,7 @@ class ExceptionMiddleware extends Middleware {
|
||||
];
|
||||
$this->logger->error($exception->getMessage(), ['exception' => $exception]);
|
||||
if ($debugMode === true) {
|
||||
$response['exception'] = (array) $exception;
|
||||
$response['exception'] = (array)$exception;
|
||||
}
|
||||
return new JSONResponse($response, 500);
|
||||
}
|
||||
|
||||
@@ -142,11 +142,11 @@ class NotificationHelper {
|
||||
->setUser($userId)
|
||||
->setDateTime(new DateTime())
|
||||
->setObject('card', (string)$card->getId())
|
||||
->setSubject('card-assigned', [
|
||||
$card->getTitle(),
|
||||
$board->getTitle(),
|
||||
$this->currentUser
|
||||
]);
|
||||
->setSubject('card-assigned', [
|
||||
$card->getTitle(),
|
||||
$board->getTitle(),
|
||||
$this->currentUser
|
||||
]);
|
||||
$this->notificationManager->notify($notification);
|
||||
}
|
||||
|
||||
@@ -206,9 +206,9 @@ class NotificationHelper {
|
||||
$notification = $this->notificationManager->createNotification();
|
||||
$notification
|
||||
->setApp('deck')
|
||||
->setUser((string) $mention['id'])
|
||||
->setUser((string)$mention['id'])
|
||||
->setDateTime(new DateTime())
|
||||
->setObject('card', (string) $card->getId())
|
||||
->setObject('card', (string)$card->getId())
|
||||
->setSubject('card-comment-mentioned', [$card->getTitle(), $boardId, $this->currentUser])
|
||||
->setMessage('{message}', ['message' => $comment->getMessage()]);
|
||||
$this->notificationManager->notify($notification);
|
||||
|
||||
@@ -97,7 +97,7 @@ class BoardReferenceProvider implements IReferenceProvider {
|
||||
preg_match('/^' . preg_quote($startIndex, '/') . '(?:\/#!?)?\/board\/([0-9]+)$/', $url, $matches);
|
||||
}
|
||||
if ($matches && count($matches) > 1) {
|
||||
return (int) $matches[1];
|
||||
return (int)$matches[1];
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -106,7 +106,7 @@ class BoardReferenceProvider implements IReferenceProvider {
|
||||
public function getCachePrefix(string $referenceId): string {
|
||||
$boardId = $this->getBoardId($referenceId);
|
||||
if ($boardId !== null) {
|
||||
return (string) $boardId;
|
||||
return (string)$boardId;
|
||||
}
|
||||
|
||||
return $referenceId;
|
||||
|
||||
@@ -111,9 +111,9 @@ class CardReferenceProvider extends ADiscoverableReferenceProvider implements IS
|
||||
if ($ids !== null) {
|
||||
[, $cardId] = $ids;
|
||||
try {
|
||||
$card = $this->cardService->find((int) $cardId)->jsonSerialize();
|
||||
$stack = $this->stackService->find((int) $card['stackId'])->jsonSerialize();
|
||||
$board = $this->boardService->find((int) $stack['boardId'])->jsonSerialize();
|
||||
$card = $this->cardService->find((int)$cardId)->jsonSerialize();
|
||||
$stack = $this->stackService->find((int)$card['stackId'])->jsonSerialize();
|
||||
$board = $this->boardService->find((int)$stack['boardId'])->jsonSerialize();
|
||||
} catch (NoPermissionException $e) {
|
||||
// Skip throwing if user has no permissions
|
||||
return null;
|
||||
|
||||
@@ -73,7 +73,7 @@ class CommentReferenceProvider implements IReferenceProvider {
|
||||
try {
|
||||
$card = $this->cardService->find($cardId)->jsonSerialize();
|
||||
$board = $this->boardService->find($boardId)->jsonSerialize();
|
||||
$stack = $this->stackService->find((int) $card['stackId'])->jsonSerialize();
|
||||
$stack = $this->stackService->find((int)$card['stackId'])->jsonSerialize();
|
||||
} catch (NoPermissionException $e) {
|
||||
// Skip throwing if user has no permissions
|
||||
return null;
|
||||
@@ -162,9 +162,9 @@ class CommentReferenceProvider implements IReferenceProvider {
|
||||
}
|
||||
if ($matches && count($matches) > 3) {
|
||||
return [
|
||||
(int) $matches[1],
|
||||
(int) $matches[2],
|
||||
(int) $matches[3],
|
||||
(int)$matches[1],
|
||||
(int)$matches[2],
|
||||
(int)$matches[3],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -65,8 +65,8 @@ class CommentService {
|
||||
private function get(int $cardId, int $commentId): IComment {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
||||
try {
|
||||
$comment = $this->commentsManager->get((string) $commentId);
|
||||
if ($comment->getObjectType() !== Application::COMMENT_ENTITY_TYPE || (int) $comment->getObjectId() !== $cardId) {
|
||||
$comment = $this->commentsManager->get((string)$commentId);
|
||||
if ($comment->getObjectType() !== Application::COMMENT_ENTITY_TYPE || (int)$comment->getObjectId() !== $cardId) {
|
||||
throw new CommentNotFoundException();
|
||||
}
|
||||
} catch (CommentNotFoundException $e) {
|
||||
@@ -134,7 +134,7 @@ class CommentService {
|
||||
if (!is_numeric($commentId)) {
|
||||
throw new BadRequestException('A valid comment id must be provided');
|
||||
}
|
||||
$comment = $this->get((int) $cardId, (int) $commentId);
|
||||
$comment = $this->get((int)$cardId, (int)$commentId);
|
||||
if ($comment->getActorType() !== 'users' || $comment->getActorId() !== $this->userId) {
|
||||
throw new NoPermissionException('Only authors are allowed to edit their comment.');
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ class BoardImportService {
|
||||
* @return void
|
||||
*/
|
||||
public function setConfig(string $configName, $value): void {
|
||||
if (empty((array) $this->config)) {
|
||||
if (empty((array)$this->config)) {
|
||||
$this->setConfigInstance(new \stdClass);
|
||||
}
|
||||
$this->config->$configName = $value;
|
||||
|
||||
@@ -51,7 +51,7 @@ class DeckJsonService extends ABoardImportService {
|
||||
if (!is_string($nextcloudUid) && !is_numeric($nextcloudUid)) {
|
||||
throw new \LogicException('User on setting uidRelation is invalid');
|
||||
}
|
||||
$nextcloudUid = (string) $nextcloudUid;
|
||||
$nextcloudUid = (string)$nextcloudUid;
|
||||
$this->getImportService()->getConfig('uidRelation')->$exportUid = $this->userManager->get($nextcloudUid);
|
||||
if (!$this->getImportService()->getConfig('uidRelation')->$exportUid) {
|
||||
throw new \LogicException('User on setting uidRelation not found: ' . $nextcloudUid);
|
||||
@@ -106,7 +106,7 @@ class DeckJsonService extends ABoardImportService {
|
||||
public function getComments(): array {
|
||||
$comments = [];
|
||||
foreach ($this->tmpCards as $sourceCard) {
|
||||
if (!property_exists($sourceCard, "comments")) {
|
||||
if (!property_exists($sourceCard, 'comments')) {
|
||||
continue;
|
||||
}
|
||||
$commentsOriginal = $sourceCard->comments;
|
||||
|
||||
@@ -71,7 +71,7 @@ class TrelloJsonService extends ABoardImportService {
|
||||
if (!is_string($nextcloudUid) && !is_numeric($nextcloudUid)) {
|
||||
throw new \LogicException('User on setting uidRelation is invalid');
|
||||
}
|
||||
$nextcloudUid = (string) $nextcloudUid;
|
||||
$nextcloudUid = (string)$nextcloudUid;
|
||||
$this->getImportService()->getConfig('uidRelation')->$trelloUid = $this->userManager->get($nextcloudUid);
|
||||
if (!$this->getImportService()->getConfig('uidRelation')->$trelloUid) {
|
||||
throw new \LogicException('User on setting uidRelation not found: ' . $nextcloudUid);
|
||||
@@ -141,7 +141,7 @@ class TrelloJsonService extends ABoardImportService {
|
||||
$message = $this->l10n->t(
|
||||
"This comment has more than %s characters.\n" .
|
||||
"Added as an attachment to the card with name %s.\n" .
|
||||
"Accessible on URL: %s.",
|
||||
'Accessible on URL: %s.',
|
||||
[
|
||||
IComment::MAX_MESSAGE_LENGTH,
|
||||
'comment_' . $commentId . '.md',
|
||||
|
||||
@@ -143,7 +143,7 @@ class PermissionService {
|
||||
try {
|
||||
$board = $this->getBoard($boardId);
|
||||
return $userId === $board->getOwner();
|
||||
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
|
||||
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -205,8 +205,8 @@ class PermissionService {
|
||||
*/
|
||||
public function findUsers($boardId, $refresh = false) {
|
||||
// cache users of a board so we don't query them for every cards
|
||||
if (array_key_exists((string) $boardId, $this->users) && !$refresh) {
|
||||
return $this->users[(string) $boardId];
|
||||
if (array_key_exists((string)$boardId, $this->users) && !$refresh) {
|
||||
return $this->users[(string)$boardId];
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -269,8 +269,8 @@ class PermissionService {
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->users[(string) $boardId] = $users;
|
||||
return $this->users[(string) $boardId];
|
||||
$this->users[(string)$boardId] = $users;
|
||||
return $this->users[(string)$boardId];
|
||||
}
|
||||
|
||||
public function canCreate() {
|
||||
|
||||
@@ -110,7 +110,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
||||
try {
|
||||
$board = $this->boardMapper->find($boardId);
|
||||
$valid = $valid && !$board->getArchived();
|
||||
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
|
||||
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
@@ -966,8 +966,8 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
|
||||
protected function filterSharesOfUser(array $shares): array {
|
||||
// Deck shares when the user has a share exception
|
||||
foreach ($shares as $id => $share) {
|
||||
$type = (int) $share['share_type'];
|
||||
$permissions = (int) $share['permissions'];
|
||||
$type = (int)$share['share_type'];
|
||||
$permissions = (int)$share['permissions'];
|
||||
|
||||
if ($type === self::SHARE_TYPE_DECK_USER) {
|
||||
unset($shares[$share['parent']]);
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract class BaseValidator {
|
||||
} else {
|
||||
if (!$this->{$rule}($value)) {
|
||||
throw new BadRequestException(
|
||||
$field . ' must be provided and must be '. str_replace("_", " ", $rule));
|
||||
$field . ' must be provided and must be '. str_replace('_', ' ', $rule));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ abstract class BaseValidator {
|
||||
*/
|
||||
private function max($value, $limit): bool {
|
||||
if (!$limit || !is_numeric($limit)) {
|
||||
throw new Exception("Validation rule max requires at least 1 parameter. " . json_encode($limit));
|
||||
throw new Exception('Validation rule max requires at least 1 parameter. ' . json_encode($limit));
|
||||
}
|
||||
return $this->getSize($value) <= $limit;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ abstract class BaseValidator {
|
||||
*/
|
||||
private function min($value, $limit): bool {
|
||||
if (!$limit || !is_numeric($limit)) {
|
||||
throw new Exception("Validation rule max requires at least 1 parameter.");
|
||||
throw new Exception('Validation rule max requires at least 1 parameter.');
|
||||
}
|
||||
return $this->getSize($value) >= $limit;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ abstract class BaseValidator {
|
||||
/**
|
||||
* Get the size of an attribute.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param mixed $value
|
||||
* @return int
|
||||
*/
|
||||
protected function getSize($value): int {
|
||||
@@ -158,6 +158,6 @@ abstract class BaseValidator {
|
||||
: $field . ' must be at least '. $parameter . ' characters long ';
|
||||
}
|
||||
|
||||
return $field . ' must be provided and must be '. str_replace("_", " ", $rule);
|
||||
return $field . ' must be provided and must be '. str_replace('_', ' ', $rule);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ use OCP\Server;
|
||||
* @group DB
|
||||
*/
|
||||
class BoardDatabaseTest extends \Test\TestCase {
|
||||
public const TEST_USER1 = "test-share-user1";
|
||||
public const TEST_USER2 = "test-share-user2";
|
||||
public const TEST_USER3 = "test-share-user3";
|
||||
public const TEST_USER4 = "test-share-user4";
|
||||
public const TEST_GROUP1 = "test-share-group1";
|
||||
public const TEST_USER1 = 'test-share-user1';
|
||||
public const TEST_USER2 = 'test-share-user2';
|
||||
public const TEST_USER3 = 'test-share-user3';
|
||||
public const TEST_USER4 = 'test-share-user4';
|
||||
public const TEST_GROUP1 = 'test-share-group1';
|
||||
|
||||
/** @var BoardService */
|
||||
private $boardService;
|
||||
|
||||
@@ -71,7 +71,7 @@ class BoardContext implements Context {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Assert::assertNotNull($id, "Could not find board named ".$boardName);
|
||||
Assert::assertNotNull($id, 'Could not find board named '.$boardName);
|
||||
} else {
|
||||
$id = $this->board['id'];
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class SearchContext implements Context {
|
||||
/**
|
||||
* @When /^searching for "([^"]*)" in comments in unified search$/
|
||||
* @param string $term
|
||||
* https://cloud.nextcloud.com/ocs/v2.php/search/providers/talk-conversations/search?term=an&from=%2Fapps%2Fdashboard%2F
|
||||
* https://cloud.nextcloud.com/ocs/v2.php/search/providers/talk-conversations/search?term=an&from=%2Fapps%2Fdashboard%2F
|
||||
*/
|
||||
public function searchingForComments(string $term) {
|
||||
$this->requestContext->sendOCSRequest('GET', '/search/providers/search-deck-comment/search?term=' . urlencode($term), []);
|
||||
|
||||
@@ -32,7 +32,7 @@ class SessionContext implements Context {
|
||||
'boardId' => $board['id'],
|
||||
]);
|
||||
$res = json_decode((string)$this->getResponse()->getBody(), true);
|
||||
Assert::assertArrayHasKey('token', $res['ocs']['data'], "session creation did not respond with a token");
|
||||
Assert::assertArrayHasKey('token', $res['ocs']['data'], 'session creation did not respond with a token');
|
||||
|
||||
// store token
|
||||
$user = $this->serverContext->getCurrentUser();
|
||||
@@ -44,7 +44,7 @@ class SessionContext implements Context {
|
||||
*/
|
||||
public function theResponseShouldHaveActiveSessions($length) {
|
||||
$board = $this->boardContext->getLastUsedBoard();
|
||||
Assert::assertEquals($length, count($board['activeSessions']), "unexpected count of active sessions");
|
||||
Assert::assertEquals($length, count($board['activeSessions']), 'unexpected count of active sessions');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ class SessionContext implements Context {
|
||||
*/
|
||||
public function theUserShouldBeInTheListOfActiveSessions($user) {
|
||||
$board = $this->boardContext->getLastUsedBoard();
|
||||
Assert::assertContains($user, $board['activeSessions'], "user is not found in the list of active sessions");
|
||||
Assert::assertContains($user, $board['activeSessions'], 'user is not found in the list of active sessions');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ class SessionContext implements Context {
|
||||
|
||||
$user = $this->serverContext->getCurrentUser();
|
||||
$token = $this->tokens[$user];
|
||||
Assert::assertNotEmpty($token, "no token for the user found");
|
||||
Assert::assertNotEmpty($token, 'no token for the user found');
|
||||
$this->requestContext->sendOCSRequest('POST', '/apps/deck/api/v1.0/session/close', [
|
||||
'boardId' => $board['id'],
|
||||
'token' => $token
|
||||
|
||||
@@ -88,8 +88,8 @@ class UserExportTest extends \Test\TestCase {
|
||||
|
||||
public function getComment($id) {
|
||||
$comment = new Comment();
|
||||
$comment->setActor("users", "admin");
|
||||
$comment->setMessage("fake comment" . $id);
|
||||
$comment->setActor('users', 'admin');
|
||||
$comment->setMessage('fake comment' . $id);
|
||||
return $comment;
|
||||
}
|
||||
public function testExecute() {
|
||||
|
||||
@@ -27,7 +27,7 @@ class AclTest extends \Test\TestCase {
|
||||
private function createAclUser() {
|
||||
$acl = new Acl();
|
||||
$acl->setId(1);
|
||||
$acl->setParticipant("admin");
|
||||
$acl->setParticipant('admin');
|
||||
$acl->setType(Acl::PERMISSION_TYPE_USER);
|
||||
$acl->setBoardId(1);
|
||||
$acl->setPermissionEdit(true);
|
||||
@@ -39,7 +39,7 @@ class AclTest extends \Test\TestCase {
|
||||
private function createAclGroup() {
|
||||
$acl = new Acl();
|
||||
$acl->setId(1);
|
||||
$acl->setParticipant("administrators");
|
||||
$acl->setParticipant('administrators');
|
||||
$acl->setType(Acl::PERMISSION_TYPE_GROUP);
|
||||
$acl->setBoardId(1);
|
||||
$acl->setPermissionEdit(true);
|
||||
|
||||
@@ -28,7 +28,7 @@ class AttachmentTest extends \Test\TestCase {
|
||||
$attachment = new Attachment();
|
||||
$attachment->setId(1);
|
||||
$attachment->setCardId(123);
|
||||
$attachment->setData("blob");
|
||||
$attachment->setData('blob');
|
||||
$attachment->setCreatedBy('admin');
|
||||
$attachment->setType('deck_file');
|
||||
return $attachment;
|
||||
|
||||
@@ -8,9 +8,9 @@ class BoardTest extends TestCase {
|
||||
private function createBoard() {
|
||||
$board = new Board();
|
||||
$board->setId(1);
|
||||
$board->setTitle("My Board");
|
||||
$board->setOwner("admin");
|
||||
$board->setColor("000000");
|
||||
$board->setTitle('My Board');
|
||||
$board->setOwner('admin');
|
||||
$board->setColor('000000');
|
||||
$board->setArchived(false);
|
||||
// TODO: relation shared labels acl
|
||||
return $board;
|
||||
@@ -20,9 +20,9 @@ class BoardTest extends TestCase {
|
||||
$board->setUsers(['user1', 'user2']);
|
||||
$this->assertEquals([
|
||||
'id' => 1,
|
||||
'title' => "My Board",
|
||||
'owner' => "admin",
|
||||
'color' => "000000",
|
||||
'title' => 'My Board',
|
||||
'owner' => 'admin',
|
||||
'color' => '000000',
|
||||
'labels' => [],
|
||||
'permissions' => [],
|
||||
'stacks' => [],
|
||||
@@ -44,9 +44,9 @@ class BoardTest extends TestCase {
|
||||
self::assertNull($board->getLabels());
|
||||
$this->assertEquals([
|
||||
'id' => 1,
|
||||
'title' => "My Board",
|
||||
'owner' => "admin",
|
||||
'color' => "000000",
|
||||
'title' => 'My Board',
|
||||
'owner' => 'admin',
|
||||
'color' => '000000',
|
||||
'labels' => [],
|
||||
'permissions' => [],
|
||||
'stacks' => [],
|
||||
@@ -63,13 +63,13 @@ class BoardTest extends TestCase {
|
||||
|
||||
public function testSetLabels() {
|
||||
$board = $this->createBoard();
|
||||
$board->setLabels(["foo", "bar"]);
|
||||
$board->setLabels(['foo', 'bar']);
|
||||
$this->assertEquals([
|
||||
'id' => 1,
|
||||
'title' => "My Board",
|
||||
'owner' => "admin",
|
||||
'color' => "000000",
|
||||
'labels' => ["foo", "bar"],
|
||||
'title' => 'My Board',
|
||||
'owner' => 'admin',
|
||||
'color' => '000000',
|
||||
'labels' => ['foo', 'bar'],
|
||||
'permissions' => [],
|
||||
'stacks' => [],
|
||||
'deletedAt' => 0,
|
||||
@@ -95,9 +95,9 @@ class BoardTest extends TestCase {
|
||||
$board->setShared(1);
|
||||
$this->assertEquals([
|
||||
'id' => 1,
|
||||
'title' => "My Board",
|
||||
'owner' => "admin",
|
||||
'color' => "000000",
|
||||
'title' => 'My Board',
|
||||
'owner' => 'admin',
|
||||
'color' => '000000',
|
||||
'labels' => [],
|
||||
'permissions' => [],
|
||||
'stacks' => [],
|
||||
|
||||
@@ -32,13 +32,13 @@ class CardTest extends TestCase {
|
||||
private function createCard() {
|
||||
$card = new Card();
|
||||
$card->setId(1);
|
||||
$card->setTitle("My Card");
|
||||
$card->setDescription("a long description");
|
||||
$card->setTitle('My Card');
|
||||
$card->setDescription('a long description');
|
||||
$card->setStackId(1);
|
||||
$card->setType('text');
|
||||
$card->setLastModified(234);
|
||||
$card->setCreatedAt(123);
|
||||
$card->setOwner("admin");
|
||||
$card->setOwner('admin');
|
||||
$card->setOrder(12);
|
||||
$card->setArchived(false);
|
||||
$card->setDone(null);
|
||||
@@ -68,8 +68,8 @@ class CardTest extends TestCase {
|
||||
$card = $this->createCard();
|
||||
$this->assertEquals([
|
||||
'id' => 1,
|
||||
'title' => "My Card",
|
||||
'description' => "a long description",
|
||||
'title' => 'My Card',
|
||||
'description' => 'a long description',
|
||||
'type' => 'text',
|
||||
'lastModified' => 234,
|
||||
'createdAt' => 123,
|
||||
@@ -96,8 +96,8 @@ class CardTest extends TestCase {
|
||||
$card->setLabels([]);
|
||||
$this->assertEquals([
|
||||
'id' => 1,
|
||||
'title' => "My Card",
|
||||
'description' => "a long description",
|
||||
'title' => 'My Card',
|
||||
'description' => 'a long description',
|
||||
'type' => 'text',
|
||||
'lastModified' => 234,
|
||||
'createdAt' => 123,
|
||||
@@ -126,8 +126,8 @@ class CardTest extends TestCase {
|
||||
$card->setLabels([]);
|
||||
$this->assertEquals([
|
||||
'id' => 1,
|
||||
'title' => "My Card",
|
||||
'description' => "a long description",
|
||||
'title' => 'My Card',
|
||||
'description' => 'a long description',
|
||||
'type' => 'text',
|
||||
'lastModified' => 234,
|
||||
'createdAt' => 123,
|
||||
|
||||
@@ -29,8 +29,8 @@ class LabelTest extends TestCase {
|
||||
private function createLabel() {
|
||||
$label = new Label();
|
||||
$label->setId(1);
|
||||
$label->setTitle("My Label");
|
||||
$label->setColor("000000");
|
||||
$label->setTitle('My Label');
|
||||
$label->setColor('000000');
|
||||
return $label;
|
||||
}
|
||||
public function testJsonSerializeBoard() {
|
||||
|
||||
@@ -27,7 +27,7 @@ class StackTest extends \Test\TestCase {
|
||||
private function createStack() {
|
||||
$board = new Stack();
|
||||
$board->setId(1);
|
||||
$board->setTitle("My Stack");
|
||||
$board->setTitle('My Stack');
|
||||
$board->setBoardId(1);
|
||||
$board->setOrder(1);
|
||||
return $board;
|
||||
@@ -36,7 +36,7 @@ class StackTest extends \Test\TestCase {
|
||||
$stack = $this->createStack();
|
||||
$this->assertEquals([
|
||||
'id' => 1,
|
||||
'title' => "My Stack",
|
||||
'title' => 'My Stack',
|
||||
'order' => 1,
|
||||
'boardId' => 1,
|
||||
'deletedAt' => 0,
|
||||
@@ -45,15 +45,15 @@ class StackTest extends \Test\TestCase {
|
||||
], $stack->jsonSerialize());
|
||||
}
|
||||
public function testJsonSerializeWithCards() {
|
||||
$cards = ["foo", "bar"];
|
||||
$cards = ['foo', 'bar'];
|
||||
$stack = $this->createStack();
|
||||
$stack->setCards($cards);
|
||||
$this->assertEquals([
|
||||
'id' => 1,
|
||||
'title' => "My Stack",
|
||||
'title' => 'My Stack',
|
||||
'order' => 1,
|
||||
'boardId' => 1,
|
||||
'cards' => ["foo", "bar"],
|
||||
'cards' => ['foo', 'bar'],
|
||||
'deletedAt' => 0,
|
||||
'lastModified' => 0,
|
||||
'ETag' => $stack->getETag(),
|
||||
|
||||
@@ -69,8 +69,8 @@ class ExceptionMiddlewareTest extends \Test\TestCase {
|
||||
public function testAfterException($exception, $status, $message) {
|
||||
$result = $this->exceptionMiddleware->afterException($this->controller, 'bar', $exception);
|
||||
$expected = new JSONResponse([
|
||||
"status" => $status,
|
||||
"message" => $message
|
||||
'status' => $status,
|
||||
'message' => $message
|
||||
], $status);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class NotificationHelperTest extends \Test\TestCase {
|
||||
protected $cardMapper;
|
||||
/** @var BoardMapper|MockObject */
|
||||
protected $boardMapper;
|
||||
/** @var AssignmentMapper|MockObject */
|
||||
/** @var AssignmentMapper|MockObject */
|
||||
protected $assignedUsersMapper;
|
||||
/** @var PermissionService|MockObject */
|
||||
protected $permissionService;
|
||||
|
||||
@@ -78,7 +78,7 @@ class AssignmentServiceTest extends TestCase {
|
||||
*/
|
||||
private $assignmentService;
|
||||
/**
|
||||
* @var AssignmentServiceValidator
|
||||
* @var AssignmentServiceValidator
|
||||
*/
|
||||
private $assignmentServiceValidator;
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class AttachmentServiceTest extends TestCase {
|
||||
private $cardMapper;
|
||||
/** @var PermissionService|MockObject */
|
||||
private $permissionService;
|
||||
/** @var string */
|
||||
/** @var string */
|
||||
private $userId = 'admin';
|
||||
/** @var Application|MockObject */
|
||||
private $application;
|
||||
@@ -79,7 +79,7 @@ class AttachmentServiceTest extends TestCase {
|
||||
private $attachmentService;
|
||||
/** @var MockObject */
|
||||
private $attachmentServiceImpl;
|
||||
/** @var ActivityManager */
|
||||
/** @var ActivityManager */
|
||||
private $activityManager;
|
||||
private $appContainer;
|
||||
/** @var IL10N */
|
||||
@@ -91,7 +91,7 @@ class AttachmentServiceTest extends TestCase {
|
||||
*/
|
||||
private $filesAppServiceImpl;
|
||||
/**
|
||||
* @var AttachmentServiceValidator
|
||||
* @var AttachmentServiceValidator
|
||||
*/
|
||||
private $attachmentServiceValidator;
|
||||
|
||||
|
||||
@@ -31,17 +31,17 @@ use Test\TestCase;
|
||||
|
||||
class LabelServiceTest extends TestCase {
|
||||
|
||||
/** @var LabelMapper|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var LabelMapper|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $labelMapper;
|
||||
/** @var PermissionService|\PHPUnit\Framework\MockObject\MockObject */
|
||||
/** @var PermissionService|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $permissionService;
|
||||
/** @var LabelService */
|
||||
/** @var LabelService */
|
||||
private $labelService;
|
||||
/** @var BoardService|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $boardService;
|
||||
/** @var ChangeHelper|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $changeHelper;
|
||||
/** @var LabelServiceValidator\MockObject */
|
||||
/** @var LabelServiceValidator\MockObject */
|
||||
private $labelServiceValidator;
|
||||
|
||||
public function setUp(): void {
|
||||
|
||||
@@ -212,8 +212,8 @@ class StackServiceTest extends TestCase {
|
||||
$this->stackMapper->expects($this->once())->method('update')->willReturn($stackToBeDeleted);
|
||||
$this->cardMapper->expects($this->once())->method('findAll')->willReturn([]);
|
||||
$this->stackService->delete(123);
|
||||
$this->assertTrue($stackToBeDeleted->getDeletedAt() <= time(), "deletedAt is in the past");
|
||||
$this->assertTrue($stackToBeDeleted->getDeletedAt() > 0, "deletedAt is set");
|
||||
$this->assertTrue($stackToBeDeleted->getDeletedAt() <= time(), 'deletedAt is in the past');
|
||||
$this->assertTrue($stackToBeDeleted->getDeletedAt() > 0, 'deletedAt is set');
|
||||
}
|
||||
|
||||
public function testUpdate() {
|
||||
|
||||
@@ -111,8 +111,8 @@ class CardApiControllerTest extends \Test\TestCase {
|
||||
$this->stackExample['id']);
|
||||
|
||||
$this->cardService->expects($this->once())
|
||||
->method('update')
|
||||
->willReturn($card);
|
||||
->method('update')
|
||||
->willReturn($card);
|
||||
|
||||
$expected = new DataResponse($card, HTTP::STATUS_OK);
|
||||
$actual = $this->controller->update('title', 'plain', 0, 'description', $this->userId, null);
|
||||
|
||||
Reference in New Issue
Block a user