chore: Fix php-cs and psalm

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2024-01-09 11:32:34 +01:00
parent 6b5667dd8f
commit b7d624c671
54 changed files with 192 additions and 177 deletions

View File

@@ -45,8 +45,8 @@ use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException; use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\Comments\IComment; use OCP\Comments\IComment;
use OCP\IUser; use OCP\IUser;
use OCP\Server;
use OCP\L10N\IFactory; use OCP\L10N\IFactory;
use OCP\Server;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
class ActivityManager { class ActivityManager {
@@ -332,8 +332,8 @@ class ActivityManager {
case self::SUBJECT_BOARD_UPDATE_ARCHIVED: case self::SUBJECT_BOARD_UPDATE_ARCHIVED:
case self::SUBJECT_BOARD_DELETE: case self::SUBJECT_BOARD_DELETE:
case self::SUBJECT_BOARD_RESTORE: case self::SUBJECT_BOARD_RESTORE:
// Not defined as there is no activity for // Not defined as there is no activity for
// case self::SUBJECT_BOARD_UPDATE_COLOR // case self::SUBJECT_BOARD_UPDATE_COLOR
break; break;
case self::SUBJECT_CARD_COMMENT_CREATE: case self::SUBJECT_CARD_COMMENT_CREATE:
$eventType = 'deck_comment'; $eventType = 'deck_comment';
@@ -374,7 +374,7 @@ class ActivityManager {
$additionalParams['before'] = $additionalParams['before']->format('c'); $additionalParams['before'] = $additionalParams['before']->format('c');
} }
break; break;
case self::SUBJECT_ATTACHMENT_CREATE: case self::SUBJECT_ATTACHMENT_CREATE:
case self::SUBJECT_ATTACHMENT_UPDATE: case self::SUBJECT_ATTACHMENT_UPDATE:
case self::SUBJECT_ATTACHMENT_DELETE: case self::SUBJECT_ATTACHMENT_DELETE:

View File

@@ -23,12 +23,12 @@
namespace OCA\Deck\Activity; namespace OCA\Deck\Activity;
use \OCP\Comments\ICommentsEventHandler;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\ChangeHelper; use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\Notification\NotificationHelper; use OCA\Deck\Notification\NotificationHelper;
use OCP\Comments\CommentsEvent; use OCP\Comments\CommentsEvent;
use OCP\Comments\IComment; use OCP\Comments\IComment;
use \OCP\Comments\ICommentsEventHandler;
class CommentEventHandler implements ICommentsEventHandler { class CommentEventHandler implements ICommentsEventHandler {

View File

@@ -26,6 +26,7 @@
namespace OCA\Deck\Activity; namespace OCA\Deck\Activity;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
use OCA\Deck\Service\CardService;
use OCP\Activity\IEvent; use OCP\Activity\IEvent;
use OCP\Activity\IProvider; use OCP\Activity\IProvider;
use OCP\Comments\IComment; use OCP\Comments\IComment;
@@ -35,7 +36,6 @@ use OCP\IConfig;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\L10N\IFactory; use OCP\L10N\IFactory;
use OCA\Deck\Service\CardService;
class DeckProvider implements IProvider { class DeckProvider implements IProvider {

View File

@@ -43,11 +43,11 @@ use OCA\Deck\Event\CardUpdatedEvent;
use OCA\Deck\Event\SessionClosedEvent; use OCA\Deck\Event\SessionClosedEvent;
use OCA\Deck\Event\SessionCreatedEvent; use OCA\Deck\Event\SessionCreatedEvent;
use OCA\Deck\Listeners\BeforeTemplateRenderedListener; use OCA\Deck\Listeners\BeforeTemplateRenderedListener;
use OCA\Deck\Listeners\ParticipantCleanupListener;
use OCA\Deck\Listeners\FullTextSearchEventListener; use OCA\Deck\Listeners\FullTextSearchEventListener;
use OCA\Deck\Listeners\LiveUpdateListener;
use OCA\Deck\Listeners\ParticipantCleanupListener;
use OCA\Deck\Listeners\ResourceAdditionalScriptsListener; use OCA\Deck\Listeners\ResourceAdditionalScriptsListener;
use OCA\Deck\Listeners\ResourceListener; use OCA\Deck\Listeners\ResourceListener;
use OCA\Deck\Listeners\LiveUpdateListener;
use OCA\Deck\Middleware\DefaultBoardMiddleware; use OCA\Deck\Middleware\DefaultBoardMiddleware;
use OCA\Deck\Middleware\ExceptionMiddleware; use OCA\Deck\Middleware\ExceptionMiddleware;
use OCA\Deck\Notification\Notifier; use OCA\Deck\Notification\Notifier;

View File

@@ -22,11 +22,11 @@
*/ */
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Service\AttachmentService;
use OCP\AppFramework\ApiController; use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest; use OCP\IRequest;
use OCA\Deck\Service\AttachmentService;
class AttachmentApiController extends ApiController { class AttachmentApiController extends ApiController {
private $attachmentService; private $attachmentService;

View File

@@ -25,13 +25,13 @@
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Db\Board; use OCA\Deck\Db\Board;
use OCA\Deck\Service\BoardService;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
use OCP\AppFramework\ApiController; use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
use OCA\Deck\Service\BoardService; use OCP\IRequest;
use Sabre\HTTP\Util; use Sabre\HTTP\Util;
/** /**

View File

@@ -23,20 +23,20 @@
* *
*/ */
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Service\AssignmentService; use OCA\Deck\Service\AssignmentService;
use OCP\AppFramework\ApiController; use OCA\Deck\Service\CardService;
use OCP\AppFramework\Http; use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http;
use OCP\IRequest; use OCP\AppFramework\Http\DataResponse;
use OCA\Deck\Service\CardService; use OCP\IRequest;
/** /**
* Class BoardApiController * Class BoardApiController
* *
* @package OCA\Deck\Controller * @package OCA\Deck\Controller
*/ */
class CardApiController extends ApiController { class CardApiController extends ApiController {
private $cardService; private $cardService;
private $userId; private $userId;

View File

@@ -25,8 +25,8 @@ namespace OCA\Deck\Controller;
use OCA\Deck\Service\AssignmentService; use OCA\Deck\Service\AssignmentService;
use OCA\Deck\Service\CardService; use OCA\Deck\Service\CardService;
use OCP\IRequest;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\IRequest;
class CardController extends Controller { class CardController extends Controller {
private $userId; private $userId;

View File

@@ -36,7 +36,7 @@ class ConfigController extends OCSController {
$AppName, $AppName,
IRequest $request, IRequest $request,
ConfigService $configService ConfigService $configService
) { ) {
parent::__construct($AppName, $request); parent::__construct($AppName, $request);
$this->configService = $configService; $this->configService = $configService;

View File

@@ -23,11 +23,11 @@
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Service\LabelService;
use OCP\AppFramework\ApiController; use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest; use OCP\IRequest;
use OCA\Deck\Service\LabelService;
/** /**
* Class BoardApiController * Class BoardApiController

View File

@@ -24,8 +24,8 @@
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Service\LabelService; use OCA\Deck\Service\LabelService;
use OCP\IRequest;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\IRequest;
class LabelController extends Controller { class LabelController extends Controller {
private $labelService; private $labelService;

View File

@@ -23,25 +23,25 @@
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use \OCP\AppFramework\Http\RedirectResponse;
use OCA\Deck\AppInfo\Application; use OCA\Deck\AppInfo\Application;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\CardMapper;
use OCA\Deck\Service\CardService;
use OCA\Deck\Service\ConfigService; use OCA\Deck\Service\ConfigService;
use OCA\Deck\Service\PermissionService; use OCA\Deck\Service\PermissionService;
use OCA\Files\Event\LoadSidebar; use OCA\Files\Event\LoadSidebar;
use OCA\Text\Event\LoadEditor; use OCA\Text\Event\LoadEditor;
use OCA\Viewer\Event\LoadViewer; use OCA\Viewer\Event\LoadViewer;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent as CollaborationResourcesEvent; use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent as CollaborationResourcesEvent;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig; use OCP\IConfig;
use OCP\IInitialStateService; use OCP\IInitialStateService;
use OCP\IRequest; use OCP\IRequest;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Controller;
use OCA\Deck\Db\CardMapper;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use \OCP\AppFramework\Http\RedirectResponse;
use OCA\Deck\Db\Acl;
use OCA\Deck\Service\CardService;
class PageController extends Controller { class PageController extends Controller {
private PermissionService $permissionService; private PermissionService $permissionService;
@@ -64,7 +64,7 @@ class PageController extends Controller {
IURLGenerator $urlGenerator, IURLGenerator $urlGenerator,
CardService $cardService, CardService $cardService,
IConfig $config IConfig $config
) { ) {
parent::__construct($AppName, $request); parent::__construct($AppName, $request);
$this->permissionService = $permissionService; $this->permissionService = $permissionService;

View File

@@ -24,14 +24,14 @@ declare(strict_types=1);
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Service\SessionService; use OCA\Deck\Db\Acl;
use OCA\Deck\Service\PermissionService;
use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Service\PermissionService;
use OCA\Deck\Service\SessionService;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController; use OCP\AppFramework\OCSController;
use OCP\IRequest; use OCP\IRequest;
use OCA\Deck\Db\Acl;
class SessionController extends OCSController { class SessionController extends OCSController {
private SessionService $sessionService; private SessionService $sessionService;

View File

@@ -24,13 +24,13 @@
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\StackService;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
use OCP\AppFramework\ApiController; use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest; use OCP\IRequest;
use OCA\Deck\Service\StackService;
use OCA\Deck\Service\BoardService;
use Sabre\HTTP\Util; use Sabre\HTTP\Util;
/** /**

View File

@@ -25,10 +25,10 @@ namespace OCA\Deck\Controller;
use OCA\Deck\Service\StackService; use OCA\Deck\Service\StackService;
use OCP\IRequest;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\IRequest;
class StackController extends Controller { class StackController extends Controller {
private $userId; private $userId;
private $stackService; private $stackService;

View File

@@ -24,10 +24,10 @@
namespace OCA\Deck\Cron; namespace OCA\Deck\Cron;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\Job;
use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\Job;
class CardDescriptionActivity extends Job { class CardDescriptionActivity extends Job {

View File

@@ -24,14 +24,14 @@
namespace OCA\Deck\Cron; namespace OCA\Deck\Cron;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCA\Deck\Db\AttachmentMapper; use OCA\Deck\Db\AttachmentMapper;
use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\InvalidAttachmentType; use OCA\Deck\InvalidAttachmentType;
use OCA\Deck\Service\AttachmentService; use OCA\Deck\Service\AttachmentService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\IJob;
use OCP\BackgroundJob\TimedJob;
class DeleteCron extends TimedJob { class DeleteCron extends TimedJob {

View File

@@ -23,12 +23,12 @@
namespace OCA\Deck\Cron; namespace OCA\Deck\Cron;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\Job;
use OCA\Deck\Db\Card; use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\Notification\NotificationHelper; use OCA\Deck\Notification\NotificationHelper;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\Job;
use OCP\ILogger; use OCP\ILogger;
class ScheduledNotifications extends Job { class ScheduledNotifications extends Job {

View File

@@ -39,8 +39,8 @@ class SessionsCleanup extends TimedJob {
public function __construct(ITimeFactory $time, public function __construct(ITimeFactory $time,
SessionService $sessionService, SessionService $sessionService,
ILogger $logger) { ILogger $logger) {
parent::__construct($time); parent::__construct($time);
$this->sessionService = $sessionService; $this->sessionService = $sessionService;
$this->logger = $logger; $this->logger = $logger;

View File

@@ -29,8 +29,8 @@ use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\QBMapper; use OCP\AppFramework\Db\QBMapper;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IUserManager;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\IUserManager;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** @template-extends QBMapper<Board> */ /** @template-extends QBMapper<Board> */
@@ -159,7 +159,7 @@ class BoardMapper extends QBMapper implements IPermissionMapper {
} }
public function findAllForUser(string $userId, ?int $since = null, bool $includeArchived = true, ?int $before = null, public function findAllForUser(string $userId, ?int $since = null, bool $includeArchived = true, ?int $before = null,
?string $term = null): array { ?string $term = null): array {
$useCache = ($since === -1 && $includeArchived === true && $before === null && $term === null); $useCache = ($since === -1 && $includeArchived === true && $before === null && $term === null);
if (!isset($this->userBoardCache[$userId]) || !$useCache) { if (!isset($this->userBoardCache[$userId]) || !$useCache) {
$groups = $this->groupManager->getUserGroupIds( $groups = $this->groupManager->getUserGroupIds(
@@ -198,7 +198,7 @@ class BoardMapper extends QBMapper implements IPermissionMapper {
* Find all boards for a given user * Find all boards for a given user
*/ */
public function findAllByUser(string $userId, ?int $limit = null, ?int $offset = null, ?int $since = null, public function findAllByUser(string $userId, ?int $limit = null, ?int $offset = null, ?int $since = null,
bool $includeArchived = true, ?int $before = null, ?string $term = null): array { bool $includeArchived = true, ?int $before = null, ?string $term = null): array {
// FIXME this used to be a UNION to get boards owned by $userId and the user shares in one single query // FIXME this used to be a UNION to get boards owned by $userId and the user shares in one single query
// Is it possible with the query builder? // Is it possible with the query builder?
$qb = $this->db->getQueryBuilder(); $qb = $this->db->getQueryBuilder();
@@ -305,7 +305,7 @@ class BoardMapper extends QBMapper implements IPermissionMapper {
* Find all boards for a given user * Find all boards for a given user
*/ */
public function findAllByGroups(string $userId, array $groups, ?int $limit = null, ?int $offset = null, ?int $since = null, public function findAllByGroups(string $userId, array $groups, ?int $limit = null, ?int $offset = null, ?int $since = null,
bool $includeArchived = true, ?int $before = null, ?string $term = null): array { bool $includeArchived = true, ?int $before = null, ?string $term = null): array {
if (count($groups) <= 0) { if (count($groups) <= 0) {
return []; return [];
} }
@@ -359,7 +359,7 @@ class BoardMapper extends QBMapper implements IPermissionMapper {
} }
public function findAllByCircles(string $userId, ?int $limit = null, ?int $offset = null, ?int $since = null, public function findAllByCircles(string $userId, ?int $limit = null, ?int $offset = null, ?int $since = null,
bool $includeArchived = true, ?int $before = null, ?string $term = null) { bool $includeArchived = true, ?int $before = null, ?string $term = null) {
$circles = $this->circlesService->getUserCircles($userId); $circles = $this->circlesService->getUserCircles($userId);
if (count($circles) === 0) { if (count($circles) === 0) {
return []; return [];

View File

@@ -23,8 +23,8 @@
namespace OCA\Deck\Db; namespace OCA\Deck\Db;
use OCP\ICacheFactory;
use OCP\ICache; use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IRequest; use OCP\IRequest;

View File

@@ -28,9 +28,9 @@ use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException; use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\Cache\CappedMemoryCache; use OCP\Cache\CappedMemoryCache;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\ICache; use OCP\ICache;
use OCP\ICacheFactory; use OCP\ICacheFactory;
use OCP\IDBConnection;
/** @template-extends DeckMapper<Stack> */ /** @template-extends DeckMapper<Stack> */
class StackMapper extends DeckMapper implements IPermissionMapper { class StackMapper extends DeckMapper implements IPermissionMapper {

View File

@@ -27,13 +27,13 @@ declare(strict_types=1);
namespace OCA\Deck\Listeners; namespace OCA\Deck\Listeners;
use OCA\Deck\Db\StackMapper; use OCA\Deck\Db\StackMapper;
use OCA\Deck\NotifyPushEvents;
use OCA\Deck\Event\AAclEvent; use OCA\Deck\Event\AAclEvent;
use OCA\Deck\Event\ACardEvent; use OCA\Deck\Event\ACardEvent;
use OCA\Deck\Event\BoardUpdatedEvent; use OCA\Deck\Event\BoardUpdatedEvent;
use OCA\Deck\Event\CardUpdatedEvent; use OCA\Deck\Event\CardUpdatedEvent;
use OCA\Deck\Event\SessionClosedEvent; use OCA\Deck\Event\SessionClosedEvent;
use OCA\Deck\Event\SessionCreatedEvent; use OCA\Deck\Event\SessionCreatedEvent;
use OCA\Deck\NotifyPushEvents;
use OCA\Deck\Service\SessionService; use OCA\Deck\Service\SessionService;
use OCA\NotifyPush\Queue\IQueue; use OCA\NotifyPush\Queue\IQueue;
use OCP\EventDispatcher\Event; use OCP\EventDispatcher\Event;

View File

@@ -24,16 +24,16 @@
namespace OCA\Deck\Middleware; namespace OCA\Deck\Middleware;
use OCA\Deck\Controller\PageController; use OCA\Deck\Controller\PageController;
use OCA\Deck\StatusException;
use OCA\Deck\Exceptions\ConflictException; use OCA\Deck\Exceptions\ConflictException;
use OCA\Deck\StatusException;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Middleware;
use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Middleware;
use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCSController; use OCP\AppFramework\OCSController;
use OCP\IConfig;
use OCP\ILogger; use OCP\ILogger;
use OCP\IRequest; use OCP\IRequest;
use OCP\IConfig;
class ExceptionMiddleware extends Middleware { class ExceptionMiddleware extends Middleware {

View File

@@ -38,9 +38,9 @@ class BoardReferenceProvider implements IReferenceProvider {
private IL10N $l10n; private IL10N $l10n;
public function __construct(BoardService $boardService, public function __construct(BoardService $boardService,
IURLGenerator $urlGenerator, IURLGenerator $urlGenerator,
IL10N $l10n, IL10N $l10n,
?string $userId) { ?string $userId) {
$this->urlGenerator = $urlGenerator; $this->urlGenerator = $urlGenerator;
$this->boardService = $boardService; $this->boardService = $boardService;
$this->userId = $userId; $this->userId = $userId;

View File

@@ -47,11 +47,11 @@ class CardReferenceProvider extends ADiscoverableReferenceProvider implements IS
private IL10N $l10n; private IL10N $l10n;
public function __construct(CardService $cardService, public function __construct(CardService $cardService,
BoardService $boardService, BoardService $boardService,
StackService $stackService, StackService $stackService,
IURLGenerator $urlGenerator, IURLGenerator $urlGenerator,
IL10N $l10n, IL10N $l10n,
?string $userId) { ?string $userId) {
$this->cardService = $cardService; $this->cardService = $cardService;
$this->urlGenerator = $urlGenerator; $this->urlGenerator = $urlGenerator;
$this->boardService = $boardService; $this->boardService = $boardService;

View File

@@ -48,12 +48,12 @@ class CommentReferenceProvider implements IReferenceProvider {
private CommentService $commentService; private CommentService $commentService;
public function __construct(CardService $cardService, public function __construct(CardService $cardService,
BoardService $boardService, BoardService $boardService,
StackService $stackService, StackService $stackService,
CommentService $commentService, CommentService $commentService,
IURLGenerator $urlGenerator, IURLGenerator $urlGenerator,
IL10N $l10n, IL10N $l10n,
?string $userId) { ?string $userId) {
$this->cardService = $cardService; $this->cardService = $cardService;
$this->urlGenerator = $urlGenerator; $this->urlGenerator = $urlGenerator;
$this->boardService = $boardService; $this->boardService = $boardService;

View File

@@ -26,6 +26,7 @@ namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\AppInfo\Application; use OCA\Deck\AppInfo\Application;
use OCA\Deck\BadRequestException; use OCA\Deck\BadRequestException;
use OCA\Deck\Cache\AttachmentCacheHelper;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
use OCA\Deck\Db\Attachment; use OCA\Deck\Db\Attachment;
use OCA\Deck\Db\AttachmentMapper; use OCA\Deck\Db\AttachmentMapper;
@@ -34,7 +35,6 @@ use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\InvalidAttachmentType; use OCA\Deck\InvalidAttachmentType;
use OCA\Deck\NoPermissionException; use OCA\Deck\NoPermissionException;
use OCA\Deck\NotFoundException; use OCA\Deck\NotFoundException;
use OCA\Deck\Cache\AttachmentCacheHelper;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
use OCA\Deck\Validators\AttachmentServiceValidator; use OCA\Deck\Validators\AttachmentServiceValidator;
use OCP\AppFramework\Db\IMapperException; use OCP\AppFramework\Db\IMapperException;

View File

@@ -27,13 +27,17 @@ namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Activity\ChangeSet; use OCA\Deck\Activity\ChangeSet;
use OCA\Deck\AppInfo\Application; use OCA\Deck\AppInfo\Application;
use OCA\Deck\BadRequestException;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
use OCA\Deck\Db\AclMapper; use OCA\Deck\Db\AclMapper;
use OCA\Deck\Db\AssignmentMapper; use OCA\Deck\Db\AssignmentMapper;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\ChangeHelper; use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\Db\IPermissionMapper; use OCA\Deck\Db\IPermissionMapper;
use OCA\Deck\Db\Label; use OCA\Deck\Db\Label;
use OCA\Deck\Db\LabelMapper;
use OCA\Deck\Db\Session; use OCA\Deck\Db\Session;
use OCA\Deck\Db\SessionMapper; use OCA\Deck\Db\SessionMapper;
use OCA\Deck\Db\Stack; use OCA\Deck\Db\Stack;
@@ -41,24 +45,20 @@ use OCA\Deck\Db\StackMapper;
use OCA\Deck\Event\AclCreatedEvent; use OCA\Deck\Event\AclCreatedEvent;
use OCA\Deck\Event\AclDeletedEvent; use OCA\Deck\Event\AclDeletedEvent;
use OCA\Deck\Event\AclUpdatedEvent; use OCA\Deck\Event\AclUpdatedEvent;
use OCA\Deck\Event\BoardUpdatedEvent;
use OCA\Deck\NoPermissionException; use OCA\Deck\NoPermissionException;
use OCA\Deck\Notification\NotificationHelper; use OCA\Deck\Notification\NotificationHelper;
use OCA\Deck\Validators\BoardServiceValidator;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException; use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\DB\Exception as DbException;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig; use OCP\IConfig;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\IL10N; use OCP\IL10N;
use OCP\DB\Exception as DbException;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\LabelMapper;
use OCP\IUserManager;
use OCA\Deck\BadRequestException;
use OCA\Deck\Event\BoardUpdatedEvent;
use OCA\Deck\Validators\BoardServiceValidator;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\Server; use OCP\Server;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
@@ -145,7 +145,7 @@ class BoardService {
* Get all boards that are shared with a user, their groups or circles * Get all boards that are shared with a user, their groups or circles
*/ */
public function getUserBoards(?int $since = null, bool $includeArchived = true, ?int $before = null, public function getUserBoards(?int $since = null, bool $includeArchived = true, ?int $before = null,
?string $term = null): array { ?string $term = null): array {
return $this->boardMapper->findAllForUser($this->userId, $since, $includeArchived, $before, $term); return $this->boardMapper->findAllForUser($this->userId, $since, $includeArchived, $before, $term);
} }

View File

@@ -28,13 +28,16 @@ namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Activity\ChangeSet; use OCA\Deck\Activity\ChangeSet;
use OCA\Deck\BadRequestException;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\Assignment; use OCA\Deck\Db\Assignment;
use OCA\Deck\Db\AssignmentMapper; use OCA\Deck\Db\AssignmentMapper;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card; use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\ChangeHelper; use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\Db\Label; use OCA\Deck\Db\Label;
use OCA\Deck\Db\LabelMapper;
use OCA\Deck\Db\StackMapper; use OCA\Deck\Db\StackMapper;
use OCA\Deck\Event\CardCreatedEvent; use OCA\Deck\Event\CardCreatedEvent;
use OCA\Deck\Event\CardDeletedEvent; use OCA\Deck\Event\CardDeletedEvent;
@@ -42,16 +45,13 @@ use OCA\Deck\Event\CardUpdatedEvent;
use OCA\Deck\Model\CardDetails; use OCA\Deck\Model\CardDetails;
use OCA\Deck\NoPermissionException; use OCA\Deck\NoPermissionException;
use OCA\Deck\Notification\NotificationHelper; use OCA\Deck\Notification\NotificationHelper;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\LabelMapper;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
use OCA\Deck\BadRequestException;
use OCA\Deck\Validators\CardServiceValidator; use OCA\Deck\Validators\CardServiceValidator;
use OCP\Comments\ICommentsManager; use OCP\Comments\ICommentsManager;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
use OCP\IRequest; use OCP\IRequest;
use OCP\IUserManager;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use OCP\IUserManager;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
class CardService { class CardService {

View File

@@ -24,10 +24,10 @@
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use OCA\Deck\AppInfo\Application; use OCA\Deck\AppInfo\Application;
use OCA\Deck\BadRequestException;
use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\BoardMapper;
use OCP\IConfig; use OCP\IConfig;
use OCP\IL10N; use OCP\IL10N;
use OCA\Deck\BadRequestException;
use OCP\PreConditionNotMetException; use OCP\PreConditionNotMetException;
class DefaultBoardService { class DefaultBoardService {
@@ -39,13 +39,13 @@ class DefaultBoardService {
private $l10n; private $l10n;
public function __construct( public function __construct(
IL10N $l10n, IL10N $l10n,
BoardMapper $boardMapper, BoardMapper $boardMapper,
BoardService $boardService, BoardService $boardService,
StackService $stackService, StackService $stackService,
CardService $cardService, CardService $cardService,
IConfig $config IConfig $config
) { ) {
$this->boardService = $boardService; $this->boardService = $boardService;
$this->stackService = $stackService; $this->stackService = $stackService;
$this->cardService = $cardService; $this->cardService = $cardService;

View File

@@ -25,8 +25,8 @@ namespace OCA\Deck\Service;
use OCA\Deck\Db\Attachment; use OCA\Deck\Db\Attachment;
use OCA\Deck\Db\AttachmentMapper; use OCA\Deck\Db\AttachmentMapper;
use OCA\Deck\StatusException;
use OCA\Deck\Exceptions\ConflictException; use OCA\Deck\Exceptions\ConflictException;
use OCA\Deck\StatusException;
use OCP\AppFramework\Http\StreamResponse; use OCP\AppFramework\Http\StreamResponse;
use OCP\Files\IAppData; use OCP\Files\IAppData;
use OCP\Files\IMimeTypeDetector; use OCP\Files\IMimeTypeDetector;

View File

@@ -23,12 +23,12 @@
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use OCA\Deck\BadRequestException;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\ChangeHelper; use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\Db\Label; use OCA\Deck\Db\Label;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\LabelMapper; use OCA\Deck\Db\LabelMapper;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
use OCA\Deck\BadRequestException;
use OCA\Deck\Validators\LabelServiceValidator; use OCA\Deck\Validators\LabelServiceValidator;
class LabelService { class LabelService {
@@ -50,7 +50,7 @@ class LabelService {
BoardService $boardService, BoardService $boardService,
ChangeHelper $changeHelper, ChangeHelper $changeHelper,
LabelServiceValidator $labelServiceValidator LabelServiceValidator $labelServiceValidator
) { ) {
$this->labelMapper = $labelMapper; $this->labelMapper = $labelMapper;
$this->permissionService = $permissionService; $this->permissionService = $permissionService;
$this->boardService = $boardService; $this->boardService = $boardService;

View File

@@ -29,11 +29,11 @@ namespace OCA\Deck\Service;
use OCA\Deck\Db\AssignmentMapper; use OCA\Deck\Db\AssignmentMapper;
use OCA\Deck\Db\Board; use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\LabelMapper;
use OCA\Deck\Model\CardDetails; use OCA\Deck\Model\CardDetails;
use OCP\Comments\ICommentsManager; use OCP\Comments\ICommentsManager;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\LabelMapper;
use OCP\IUserManager; use OCP\IUserManager;
class OverviewService { class OverviewService {

View File

@@ -23,7 +23,6 @@
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use OCP\Cache\CappedMemoryCache;
use OCA\Circles\Model\Member; use OCA\Circles\Model\Member;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
use OCA\Deck\Db\AclMapper; use OCA\Deck\Db\AclMapper;
@@ -34,6 +33,7 @@ use OCA\Deck\Db\User;
use OCA\Deck\NoPermissionException; use OCA\Deck\NoPermissionException;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException; use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\Cache\CappedMemoryCache;
use OCP\IConfig; use OCP\IConfig;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\ILogger; use OCP\ILogger;

View File

@@ -26,12 +26,12 @@ namespace OCA\Deck\Service;
use OCA\Deck\Db\Session; use OCA\Deck\Db\Session;
use OCA\Deck\Db\SessionMapper; use OCA\Deck\Db\SessionMapper;
use OCA\Deck\Event\SessionCreatedEvent;
use OCA\Deck\Event\SessionClosedEvent; use OCA\Deck\Event\SessionClosedEvent;
use OCA\Deck\Event\SessionCreatedEvent;
use OCA\NotifyPush\Queue\IQueue;
use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Utility\ITimeFactory; use OCP\AppFramework\Utility\ITimeFactory;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
use OCA\NotifyPush\Queue\IQueue;
use OCP\Security\ISecureRandom; use OCP\Security\ISecureRandom;
class SessionService { class SessionService {

View File

@@ -23,7 +23,7 @@
* *
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace OCA\Deck\Validators; namespace OCA\Deck\Validators;

View File

@@ -20,8 +20,6 @@
<directory name="vendor" /> <directory name="vendor" />
<ignoreFiles> <ignoreFiles>
<directory name="vendor/phpunit/php-code-coverage" /> <directory name="vendor/phpunit/php-code-coverage" />
<directory name="vendor/vimeo" />
<directory name="vendor/friendsofphp" />
</ignoreFiles> </ignoreFiles>
</extraFiles> </extraFiles>
<issueHandlers> <issueHandlers>

View File

@@ -26,8 +26,8 @@ namespace OCA\Deck\Db;
use OCA\Deck\NotFoundException; use OCA\Deck\NotFoundException;
use OCA\Deck\Service\AssignmentService; use OCA\Deck\Service\AssignmentService;
use OCA\Deck\Service\BoardService; use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\StackService;
use OCA\Deck\Service\CardService; use OCA\Deck\Service\CardService;
use OCA\Deck\Service\StackService;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\IUserSession; use OCP\IUserSession;

View File

@@ -1,11 +1,11 @@
<?php <?php
use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope; use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Gherkin\Node\TableNode; use Behat\Gherkin\Node\TableNode;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ClientException;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use Behat\Behat\Context\Context;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
require_once __DIR__ . '/../../vendor/autoload.php'; require_once __DIR__ . '/../../vendor/autoload.php';

View File

@@ -1,22 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.6.0@e784128902dfe01d489c4123d69918a9f3c1eac5"> <files psalm-version="5.18.0@b113f3ed0259fd6e212d87c3df80eec95a6abf19">
<file src="lib/Activity/Filter.php"> <file src="lib/Activity/Filter.php">
<MethodSignatureMismatch> <MethodSignatureMismatch>
<code>$types</code> <code>$types</code>
</MethodSignatureMismatch> </MethodSignatureMismatch>
</file> </file>
<file src="lib/Command/BoardImport.php">
<UndefinedClass>
<code>Command</code>
</UndefinedClass>
</file>
<file src="lib/Command/TransferOwnership.php">
<UndefinedClass>
<code>Command</code>
</UndefinedClass>
</file>
<file src="lib/Command/UserExport.php"> <file src="lib/Command/UserExport.php">
<ImplementedReturnTypeMismatch> <UndefinedClass>
<code>void</code> <code>Command</code>
</ImplementedReturnTypeMismatch> </UndefinedClass>
<UndefinedThisPropertyAssignment>
<code>$this-&gt;boardMapper</code>
<code>$this-&gt;stackMapper</code>
</UndefinedThisPropertyAssignment>
<UndefinedThisPropertyFetch>
<code>$this-&gt;boardMapper</code>
<code>$this-&gt;stackMapper</code>
</UndefinedThisPropertyFetch>
</file> </file>
<file src="lib/Controller/BoardApiController.php"> <file src="lib/Controller/BoardApiController.php">
<TypeDoesNotContainNull> <TypeDoesNotContainNull>
@@ -27,10 +29,10 @@
<code>Util</code> <code>Util</code>
</UndefinedClass> </UndefinedClass>
<UndefinedThisPropertyAssignment> <UndefinedThisPropertyAssignment>
<code>$this-&gt;userId</code> <code><![CDATA[$this->userId]]></code>
</UndefinedThisPropertyAssignment> </UndefinedThisPropertyAssignment>
<UndefinedThisPropertyFetch> <UndefinedThisPropertyFetch>
<code>$this-&gt;userId</code> <code><![CDATA[$this->userId]]></code>
</UndefinedThisPropertyFetch> </UndefinedThisPropertyFetch>
</file> </file>
<file src="lib/Controller/CommentsApiController.php"> <file src="lib/Controller/CommentsApiController.php">
@@ -76,6 +78,11 @@
<code>NotFound</code> <code>NotFound</code>
</UndefinedClass> </UndefinedClass>
</file> </file>
<file src="lib/Db/BoardMapper.php">
<UndefinedVariable>
<code>$userManager</code>
</UndefinedVariable>
</file>
<file src="lib/Db/Card.php"> <file src="lib/Db/Card.php">
<UndefinedClass> <UndefinedClass>
<code>VCalendar</code> <code>VCalendar</code>
@@ -84,7 +91,7 @@
</file> </file>
<file src="lib/Db/CardMapper.php"> <file src="lib/Db/CardMapper.php">
<InvalidScalarArgument> <InvalidScalarArgument>
<code>$entity-&gt;getId()</code> <code><![CDATA[$entity->getId()]]></code>
</InvalidScalarArgument> </InvalidScalarArgument>
<UndefinedInterfaceMethod> <UndefinedInterfaceMethod>
<code>getUserIdGroups</code> <code>getUserIdGroups</code>
@@ -113,15 +120,6 @@
<code>public function __construct(Card $card, ?Board $board = null) {</code> <code>public function __construct(Card $card, ?Board $board = null) {</code>
</ConstructorSignatureMismatch> </ConstructorSignatureMismatch>
</file> </file>
<file src="lib/Service/AttachmentService.php">
<InvalidCatch>
<code>try {
$attachment = $this-&gt;attachmentMapper-&gt;find($attachmentId);
} catch (IMapperException $e) {
throw new NoPermissionException('Permission denied');
}</code>
</InvalidCatch>
</file>
<file src="lib/Service/BoardService.php"> <file src="lib/Service/BoardService.php">
<TooManyArguments> <TooManyArguments>
<code>findAll</code> <code>findAll</code>
@@ -139,6 +137,21 @@
<code>is_resource($content)</code> <code>is_resource($content)</code>
</RedundantCondition> </RedundantCondition>
</file> </file>
<file src="lib/Service/Importer/BoardImportCommandService.php">
<UndefinedClass>
<code><![CDATA[$this->getCommand()]]></code>
<code><![CDATA[$this->getCommand()]]></code>
<code><![CDATA[$this->getCommand()]]></code>
<code>ChoiceQuestion</code>
<code>Command</code>
<code>Command</code>
<code>Question</code>
<code>Question</code>
</UndefinedClass>
<UndefinedDocblockClass>
<code>Command</code>
</UndefinedDocblockClass>
</file>
<file src="lib/Sharing/DeckShareProvider.php"> <file src="lib/Sharing/DeckShareProvider.php">
<InvalidReturnType> <InvalidReturnType>
<code>getShareByToken</code> <code>getShareByToken</code>
@@ -148,5 +161,9 @@
<InvalidArgument> <InvalidArgument>
<code>[self::class, 'listenPreShare']</code> <code>[self::class, 'listenPreShare']</code>
</InvalidArgument> </InvalidArgument>
<UndefinedClass>
<code>GenericEvent</code>
<code>GenericEvent</code>
</UndefinedClass>
</file> </file>
</files> </files>

View File

@@ -39,8 +39,8 @@ use OCP\Activity\IManager;
use OCP\IL10N; use OCP\IL10N;
use OCP\IUser; use OCP\IUser;
use OCP\L10N\IFactory; use OCP\L10N\IFactory;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
class ActivityManagerTest extends TestCase { class ActivityManagerTest extends TestCase {

View File

@@ -26,6 +26,7 @@ namespace OCA\Deck\Activity;
use OC\Activity\Event; use OC\Activity\Event;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
use OCA\Deck\Db\Card; use OCA\Deck\Db\Card;
use OCA\Deck\Service\CardService;
use OCP\Activity\IEvent; use OCP\Activity\IEvent;
use OCP\Comments\IComment; use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager; use OCP\Comments\ICommentsManager;
@@ -38,7 +39,6 @@ use OCP\L10N\IFactory;
use OCP\RichObjectStrings\IValidator; use OCP\RichObjectStrings\IValidator;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use PHPUnit_Framework_MockObject_MockObject as MockObject; use PHPUnit_Framework_MockObject_MockObject as MockObject;
use OCA\Deck\Service\CardService;
class DeckProviderTest extends TestCase { class DeckProviderTest extends TestCase {

View File

@@ -31,8 +31,8 @@ use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\PermissionService; use OCA\Deck\Service\PermissionService;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\JSONResponse;
use OCP\ILogger;
use OCP\IConfig; use OCP\IConfig;
use OCP\ILogger;
use OCP\IRequest; use OCP\IRequest;
class ExceptionMiddlewareTest extends \Test\TestCase { class ExceptionMiddlewareTest extends \Test\TestCase {

View File

@@ -23,6 +23,7 @@
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use \Test\TestCase;
use OC\L10N\L10N; use OC\L10N\L10N;
use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Db\Acl; use OCA\Deck\Db\Acl;
@@ -41,16 +42,15 @@ use OCA\Deck\Event\AclCreatedEvent;
use OCA\Deck\Event\AclDeletedEvent; use OCA\Deck\Event\AclDeletedEvent;
use OCA\Deck\NoPermissionException; use OCA\Deck\NoPermissionException;
use OCA\Deck\Notification\NotificationHelper; use OCA\Deck\Notification\NotificationHelper;
use OCA\Deck\Validators\BoardServiceValidator;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig; use OCP\IConfig;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IURLGenerator;
use OCP\IUser; use OCP\IUser;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\IGroupManager;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use \Test\TestCase;
use OCP\IURLGenerator;
use OCA\Deck\Validators\BoardServiceValidator;
class BoardServiceTest extends TestCase { class BoardServiceTest extends TestCase {

View File

@@ -27,13 +27,13 @@ use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Db\Assignment; use OCA\Deck\Db\Assignment;
use OCA\Deck\Db\AssignmentMapper; use OCA\Deck\Db\AssignmentMapper;
use OCA\Deck\Db\Board; use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card; use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\ChangeHelper; use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\Db\LabelMapper;
use OCA\Deck\Db\Stack; use OCA\Deck\Db\Stack;
use OCA\Deck\Db\StackMapper; use OCA\Deck\Db\StackMapper;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\LabelMapper;
use OCA\Deck\Model\CardDetails; use OCA\Deck\Model\CardDetails;
use OCA\Deck\Notification\NotificationHelper; use OCA\Deck\Notification\NotificationHelper;
use OCA\Deck\StatusException; use OCA\Deck\StatusException;
@@ -42,13 +42,13 @@ use OCP\Activity\IEvent;
use OCP\Comments\ICommentsManager; use OCP\Comments\ICommentsManager;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
use OCP\IRequest; use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\IUser; use OCP\IUser;
use OCP\IUserManager; use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase; use Test\TestCase;
use OCP\IURLGenerator;
class CardServiceTest extends TestCase { class CardServiceTest extends TestCase {

View File

@@ -23,13 +23,13 @@
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use OCA\Deck\Db\Card; use \Test\TestCase;
use OCA\Deck\Db\Board; use OCA\Deck\Db\Board;
use OCA\Deck\Db\Stack;
use OCA\Deck\Db\BoardMapper; use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card;
use OCA\Deck\Db\Stack;
use OCP\IConfig; use OCP\IConfig;
use OCP\IL10N; use OCP\IL10N;
use \Test\TestCase;
class DefaultBoardServiceTest extends TestCase { class DefaultBoardServiceTest extends TestCase {

View File

@@ -23,11 +23,12 @@
namespace OCA\Deck\Service; namespace OCA\Deck\Service;
use \Test\TestCase;
use OCA\Deck\Activity\ActivityManager; use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Db\AssignmentMapper; use OCA\Deck\Db\AssignmentMapper;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card; use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper; use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\ChangeHelper; use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\Db\Label; use OCA\Deck\Db\Label;
use OCA\Deck\Db\LabelMapper; use OCA\Deck\Db\LabelMapper;
@@ -37,7 +38,6 @@ use OCA\Deck\Model\CardDetails;
use OCA\Deck\Validators\StackServiceValidator; use OCA\Deck\Validators\StackServiceValidator;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use \Test\TestCase;
/** /**
* Class StackServiceTest * Class StackServiceTest
@@ -117,17 +117,17 @@ class StackServiceTest extends TestCase {
$this->permissionService->expects($this->once())->method('checkPermission'); $this->permissionService->expects($this->once())->method('checkPermission');
$this->stackMapper->expects($this->once())->method('findAll')->willReturn($this->getStacks()); $this->stackMapper->expects($this->once())->method('findAll')->willReturn($this->getStacks());
$this->cardService->expects($this->atLeastOnce())->method('enrichCards')->will( $this->cardService->expects($this->atLeastOnce())->method('enrichCards')->will(
$this->returnCallback( $this->returnCallback(
function ($cards) { function ($cards) {
foreach ($cards as $card) { foreach ($cards as $card) {
$card->setLabels($this->getLabels()[$card->getId()]); $card->setLabels($this->getLabels()[$card->getId()]);
} }
return array_map(function ($card) { return array_map(function ($card) {
return new CardDetails($card); return new CardDetails($card);
}, $cards); }, $cards);
} }
) )
); );
$this->cardMapper->expects($this->any())->method('findAll')->willReturn($this->getCards(222)); $this->cardMapper->expects($this->any())->method('findAll')->willReturn($this->getCards(222));

View File

@@ -22,13 +22,13 @@
*/ */
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Db\Board;
use OCA\Deck\Service\BoardService;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest; use OCP\IRequest;
use OCA\Deck\Service\BoardService;
use OCA\Deck\Db\Board;
class BoardApiControllerTest extends \Test\TestCase { class BoardApiControllerTest extends \Test\TestCase {
private $appName = 'deck'; private $appName = 'deck';
private $userId = 'admin'; private $userId = 'admin';

View File

@@ -23,10 +23,10 @@
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Db\Board; use OCA\Deck\Db\Board;
use OCA\Deck\Service\Importer\BoardImportService;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest; use OCP\IRequest;
use OCA\Deck\Service\Importer\BoardImportService;
class BoardImportApiControllerTest extends \Test\TestCase { class BoardImportApiControllerTest extends \Test\TestCase {
private $appName = 'deck'; private $appName = 'deck';

View File

@@ -22,14 +22,14 @@
*/ */
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Db\Card;
use OCA\Deck\Service\AssignmentService; use OCA\Deck\Service\AssignmentService;
use OCA\Deck\Service\CardService;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest; use OCP\IRequest;
use OCA\Deck\Db\Card;
use OCA\Deck\Service\CardService;
class CardApiControllerTest extends \Test\TestCase { class CardApiControllerTest extends \Test\TestCase {
private $controller; private $controller;
private $request; private $request;

View File

@@ -22,12 +22,12 @@
*/ */
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
use OCA\Deck\Db\Label; use OCA\Deck\Db\Label;
use OCA\Deck\Service\LabelService; use OCA\Deck\Service\LabelService;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
class LabelApiControllerTest extends \Test\TestCase { class LabelApiControllerTest extends \Test\TestCase {
private $controller; private $controller;

View File

@@ -29,9 +29,9 @@ use OCA\Deck\Service\CardService;
use OCA\Deck\Service\ConfigService; use OCA\Deck\Service\ConfigService;
use OCA\Deck\Service\PermissionService; use OCA\Deck\Service\PermissionService;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IInitialStateService; use OCP\IInitialStateService;
use OCP\IRequest; use OCP\IRequest;
use OCP\IConfig;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;

View File

@@ -22,14 +22,14 @@
*/ */
namespace OCA\Deck\Controller; namespace OCA\Deck\Controller;
use OCA\Deck\Db\Stack;
use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\StackService;
use OCP\AppFramework\Http; use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest; use OCP\IRequest;
use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\StackService;
use OCA\Deck\Db\Stack;
class StackApiControllerTest extends \Test\TestCase { class StackApiControllerTest extends \Test\TestCase {
private $appName = 'deck'; private $appName = 'deck';
private $userId = 'admin'; private $userId = 'admin';