diff --git a/appinfo/autoload.php b/appinfo/autoload.php
index 4459d8394..434b7b5a2 100644
--- a/appinfo/autoload.php
+++ b/appinfo/autoload.php
@@ -23,8 +23,6 @@
namespace OCA\Deck\AppInfo;
-use OCP\AppFramework\App;
-
/**
* Additional autoloader registration, e.g. registering composer autoloaders
*/
diff --git a/lib/Activity/ActivityManager.php b/lib/Activity/ActivityManager.php
index a432f63e4..b3fe84de7 100644
--- a/lib/Activity/ActivityManager.php
+++ b/lib/Activity/ActivityManager.php
@@ -48,8 +48,7 @@ use OCP\IL10N;
use OCP\IUser;
class ActivityManager {
-
- const DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED = 'DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED';
+ public const DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED = 'DECK_NOAUTHOR_COMMENT_SYSTEM_ENFORCED';
private $manager;
private $userId;
private $permissionService;
@@ -60,49 +59,49 @@ class ActivityManager {
private $stackMapper;
private $l10n;
- const DECK_OBJECT_BOARD = 'deck_board';
- const DECK_OBJECT_CARD = 'deck_card';
+ public const DECK_OBJECT_BOARD = 'deck_board';
+ public const DECK_OBJECT_CARD = 'deck_card';
- const SUBJECT_BOARD_CREATE = 'board_create';
- const SUBJECT_BOARD_UPDATE = 'board_update';
- const SUBJECT_BOARD_UPDATE_TITLE = 'board_update_title';
- const SUBJECT_BOARD_UPDATE_ARCHIVED = 'board_update_archived';
- const SUBJECT_BOARD_DELETE = 'board_delete';
- const SUBJECT_BOARD_RESTORE = 'board_restore';
- const SUBJECT_BOARD_SHARE = 'board_share';
- const SUBJECT_BOARD_UNSHARE = 'board_unshare';
+ public const SUBJECT_BOARD_CREATE = 'board_create';
+ public const SUBJECT_BOARD_UPDATE = 'board_update';
+ public const SUBJECT_BOARD_UPDATE_TITLE = 'board_update_title';
+ public const SUBJECT_BOARD_UPDATE_ARCHIVED = 'board_update_archived';
+ public const SUBJECT_BOARD_DELETE = 'board_delete';
+ public const SUBJECT_BOARD_RESTORE = 'board_restore';
+ public const SUBJECT_BOARD_SHARE = 'board_share';
+ public const SUBJECT_BOARD_UNSHARE = 'board_unshare';
- const SUBJECT_STACK_CREATE = 'stack_create';
- const SUBJECT_STACK_UPDATE = 'stack_update';
- const SUBJECT_STACK_UPDATE_TITLE = 'stack_update_title';
- const SUBJECT_STACK_UPDATE_ORDER = 'stack_update_order';
- const SUBJECT_STACK_DELETE = 'stack_delete';
+ public const SUBJECT_STACK_CREATE = 'stack_create';
+ public const SUBJECT_STACK_UPDATE = 'stack_update';
+ public const SUBJECT_STACK_UPDATE_TITLE = 'stack_update_title';
+ public const SUBJECT_STACK_UPDATE_ORDER = 'stack_update_order';
+ public const SUBJECT_STACK_DELETE = 'stack_delete';
- const SUBJECT_CARD_CREATE = 'card_create';
- const SUBJECT_CARD_DELETE = 'card_delete';
- const SUBJECT_CARD_RESTORE = 'card_restore';
- const SUBJECT_CARD_UPDATE = 'card_update';
- const SUBJECT_CARD_UPDATE_TITLE = 'card_update_title';
- const SUBJECT_CARD_UPDATE_DESCRIPTION = 'card_update_description';
- const SUBJECT_CARD_UPDATE_DUEDATE = 'card_update_duedate';
- const SUBJECT_CARD_UPDATE_ARCHIVE = 'card_update_archive';
- const SUBJECT_CARD_UPDATE_UNARCHIVE = 'card_update_unarchive';
- const SUBJECT_CARD_UPDATE_STACKID = 'card_update_stackId';
- const SUBJECT_CARD_USER_ASSIGN = 'card_user_assign';
- const SUBJECT_CARD_USER_UNASSIGN = 'card_user_unassign';
+ public const SUBJECT_CARD_CREATE = 'card_create';
+ public const SUBJECT_CARD_DELETE = 'card_delete';
+ public const SUBJECT_CARD_RESTORE = 'card_restore';
+ public const SUBJECT_CARD_UPDATE = 'card_update';
+ public const SUBJECT_CARD_UPDATE_TITLE = 'card_update_title';
+ public const SUBJECT_CARD_UPDATE_DESCRIPTION = 'card_update_description';
+ public const SUBJECT_CARD_UPDATE_DUEDATE = 'card_update_duedate';
+ public const SUBJECT_CARD_UPDATE_ARCHIVE = 'card_update_archive';
+ public const SUBJECT_CARD_UPDATE_UNARCHIVE = 'card_update_unarchive';
+ public const SUBJECT_CARD_UPDATE_STACKID = 'card_update_stackId';
+ public const SUBJECT_CARD_USER_ASSIGN = 'card_user_assign';
+ public const SUBJECT_CARD_USER_UNASSIGN = 'card_user_unassign';
- const SUBJECT_ATTACHMENT_CREATE = 'attachment_create';
- const SUBJECT_ATTACHMENT_UPDATE = 'attachment_update';
- const SUBJECT_ATTACHMENT_DELETE = 'attachment_delete';
- const SUBJECT_ATTACHMENT_RESTORE = 'attachment_restore';
+ public const SUBJECT_ATTACHMENT_CREATE = 'attachment_create';
+ public const SUBJECT_ATTACHMENT_UPDATE = 'attachment_update';
+ public const SUBJECT_ATTACHMENT_DELETE = 'attachment_delete';
+ public const SUBJECT_ATTACHMENT_RESTORE = 'attachment_restore';
- const SUBJECT_LABEL_CREATE = 'label_create';
- const SUBJECT_LABEL_UPDATE = 'label_update';
- const SUBJECT_LABEL_DELETE = 'label_delete';
- const SUBJECT_LABEL_ASSIGN = 'label_assign';
- const SUBJECT_LABEL_UNASSING = 'label_unassign';
+ public const SUBJECT_LABEL_CREATE = 'label_create';
+ public const SUBJECT_LABEL_UPDATE = 'label_update';
+ public const SUBJECT_LABEL_DELETE = 'label_delete';
+ public const SUBJECT_LABEL_ASSIGN = 'label_assign';
+ public const SUBJECT_LABEL_UNASSING = 'label_unassign';
- const SUBJECT_CARD_COMMENT_CREATE = 'card_comment_create';
+ public const SUBJECT_CARD_COMMENT_CREATE = 'card_comment_create';
public function __construct(
IManager $manager,
@@ -197,7 +196,7 @@ class ActivityManager {
case self::SUBJECT_CARD_UPDATE_DUEDATE:
if (!isset($subjectParams['after'])) {
$subject = $ownActivity ? $this->l10n->t('You have removed the due date of card {card}') : $this->l10n->t('{user} has removed the due date of card {card}');
- } else if (!isset($subjectParams['before']) && isset($subjectParams['after'])) {
+ } elseif (!isset($subjectParams['before']) && isset($subjectParams['after'])) {
$subject = $ownActivity ? $this->l10n->t('You have set the due date of card {card} to {after}') : $this->l10n->t('{user} has set the due date of card {card} to {after}');
} else {
$subject = $ownActivity ? $this->l10n->t('You have updated the due date of card {card} to {after}') : $this->l10n->t('{user} has updated the due date of card {card} to {after}');
@@ -376,7 +375,7 @@ class ActivityManager {
break;
}
- if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION){
+ if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION) {
$card = $subjectParams['card'];
if ($card->getLastEditor() === $this->userId) {
return null;
@@ -526,5 +525,4 @@ class ActivityManager {
'board' => $board
];
}
-
}
diff --git a/lib/Activity/ChangeSet.php b/lib/Activity/ChangeSet.php
index 9040192a4..c4519c375 100644
--- a/lib/Activity/ChangeSet.php
+++ b/lib/Activity/ChangeSet.php
@@ -23,9 +23,7 @@
namespace OCA\Deck\Activity;
-
class ChangeSet implements \JsonSerializable {
-
private $before;
private $after;
private $diff = false;
diff --git a/lib/Activity/CommentEventHandler.php b/lib/Activity/CommentEventHandler.php
index 7a6981a7f..530fde2a4 100644
--- a/lib/Activity/CommentEventHandler.php
+++ b/lib/Activity/CommentEventHandler.php
@@ -50,12 +50,12 @@ class CommentEventHandler implements ICommentsEventHandler {
* @param CommentsEvent $event
*/
public function handle(CommentsEvent $event) {
- if($event->getComment()->getObjectType() !== 'deckCard') {
+ if ($event->getComment()->getObjectType() !== 'deckCard') {
return;
}
$eventType = $event->getEvent();
- if( $eventType === CommentsEvent::EVENT_ADD
+ if ($eventType === CommentsEvent::EVENT_ADD
) {
$this->notificationHandler($event);
$this->activityHandler($event);
@@ -65,7 +65,7 @@ class CommentEventHandler implements ICommentsEventHandler {
$applicableEvents = [
CommentsEvent::EVENT_UPDATE
];
- if(in_array($eventType, $applicableEvents)) {
+ if (in_array($eventType, $applicableEvents)) {
$this->notificationHandler($event);
return;
}
@@ -79,7 +79,6 @@ class CommentEventHandler implements ICommentsEventHandler {
$comment = $event->getComment();
$card = $this->cardMapper->find($comment->getObjectId());
$this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_CARD, $card, ActivityManager::SUBJECT_CARD_COMMENT_CREATE, ['comment' => $comment]);
-
}
/**
diff --git a/lib/Activity/DeckProvider.php b/lib/Activity/DeckProvider.php
index 35551acc9..9bbb53bfb 100644
--- a/lib/Activity/DeckProvider.php
+++ b/lib/Activity/DeckProvider.php
@@ -25,7 +25,6 @@
namespace OCA\Deck\Activity;
-
use cogpowered\FineDiff\Diff;
use OCA\Deck\Db\Acl;
use OCP\Activity\IEvent;
diff --git a/lib/Activity/DescriptionSetting.php b/lib/Activity/DescriptionSetting.php
index 787647ffa..5ba28f8f2 100644
--- a/lib/Activity/DescriptionSetting.php
+++ b/lib/Activity/DescriptionSetting.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Activity;
-
class DescriptionSetting extends Setting {
/**
@@ -41,5 +40,4 @@ class DescriptionSetting extends Setting {
public function getName() {
return $this->l->t('A card description inside the Deck app has been changed');
}
-
}
diff --git a/lib/Activity/Filter.php b/lib/Activity/Filter.php
index 62b9a7c83..7f849d66e 100644
--- a/lib/Activity/Filter.php
+++ b/lib/Activity/Filter.php
@@ -27,7 +27,6 @@ use OCP\IL10N;
use OCP\IURLGenerator;
class Filter implements \OCP\Activity\IFilter {
-
private $l10n;
private $urlGenerator;
diff --git a/lib/Activity/Setting.php b/lib/Activity/Setting.php
index 9da38530c..ac1dfed52 100644
--- a/lib/Activity/Setting.php
+++ b/lib/Activity/Setting.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Activity;
-
use OCP\IL10N;
class Setting implements \OCP\Activity\ISetting {
diff --git a/lib/Activity/SettingComment.php b/lib/Activity/SettingComment.php
index fd8ad178b..795437156 100644
--- a/lib/Activity/SettingComment.php
+++ b/lib/Activity/SettingComment.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Activity;
-
class SettingComment extends Setting {
/**
@@ -49,5 +48,4 @@ class SettingComment extends Setting {
public function canChangeStream() {
return false;
}
-
}
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 1bb13c028..7d39ad127 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -24,7 +24,6 @@
namespace OCA\Deck\AppInfo;
use Exception;
-use InvalidArgumentException;
use OC_Util;
use OCA\Deck\Activity\CommentEventHandler;
use OCA\Deck\Capabilities;
@@ -52,10 +51,8 @@ use OCP\IUser;
use OCP\IUserManager;
use OCP\IURLGenerator;
use OCP\Util;
-use Symfony\Component\EventDispatcher\GenericEvent;
class Application extends App {
-
public const APP_ID = 'deck';
public const COMMENT_ENTITY_TYPE = 'deckCard';
@@ -69,7 +66,7 @@ class Application extends App {
/** @var IFullTextSearchManager */
private $fullTextSearchManager;
- public function __construct(array $urlParams = array()) {
+ public function __construct(array $urlParams = []) {
parent::__construct('deck', $urlParams);
$container = $this->getContainer();
@@ -81,10 +78,10 @@ class Application extends App {
$container->registerMiddleWare(ExceptionMiddleware::class);
$container->registerMiddleWare(DefaultBoardMiddleware::class);
- $container->registerService('databaseType', static function() use ($server) {
+ $container->registerService('databaseType', static function () use ($server) {
return $server->getConfig()->getSystemValue('dbtype', 'sqlite');
});
- $container->registerService('database4ByteSupport', static function() use ($server) {
+ $container->registerService('database4ByteSupport', static function () use ($server) {
return $server->getDatabaseConnection()->supports4ByteText();
});
}
@@ -100,7 +97,7 @@ class Application extends App {
public function registerNavigationEntry(): void {
$container = $this->getContainer();
- $this->server->getNavigationManager()->add(static function() use ($container) {
+ $this->server->getNavigationManager()->add(static function () use ($container) {
$urlGenerator = $container->query(IURLGenerator::class);
return [
'id' => 'deck',
@@ -117,7 +114,7 @@ class Application extends App {
// Delete user/group acl entries when they get deleted
/** @var IUserManager $userManager */
$userManager = $this->server->getUserManager();
- $userManager->listen('\OC\User', 'postDelete', static function(IUser $user) use ($container) {
+ $userManager->listen('\OC\User', 'postDelete', static function (IUser $user) use ($container) {
// delete existing acl entries for deleted user
/** @var AclMapper $aclMapper */
$aclMapper = $container->query(AclMapper::class);
@@ -135,7 +132,7 @@ class Application extends App {
/** @var IUserManager $userManager */
$groupManager = $this->server->getGroupManager();
- $groupManager->listen('\OC\Group', 'postDelete', static function(IGroup $group) use ($container) {
+ $groupManager->listen('\OC\Group', 'postDelete', static function (IGroup $group) use ($container) {
/** @var AclMapper $aclMapper */
$aclMapper = $container->query(AclMapper::class);
$aclMapper->findByParticipant(Acl::PERMISSION_TYPE_GROUP, $group->getGID());
@@ -152,8 +149,8 @@ class Application extends App {
}
public function registerCommentsEntity(): void {
- $this->server->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) {
- $event->addEntityCollection(self::COMMENT_ENTITY_TYPE, function($name) {
+ $this->server->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) {
+ $event->addEntityCollection(self::COMMENT_ENTITY_TYPE, function ($name) {
/** @var CardMapper */
$cardMapper = $this->getContainer()->query(CardMapper::class);
$permissionService = $this->getContainer()->query(PermissionService::class);
@@ -222,35 +219,34 @@ class Application extends App {
/** @var IEventDispatcher $eventDispatcher */
$eventDispatcher = $this->server->query(IEventDispatcher::class);
$eventDispatcher->addListener(
- '\OCA\Deck\Card::onCreate', function(Event $e) {
- $this->fullTextSearchService->onCardCreated($e);
- }
+ '\OCA\Deck\Card::onCreate', function (Event $e) {
+ $this->fullTextSearchService->onCardCreated($e);
+ }
);
$eventDispatcher->addListener(
- '\OCA\Deck\Card::onUpdate', function(Event $e) {
- $this->fullTextSearchService->onCardUpdated($e);
- }
+ '\OCA\Deck\Card::onUpdate', function (Event $e) {
+ $this->fullTextSearchService->onCardUpdated($e);
+ }
);
$eventDispatcher->addListener(
- '\OCA\Deck\Card::onDelete', function(Event $e) {
- $this->fullTextSearchService->onCardDeleted($e);
- }
+ '\OCA\Deck\Card::onDelete', function (Event $e) {
+ $this->fullTextSearchService->onCardDeleted($e);
+ }
);
$eventDispatcher->addListener(
- '\OCA\Deck\Board::onShareNew', function(Event $e) {
- $this->fullTextSearchService->onBoardShares($e);
- }
+ '\OCA\Deck\Board::onShareNew', function (Event $e) {
+ $this->fullTextSearchService->onBoardShares($e);
+ }
);
$eventDispatcher->addListener(
- '\OCA\Deck\Board::onShareEdit', function(Event $e) {
- $this->fullTextSearchService->onBoardShares($e);
- }
+ '\OCA\Deck\Board::onShareEdit', function (Event $e) {
+ $this->fullTextSearchService->onBoardShares($e);
+ }
);
$eventDispatcher->addListener(
- '\OCA\Deck\Board::onShareDelete', function(Event $e) {
- $this->fullTextSearchService->onBoardShares($e);
- }
+ '\OCA\Deck\Board::onShareDelete', function (Event $e) {
+ $this->fullTextSearchService->onBoardShares($e);
+ }
);
}
-
}
diff --git a/lib/ArchivedItemException.php b/lib/ArchivedItemException.php
index e3e9cef61..adff7fb6f 100644
--- a/lib/ArchivedItemException.php
+++ b/lib/ArchivedItemException.php
@@ -5,20 +5,20 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck;
@@ -31,4 +31,4 @@ class ArchivedItemException extends \Exception {
public function __construct($msg = 'Operation not allowed. Item is archived.') {
parent::__construct($msg);
}
-}
\ No newline at end of file
+}
diff --git a/lib/BadRequestException.php b/lib/BadRequestException.php
index b3ffb98c1..b507a937b 100644
--- a/lib/BadRequestException.php
+++ b/lib/BadRequestException.php
@@ -24,8 +24,8 @@
namespace OCA\Deck;
use OCP\AppFramework\Http;
-class BadRequestException extends StatusException {
+class BadRequestException extends StatusException {
public function __construct($message) {
parent::__construct($message);
}
@@ -33,4 +33,4 @@ class BadRequestException extends StatusException {
public function getStatus() {
return HTTP::STATUS_BAD_REQUEST;
}
-}
\ No newline at end of file
+}
diff --git a/lib/Capabilities.php b/lib/Capabilities.php
index 57267c5ca..1a7435236 100644
--- a/lib/Capabilities.php
+++ b/lib/Capabilities.php
@@ -23,10 +23,9 @@
namespace OCA\Deck;
-
use OCP\Capabilities\ICapability;
-class Capabilities implements ICapability {
+class Capabilities implements ICapability {
/**
* Function an app uses to return the capabilities
diff --git a/lib/Collaboration/Resources/ResourceProvider.php b/lib/Collaboration/Resources/ResourceProvider.php
index afaa28a4e..e00cc2de5 100644
--- a/lib/Collaboration/Resources/ResourceProvider.php
+++ b/lib/Collaboration/Resources/ResourceProvider.php
@@ -23,9 +23,7 @@
namespace OCA\Deck\Collaboration\Resources;
-
use OCA\Deck\Db\Acl;
-use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Service\PermissionService;
use OCP\AppFramework\Db\DoesNotExistException;
@@ -34,12 +32,10 @@ use OCP\AppFramework\QueryException;
use OCP\Collaboration\Resources\IManager;
use OCP\Collaboration\Resources\IProvider;
use OCP\Collaboration\Resources\IResource;
-use OCP\Collaboration\Resources\ResourceException;
use OCP\IUser;
class ResourceProvider implements IProvider {
-
- const RESOURCE_TYPE = 'deck';
+ public const RESOURCE_TYPE = 'deck';
private $boardMapper;
private $permissionService;
@@ -83,7 +79,6 @@ class ResourceProvider implements IProvider {
'link' => $link,
'iconUrl' => \OC::$server->getURLGenerator()->imagePath('deck', 'deck-dark.svg')
];
-
}
/**
diff --git a/lib/Collaboration/Resources/ResourceProviderCard.php b/lib/Collaboration/Resources/ResourceProviderCard.php
index 8dea7c66b..a3808b77d 100644
--- a/lib/Collaboration/Resources/ResourceProviderCard.php
+++ b/lib/Collaboration/Resources/ResourceProviderCard.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Collaboration\Resources;
-
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
@@ -40,8 +39,7 @@ use OCP\IURLGenerator;
use OCP\IUser;
class ResourceProviderCard implements IProvider {
-
- const RESOURCE_TYPE = 'deck-card';
+ public const RESOURCE_TYPE = 'deck-card';
/** @var CardMapper */
private $cardMapper;
@@ -101,7 +99,6 @@ class ResourceProviderCard implements IProvider {
'link' => $link,
'iconUrl' => $this->urlGenerator->imagePath('core', 'actions/toggle-pictures.svg')
];
-
}
/**
diff --git a/lib/Command/UserExport.php b/lib/Command/UserExport.php
index 771d91346..61ec06396 100644
--- a/lib/Command/UserExport.php
+++ b/lib/Command/UserExport.php
@@ -38,7 +38,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class UserExport extends Command {
-
protected $boardService;
protected $cardMapper;
private $userManager;
@@ -85,7 +84,6 @@ class UserExport extends Command {
* @throws \ReflectionException
*/
protected function execute(InputInterface $input, OutputInterface $output) {
-
$userId = $input->getArgument('user-id');
$this->boardService->setUserId($userId);
@@ -110,5 +108,3 @@ class UserExport extends Command {
$output->writeln(json_encode($data, JSON_PRETTY_PRINT));
}
}
-
-
diff --git a/lib/Controller/AttachmentApiController.php b/lib/Controller/AttachmentApiController.php
index cf027c064..821d870c0 100644
--- a/lib/Controller/AttachmentApiController.php
+++ b/lib/Controller/AttachmentApiController.php
@@ -25,82 +25,80 @@ namespace OCA\Deck\Controller;
use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
-use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\IRequest;
use OCA\Deck\Service\AttachmentService;
class AttachmentApiController extends ApiController {
+ private $attachmentService;
- private $attachmentService;
+ public function __construct($appName, IRequest $request, AttachmentService $attachmentService) {
+ parent::__construct($appName, $request);
+ $this->attachmentService = $attachmentService;
+ }
- public function __construct($appName, IRequest $request, AttachmentService $attachmentService) {
- parent::__construct($appName, $request);
- $this->attachmentService = $attachmentService;
- }
-
- /**
+ /**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
- public function getAll() {
- $attachment = $this->attachmentService->findAll($this->request->getParam('cardId'), true);
- return new DataResponse($attachment, HTTP::STATUS_OK);
- }
+ public function getAll() {
+ $attachment = $this->attachmentService->findAll($this->request->getParam('cardId'), true);
+ return new DataResponse($attachment, HTTP::STATUS_OK);
+ }
- /**
+ /**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
- public function display() {
- $attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
+ public function display() {
+ $attachment = $this->attachmentService->display($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
return $attachment;
- }
+ }
- /**
+ /**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
- public function create($type, $data) {
- $attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data);
- return new DataResponse($attachment, HTTP::STATUS_OK);
- }
+ public function create($type, $data) {
+ $attachment = $this->attachmentService->create($this->request->getParam('cardId'), $type, $data);
+ return new DataResponse($attachment, HTTP::STATUS_OK);
+ }
- /**
+ /**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
- public function update($data) {
- $attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data);
- return new DataResponse($attachment, HTTP::STATUS_OK);
- }
+ public function update($data) {
+ $attachment = $this->attachmentService->update($this->request->getParam('cardId'), $this->request->getParam('attachmentId'), $data);
+ return new DataResponse($attachment, HTTP::STATUS_OK);
+ }
- /**
+ /**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
- public function delete() {
- $attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
- return new DataResponse($attachment, HTTP::STATUS_OK);
- }
+ public function delete() {
+ $attachment = $this->attachmentService->delete($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
+ return new DataResponse($attachment, HTTP::STATUS_OK);
+ }
- /**
+ /**
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
*
*/
- public function restore() {
- $attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
- return new DataResponse($attachment, HTTP::STATUS_OK);
- }
-}
\ No newline at end of file
+ public function restore() {
+ $attachment = $this->attachmentService->restore($this->request->getParam('cardId'), $this->request->getParam('attachmentId'));
+ return new DataResponse($attachment, HTTP::STATUS_OK);
+ }
+}
diff --git a/lib/Controller/AttachmentController.php b/lib/Controller/AttachmentController.php
index d595dc2b8..daec5cf2d 100644
--- a/lib/Controller/AttachmentController.php
+++ b/lib/Controller/AttachmentController.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Controller;
-
use OCA\Deck\Service\AttachmentService;
use OCP\AppFramework\Controller;
use OCP\IRequest;
@@ -88,4 +87,4 @@ class AttachmentController extends Controller {
public function restore($cardId, $attachmentId) {
return $this->attachmentService->restore($cardId, $attachmentId);
}
-}
\ No newline at end of file
+}
diff --git a/lib/Controller/BoardApiController.php b/lib/Controller/BoardApiController.php
index 0fc00f322..647072353 100644
--- a/lib/Controller/BoardApiController.php
+++ b/lib/Controller/BoardApiController.php
@@ -39,7 +39,6 @@ use Sabre\HTTP\Util;
* @package OCA\Deck\Controller
*/
class BoardApiController extends ApiController {
-
private $boardService;
/**
@@ -74,7 +73,7 @@ class BoardApiController extends ApiController {
$boards = $this->boardService->findAll($date->getTimestamp(), $details);
}
return new DataResponse($boards, HTTP::STATUS_OK);
- }
+ }
/**
* @NoAdminRequired
@@ -175,5 +174,4 @@ class BoardApiController extends ApiController {
$acl = $this->boardService->deleteAcl($aclId);
return new DataResponse($acl, HTTP::STATUS_OK);
}
-
}
diff --git a/lib/Controller/BoardController.php b/lib/Controller/BoardController.php
index 5a02477ab..33ff48fb1 100644
--- a/lib/Controller/BoardController.php
+++ b/lib/Controller/BoardController.php
@@ -28,9 +28,6 @@ use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\PermissionService;
use OCP\AppFramework\ApiController;
use OCP\IRequest;
-use OCP\AppFramework\Controller;
-use OCP\IUserManager;
-use OCP\IGroupManager;
class BoardController extends ApiController {
private $userId;
@@ -158,5 +155,4 @@ class BoardController extends ApiController {
public function clone($boardId) {
return $this->boardService->clone($boardId);
}
-
}
diff --git a/lib/Controller/CardApiController.php b/lib/Controller/CardApiController.php
index 1a722ac10..c9f47fb93 100644
--- a/lib/Controller/CardApiController.php
+++ b/lib/Controller/CardApiController.php
@@ -33,10 +33,10 @@
use OCA\Deck\Service\CardService;
/**
- * Class BoardApiController
- *
- * @package OCA\Deck\Controller
- */
+ * Class BoardApiController
+ *
+ * @package OCA\Deck\Controller
+ */
class CardApiController extends ApiController {
private $cardService;
private $userId;
diff --git a/lib/Controller/CardController.php b/lib/Controller/CardController.php
index 89a358eec..dcb3e6046 100644
--- a/lib/Controller/CardController.php
+++ b/lib/Controller/CardController.php
@@ -29,7 +29,6 @@ use OCP\IRequest;
use OCP\AppFramework\Controller;
class CardController extends Controller {
-
private $userId;
private $cardService;
private $assignmentService;
@@ -96,7 +95,7 @@ class CardController extends Controller {
* @return \OCP\AppFramework\Db\Entity
*/
public function update($id, $title, $stackId, $type, $order, $description, $duedate, $deletedAt) {
- return $this->cardService->update($id, $title, $stackId, $type, $order, $description, $this->userId, $duedate, $deletedAt);
+ return $this->cardService->update($id, $title, $stackId, $type, $order, $description, $this->userId, $duedate, $deletedAt);
}
/**
@@ -166,7 +165,4 @@ class CardController extends Controller {
public function unassignUser($cardId, $userId, $type = 0) {
return $this->assignmentService->unassignUser($cardId, $userId, $type);
}
-
-
-
}
diff --git a/lib/Controller/CommentsApiController.php b/lib/Controller/CommentsApiController.php
index 8f38ddf53..3fc410d75 100644
--- a/lib/Controller/CommentsApiController.php
+++ b/lib/Controller/CommentsApiController.php
@@ -23,13 +23,10 @@
namespace OCA\Deck\Controller;
-use OCA\Deck\BadRequestException;
use OCA\Deck\Service\CommentService;
use OCA\Deck\StatusException;
-use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http\DataResponse;
-use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCSController;
use OCP\IRequest;
diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php
index c63991435..342ac3fea 100644
--- a/lib/Controller/ConfigController.php
+++ b/lib/Controller/ConfigController.php
@@ -23,19 +23,15 @@
namespace OCA\Deck\Controller;
-use OCA\Deck\Service\DefaultBoardService;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IRequest;
-use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Controller;
-use OCP\IL10N;
class ConfigController extends Controller {
-
private $config;
private $userId;
private $groupManager;
@@ -100,7 +96,7 @@ class ConfigController extends Controller {
private function getGroupLimit() {
$groups = $this->getGroupLimitList();
- $groups = array_map(function($groupId) {
+ $groups = array_map(function ($groupId) {
/** @var IGroup $groups */
$group = $this->groupManager->get($groupId);
if ($group === null) {
@@ -113,5 +109,4 @@ class ConfigController extends Controller {
}, $groups);
return array_filter($groups);
}
-
}
diff --git a/lib/Controller/LabelApiController.php b/lib/Controller/LabelApiController.php
index 87f729d8b..979b103a5 100644
--- a/lib/Controller/LabelApiController.php
+++ b/lib/Controller/LabelApiController.php
@@ -28,15 +28,13 @@ use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
use OCA\Deck\Service\LabelService;
-use OCA\Deck\Controller\Helper\ApiHelper;
- /**
+/**
* Class BoardApiController
*
* @package OCA\Deck\Controller
*/
class LabelApiController extends ApiController {
-
private $labelService;
private $userId;
@@ -48,8 +46,8 @@ class LabelApiController extends ApiController {
*/
public function __construct($appName, IRequest $request, LabelService $labelService, $userId) {
parent::__construct($appName, $request);
- $this->labelService = $labelService;
- $this->userId = $userId;
+ $this->labelService = $labelService;
+ $this->userId = $userId;
}
/**
@@ -60,7 +58,7 @@ class LabelApiController extends ApiController {
* Get a specific label.
*/
public function get() {
- $label = $this->labelService->find($this->request->getParam('labelId'));
+ $label = $this->labelService->find($this->request->getParam('labelId'));
return new DataResponse($label, HTTP::STATUS_OK);
}
@@ -87,7 +85,7 @@ class LabelApiController extends ApiController {
* @params $color
* Update a specific label
*/
- public function update($title, $color) {
+ public function update($title, $color) {
$label = $this->labelService->update($this->request->getParam('labelId'), $title, $color);
return new DataResponse($label, HTTP::STATUS_OK);
}
@@ -96,12 +94,11 @@ class LabelApiController extends ApiController {
* @NoAdminRequired
* @CORS
* @NoCSRFRequired
- *
+ *
* Delete a specific label
*/
public function delete() {
$label = $this->labelService->delete($this->request->getParam('labelId'));
return new DataResponse($label, HTTP::STATUS_OK);
}
-
-}
\ No newline at end of file
+}
diff --git a/lib/Controller/LabelController.php b/lib/Controller/LabelController.php
index 21c17849d..530647326 100644
--- a/lib/Controller/LabelController.php
+++ b/lib/Controller/LabelController.php
@@ -5,20 +5,20 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck\Controller;
@@ -27,9 +27,7 @@ use OCA\Deck\Service\LabelService;
use OCP\IRequest;
use OCP\AppFramework\Controller;
-
class LabelController extends Controller {
-
private $labelService;
public function __construct($appName, IRequest $request, LabelService $labelService) {
@@ -67,5 +65,4 @@ class LabelController extends Controller {
public function delete($labelId) {
return $this->labelService->delete($labelId);
}
-
}
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index 720b4aaff..b06cc1505 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -32,7 +32,6 @@ use OCP\AppFramework\Controller;
use OCP\IL10N;
class PageController extends Controller {
-
private $permissionService;
private $userId;
private $l10n;
@@ -67,5 +66,4 @@ class PageController extends Controller {
return new TemplateResponse('deck', 'main');
}
-
}
diff --git a/lib/Controller/StackApiController.php b/lib/Controller/StackApiController.php
index a9cec08cb..61d4c6afe 100644
--- a/lib/Controller/StackApiController.php
+++ b/lib/Controller/StackApiController.php
@@ -39,7 +39,6 @@ use Sabre\HTTP\Util;
* @package OCA\Deck\Controller
*/
class StackApiController extends ApiController {
-
private $boardService;
private $stackService;
diff --git a/lib/Controller/StackController.php b/lib/Controller/StackController.php
index 850ca1bcd..6452ef310 100644
--- a/lib/Controller/StackController.php
+++ b/lib/Controller/StackController.php
@@ -5,20 +5,20 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck\Controller;
@@ -29,7 +29,6 @@ use OCP\IRequest;
use OCP\AppFramework\Controller;
-
class StackController extends Controller {
private $userId;
private $stackService;
@@ -45,7 +44,7 @@ class StackController extends Controller {
* @return array
*/
public function index($boardId) {
- return $this->stackService->findAll($boardId);
+ return $this->stackService->findAll($boardId);
}
/**
@@ -54,7 +53,7 @@ class StackController extends Controller {
* @return array
*/
public function archived($boardId) {
- return $this->stackService->findAllArchived($boardId);
+ return $this->stackService->findAllArchived($boardId);
}
/**
@@ -108,5 +107,4 @@ class StackController extends Controller {
public function deleted($boardId) {
return $this->stackService->fetchDeleted($boardId);
}
-
}
diff --git a/lib/Cron/CardDescriptionActivity.php b/lib/Cron/CardDescriptionActivity.php
index bdd4226f1..755ec96da 100644
--- a/lib/Cron/CardDescriptionActivity.php
+++ b/lib/Cron/CardDescriptionActivity.php
@@ -26,14 +26,7 @@ namespace OCA\Deck\Cron;
use OC\BackgroundJob\Job;
use OCA\Deck\Activity\ActivityManager;
-use OCA\Deck\Activity\ChangeSet;
-use OCA\Deck\Db\AttachmentMapper;
-use OCA\Deck\Db\BoardMapper;
-use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper;
-use OCA\Deck\InvalidAttachmentType;
-use OCA\Deck\Service\AttachmentService;
-use OCA\Deck\Service\CardService;
class CardDescriptionActivity extends Job {
@@ -70,5 +63,4 @@ class CardDescriptionActivity extends Job {
$this->cardMapper->update($card, false);
}
}
-
}
diff --git a/lib/Cron/DeleteCron.php b/lib/Cron/DeleteCron.php
index c78d58e02..49a26d136 100644
--- a/lib/Cron/DeleteCron.php
+++ b/lib/Cron/DeleteCron.php
@@ -65,7 +65,5 @@ class DeleteCron extends Job {
}
$this->attachmentMapper->delete($attachment);
}
-
}
-
-}
\ No newline at end of file
+}
diff --git a/lib/Cron/ScheduledNotifications.php b/lib/Cron/ScheduledNotifications.php
index 997d51798..fe42168e5 100644
--- a/lib/Cron/ScheduledNotifications.php
+++ b/lib/Cron/ScheduledNotifications.php
@@ -66,5 +66,4 @@ class ScheduledNotifications extends Job {
}
}
}
-
}
diff --git a/lib/Db/Acl.php b/lib/Db/Acl.php
index 1aeea0e92..fab908f7a 100644
--- a/lib/Db/Acl.php
+++ b/lib/Db/Acl.php
@@ -24,15 +24,14 @@
namespace OCA\Deck\Db;
class Acl extends RelationalEntity {
+ public const PERMISSION_READ = 0;
+ public const PERMISSION_EDIT = 1;
+ public const PERMISSION_SHARE = 2;
+ public const PERMISSION_MANAGE = 3;
- const PERMISSION_READ = 0;
- const PERMISSION_EDIT = 1;
- const PERMISSION_SHARE = 2;
- const PERMISSION_MANAGE = 3;
-
- const PERMISSION_TYPE_USER = 0;
- const PERMISSION_TYPE_GROUP = 1;
- const PERMISSION_TYPE_CIRCLE = 7;
+ public const PERMISSION_TYPE_USER = 0;
+ public const PERMISSION_TYPE_GROUP = 1;
+ public const PERMISSION_TYPE_CIRCLE = 7;
protected $participant;
protected $type;
@@ -67,5 +66,4 @@ class Acl extends RelationalEntity {
}
return false;
}
-
-}
\ No newline at end of file
+}
diff --git a/lib/Db/AclMapper.php b/lib/Db/AclMapper.php
index 8ec8239d3..e0ed3c838 100644
--- a/lib/Db/AclMapper.php
+++ b/lib/Db/AclMapper.php
@@ -5,20 +5,20 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck\Db;
@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use OCP\IDBConnection;
class AclMapper extends DeckMapper implements IPermissionMapper {
-
public function __construct(IDBConnection $db) {
parent::__construct($db, 'deck_board_acl', Acl::class);
}
@@ -52,5 +51,4 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
$sql = 'SELECT * from *PREFIX*deck_board_acl WHERE type = ? AND participant = ?';
return $this->findEntities($sql, [$type, $participant]);
}
-
}
diff --git a/lib/Db/AssignedUsers.php b/lib/Db/AssignedUsers.php
index 9e106ec2f..319c3bd95 100644
--- a/lib/Db/AssignedUsers.php
+++ b/lib/Db/AssignedUsers.php
@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use JsonSerializable;
class AssignedUsers extends RelationalEntity implements JsonSerializable {
-
public $id;
protected $participant;
protected $cardId;
@@ -42,5 +41,4 @@ class AssignedUsers extends RelationalEntity implements JsonSerializable {
$this->addType('type', 'integer');
$this->addResolvable('participant');
}
-
}
diff --git a/lib/Db/AssignedUsersMapper.php b/lib/Db/AssignedUsersMapper.php
index ccb2d785f..bd18f46cd 100644
--- a/lib/Db/AssignedUsersMapper.php
+++ b/lib/Db/AssignedUsersMapper.php
@@ -29,9 +29,7 @@ use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IUserManager;
-
class AssignedUsersMapper extends DeckMapper implements IPermissionMapper {
-
private $cardMapper;
private $userManager;
/**
@@ -96,7 +94,7 @@ class AssignedUsersMapper extends DeckMapper implements IPermissionMapper {
public function mapParticipant(AssignedUsers &$assignment) {
$self = $this;
- $assignment->resolveRelation('participant', function() use (&$self, &$assignment) {
+ $assignment->resolveRelation('participant', function () use (&$self, &$assignment) {
return $self->getOrigin($assignment);
});
}
@@ -116,5 +114,4 @@ class AssignedUsersMapper extends DeckMapper implements IPermissionMapper {
}
return null;
}
-
}
diff --git a/lib/Db/Attachment.php b/lib/Db/Attachment.php
index 2f8f7b071..23a07fcb2 100644
--- a/lib/Db/Attachment.php
+++ b/lib/Db/Attachment.php
@@ -24,7 +24,6 @@
namespace OCA\Deck\Db;
class Attachment extends RelationalEntity {
-
protected $cardId;
protected $type;
protected $data;
@@ -43,5 +42,4 @@ class Attachment extends RelationalEntity {
$this->addResolvable('createdBy');
$this->addRelation('extendedData');
}
-
-}
\ No newline at end of file
+}
diff --git a/lib/Db/AttachmentMapper.php b/lib/Db/AttachmentMapper.php
index 00a7c61d7..69681b0c1 100644
--- a/lib/Db/AttachmentMapper.php
+++ b/lib/Db/AttachmentMapper.php
@@ -32,9 +32,7 @@ use OCP\IDBConnection;
use OCP\IUserManager;
use PDO;
-
class AttachmentMapper extends DeckMapper implements IPermissionMapper {
-
private $cardMapper;
private $userManager;
private $qb;
@@ -67,14 +65,14 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
$cursor = $qb->execute();
$row = $cursor->fetch(PDO::FETCH_ASSOC);
- if($row === false) {
+ if ($row === false) {
$cursor->closeCursor();
throw new DoesNotExistException('Did expect one result but found none when executing' . $qb);
}
$row2 = $cursor->fetch();
$cursor->closeCursor();
- if($row2 !== false ) {
+ if ($row2 !== false) {
throw new MultipleObjectsReturnedException('Did not expect more than one result when executing' . $query);
}
@@ -82,19 +80,19 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
}
public function findByData($cardId, $data) {
- $qb = $this->db->getQueryBuilder();
- $qb->select('*')
- ->from('deck_attachment')
- ->where($qb->expr()->eq('card_id', $qb->createNamedParameter($cardId, IQueryBuilder::PARAM_INT)))
- ->andWhere($qb->expr()->eq('data', $qb->createNamedParameter($data, IQueryBuilder::PARAM_STR)));
- $cursor = $qb->execute();
- $row = $cursor->fetch(PDO::FETCH_ASSOC);
- if($row === false) {
- $cursor->closeCursor();
- throw new DoesNotExistException('Did expect one result but found none when executing' . $qb);
- }
- $cursor->closeCursor();
- return $this->mapRowToEntity($row);
+ $qb = $this->db->getQueryBuilder();
+ $qb->select('*')
+ ->from('deck_attachment')
+ ->where($qb->expr()->eq('card_id', $qb->createNamedParameter($cardId, IQueryBuilder::PARAM_INT)))
+ ->andWhere($qb->expr()->eq('data', $qb->createNamedParameter($data, IQueryBuilder::PARAM_STR)));
+ $cursor = $qb->execute();
+ $row = $cursor->fetch(PDO::FETCH_ASSOC);
+ if ($row === false) {
+ $cursor->closeCursor();
+ throw new DoesNotExistException('Did expect one result but found none when executing' . $qb);
+ }
+ $cursor->closeCursor();
+ return $this->mapRowToEntity($row);
}
/**
@@ -113,7 +111,7 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
$entities = [];
$cursor = $qb->execute();
- while($row = $cursor->fetch()){
+ while ($row = $cursor->fetch()) {
$entities[] = $this->mapRowToEntity($row);
}
$cursor->closeCursor();
@@ -143,7 +141,7 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
$entities = [];
$cursor = $qb->execute();
- while($row = $cursor->fetch()){
+ while ($row = $cursor->fetch()) {
$entities[] = $this->mapRowToEntity($row);
}
$cursor->closeCursor();
@@ -182,4 +180,4 @@ class AttachmentMapper extends DeckMapper implements IPermissionMapper {
}
return $this->cardMapper->findBoardId($attachment->getCardId());
}
-}
\ No newline at end of file
+}
diff --git a/lib/Db/Board.php b/lib/Db/Board.php
index a62b6fe3c..28129b2b2 100644
--- a/lib/Db/Board.php
+++ b/lib/Db/Board.php
@@ -24,7 +24,6 @@
namespace OCA\Deck\Db;
class Board extends RelationalEntity {
-
protected $title;
protected $owner;
protected $color;
diff --git a/lib/Db/BoardMapper.php b/lib/Db/BoardMapper.php
index 378e0f01a..43e070a6b 100644
--- a/lib/Db/BoardMapper.php
+++ b/lib/Db/BoardMapper.php
@@ -24,14 +24,12 @@
namespace OCA\Deck\Db;
use OCP\AppFramework\Db\DoesNotExistException;
-use OCP\AppFramework\QueryException;
use OCP\IDBConnection;
use OCP\ILogger;
use OCP\IUserManager;
use OCP\IGroupManager;
class BoardMapper extends DeckMapper implements IPermissionMapper {
-
private $labelMapper;
private $aclMapper;
private $stackMapper;
@@ -143,7 +141,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
if (!$this->circlesEnabled) {
return [];
}
- $circles = array_map(function($circle) {
+ $circles = array_map(function ($circle) {
return $circle->getUniqueId();
}, \OCA\Circles\Api\v1\Circles::joinedCircles('', true));
if (count($circles) === 0) {
@@ -215,7 +213,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
public function mapAcl(Acl &$acl) {
$userManager = $this->userManager;
$groupManager = $this->groupManager;
- $acl->resolveRelation('participant', function($participant) use (&$acl, &$userManager, &$groupManager) {
+ $acl->resolveRelation('participant', function ($participant) use (&$acl, &$userManager, &$groupManager) {
if ($acl->getType() === Acl::PERMISSION_TYPE_USER) {
$user = $userManager->get($participant);
if ($user !== null) {
@@ -255,7 +253,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
*/
public function mapOwner(Board &$board) {
$userManager = $this->userManager;
- $board->resolveRelation('owner', function($owner) use (&$userManager) {
+ $board->resolveRelation('owner', function ($owner) use (&$userManager) {
$user = $userManager->get($owner);
if ($user !== null) {
return new User($user);
@@ -263,6 +261,4 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
return null;
});
}
-
-
}
diff --git a/lib/Db/Card.php b/lib/Db/Card.php
index 7dbf22738..36faa3dd6 100644
--- a/lib/Db/Card.php
+++ b/lib/Db/Card.php
@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use DateTime;
class Card extends RelationalEntity {
-
protected $title;
protected $description;
protected $descriptionPrev;
@@ -49,10 +48,10 @@ class Card extends RelationalEntity {
private $databaseType = 'sqlite';
- const DUEDATE_FUTURE = 0;
- const DUEDATE_NEXT = 1;
- const DUEDATE_NOW = 2;
- const DUEDATE_OVERDUE = 3;
+ public const DUEDATE_FUTURE = 0;
+ public const DUEDATE_NEXT = 1;
+ public const DUEDATE_NOW = 2;
+ public const DUEDATE_OVERDUE = 3;
public function __construct() {
$this->addType('id', 'integer');
@@ -118,5 +117,4 @@ class Card extends RelationalEntity {
unset($json['descriptionPrev']);
return $json;
}
-
}
diff --git a/lib/Db/CardMapper.php b/lib/Db/CardMapper.php
index fd0986ba0..ad2c97724 100644
--- a/lib/Db/CardMapper.php
+++ b/lib/Db/CardMapper.php
@@ -28,7 +28,6 @@ use OCP\IDBConnection;
use OCP\IUserManager;
use OCP\Notification\IManager;
-
class CardMapper extends DeckMapper implements IPermissionMapper {
/** @var LabelMapper */
@@ -164,7 +163,6 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
foreach ($cards as $card) {
$this->delete($card);
}
-
}
public function assignLabel($card, $label) {
@@ -199,7 +197,7 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
public function mapOwner(Card &$card) {
$userManager = $this->userManager;
- $card->resolveRelation('owner', function($owner) use (&$userManager) {
+ $card->resolveRelation('owner', function ($owner) use (&$userManager) {
$user = $userManager->get($owner);
if ($user !== null) {
return new User($user);
@@ -207,6 +205,4 @@ class CardMapper extends DeckMapper implements IPermissionMapper {
return null;
});
}
-
-
}
diff --git a/lib/Db/ChangeHelper.php b/lib/Db/ChangeHelper.php
index 4bcc6b4b1..598f779f9 100644
--- a/lib/Db/ChangeHelper.php
+++ b/lib/Db/ChangeHelper.php
@@ -23,18 +23,13 @@
namespace OCA\Deck\Db;
-use OCP\AppFramework\Db\DoesNotExistException;
-use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IDBConnection;
use OCP\IRequest;
-use OCP\IUserManager;
-use OCP\IGroupManager;
class ChangeHelper {
-
- const TYPE_BOARD = 'boardChanged';
- const TYPE_CARD = 'cardChanged';
+ public const TYPE_BOARD = 'boardChanged';
+ public const TYPE_CARD = 'cardChanged';
private $db;
@@ -100,5 +95,4 @@ class ChangeHelper {
}
return $entry;
}
-
}
diff --git a/lib/Db/Circle.php b/lib/Db/Circle.php
index f4a4fa568..fad2f0cb7 100644
--- a/lib/Db/Circle.php
+++ b/lib/Db/Circle.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Db;
-
use OCP\Share\IShare;
class Circle extends RelationalObject {
diff --git a/lib/Db/DeckMapper.php b/lib/Db/DeckMapper.php
index 2e6c19cc6..e3a9b4a05 100644
--- a/lib/Db/DeckMapper.php
+++ b/lib/Db/DeckMapper.php
@@ -5,20 +5,20 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck\Db;
@@ -48,5 +48,4 @@ abstract class DeckMapper extends Mapper {
protected function execute($sql, array $params = [], $limit = null, $offset = null) {
return parent::execute($sql, $params, $limit, $offset);
}
-
-}
\ No newline at end of file
+}
diff --git a/lib/Db/Group.php b/lib/Db/Group.php
index 330b592d2..451078ae4 100644
--- a/lib/Db/Group.php
+++ b/lib/Db/Group.php
@@ -27,7 +27,6 @@ use OCP\IGroup;
use OCP\Share\IShare;
class Group extends RelationalObject {
-
public function __construct(IGroup $group) {
$primaryKey = IShare::TYPE_GROUP . ':' . $group->getGID();
parent::__construct($primaryKey, $group);
diff --git a/lib/Db/IPermissionMapper.php b/lib/Db/IPermissionMapper.php
index c41509176..2b94405b8 100644
--- a/lib/Db/IPermissionMapper.php
+++ b/lib/Db/IPermissionMapper.php
@@ -24,7 +24,6 @@
namespace OCA\Deck\Db;
-
interface IPermissionMapper {
/**
@@ -43,6 +42,4 @@ interface IPermissionMapper {
* @return int|null id of Board
*/
public function findBoardId($id);
-
-
-}
\ No newline at end of file
+}
diff --git a/lib/Db/Label.php b/lib/Db/Label.php
index deeba32f9..830a66d9f 100644
--- a/lib/Db/Label.php
+++ b/lib/Db/Label.php
@@ -24,7 +24,6 @@
namespace OCA\Deck\Db;
class Label extends RelationalEntity {
-
protected $title;
protected $color;
protected $boardId;
diff --git a/lib/Db/LabelMapper.php b/lib/Db/LabelMapper.php
index f147d02e3..ec0b279a0 100644
--- a/lib/Db/LabelMapper.php
+++ b/lib/Db/LabelMapper.php
@@ -26,9 +26,7 @@ namespace OCA\Deck\Db;
use OCP\AppFramework\Db\Entity;
use OCP\IDBConnection;
-
class LabelMapper extends DeckMapper implements IPermissionMapper {
-
public function __construct(IDBConnection $db) {
parent::__construct($db, 'deck_labels', Label::class);
}
@@ -70,10 +68,10 @@ class LabelMapper extends DeckMapper implements IPermissionMapper {
public function getAssignedLabelsForBoard($boardId) {
$labels = $this->findAssignedLabelsForBoard($boardId);
- $result = array();
+ $result = [];
foreach ($labels as $label) {
if (!array_key_exists($label->getCardId(), $result)) {
- $result[$label->getCardId()] = array();
+ $result[$label->getCardId()] = [];
}
$result[$label->getCardId()][] = $label;
}
diff --git a/lib/Db/RelationalEntity.php b/lib/Db/RelationalEntity.php
index e5773f48b..5da532daa 100644
--- a/lib/Db/RelationalEntity.php
+++ b/lib/Db/RelationalEntity.php
@@ -5,20 +5,20 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck\Db;
@@ -26,8 +26,7 @@ namespace OCA\Deck\Db;
use OCP\AppFramework\Db\Entity;
class RelationalEntity extends Entity implements \JsonSerializable {
-
- private $_relations = array();
+ private $_relations = [];
private $_resolvedProperties = [];
/**
@@ -137,5 +136,4 @@ class RelationalEntity extends Entity implements \JsonSerializable {
}
return parent::__call($methodName, $args);
}
-
-}
\ No newline at end of file
+}
diff --git a/lib/Db/RelationalObject.php b/lib/Db/RelationalObject.php
index 1bc21c8bd..9ca4d596c 100644
--- a/lib/Db/RelationalObject.php
+++ b/lib/Db/RelationalObject.php
@@ -24,7 +24,6 @@
namespace OCA\Deck\Db;
class RelationalObject implements \JsonSerializable {
-
protected $primaryKey;
protected $object;
@@ -58,5 +57,4 @@ class RelationalObject implements \JsonSerializable {
throw new \Exception('jsonSerialize is not implemented on ' . get_class($this));
}
}
-
-}
\ No newline at end of file
+}
diff --git a/lib/Db/Stack.php b/lib/Db/Stack.php
index fe3fa4075..85d9c4553 100644
--- a/lib/Db/Stack.php
+++ b/lib/Db/Stack.php
@@ -24,12 +24,11 @@
namespace OCA\Deck\Db;
class Stack extends RelationalEntity {
-
protected $title;
protected $boardId;
protected $deletedAt = 0;
protected $lastModified = 0;
- protected $cards = array();
+ protected $cards = [];
protected $order;
public function __construct() {
diff --git a/lib/Db/StackMapper.php b/lib/Db/StackMapper.php
index c98d87cc0..199c3fd5b 100644
--- a/lib/Db/StackMapper.php
+++ b/lib/Db/StackMapper.php
@@ -5,20 +5,20 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck\Db;
@@ -26,9 +26,7 @@ namespace OCA\Deck\Db;
use OCP\AppFramework\Db\Entity;
use OCP\IDBConnection;
-
class StackMapper extends DeckMapper implements IPermissionMapper {
-
private $cardMapper;
public function __construct(IDBConnection $db, CardMapper $cardMapper) {
@@ -57,9 +55,9 @@ class StackMapper extends DeckMapper implements IPermissionMapper {
public function findDeleted($boardId, $limit = null, $offset = null) {
- $sql = 'SELECT * FROM `*PREFIX*deck_stacks` s
+ $sql = 'SELECT * FROM `*PREFIX*deck_stacks` s
WHERE `s`.`board_id` = ? AND NOT s.deleted_at = 0';
- return $this->findEntities($sql, [$boardId], $limit, $offset);
+ return $this->findEntities($sql, [$boardId], $limit, $offset);
}
diff --git a/lib/Db/User.php b/lib/Db/User.php
index 6f6d70ce0..83ff2fc32 100644
--- a/lib/Db/User.php
+++ b/lib/Db/User.php
@@ -27,7 +27,6 @@ use OCP\IUser;
use OCP\Share\IShare;
class User extends RelationalObject {
-
public function __construct(IUser $user) {
$primaryKey = IShare::TYPE_USER . ':' . $user->getUID();
parent::__construct($primaryKey, $user);
diff --git a/lib/Event/FTSEvent.php b/lib/Event/FTSEvent.php
index c00077d22..47955c537 100644
--- a/lib/Event/FTSEvent.php
+++ b/lib/Event/FTSEvent.php
@@ -23,9 +23,7 @@
namespace OCA\Deck\Event;
-
use OCP\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\GenericEvent;
/**
* This is a class to keep compatibility for currently used events in full text search integration
@@ -43,13 +41,11 @@ class FTSEvent extends Event {
$this->arguments = $arguments;
}
- public function getArgument($key)
- {
+ public function getArgument($key) {
if ($this->hasArgument($key)) {
return $this->arguments[$key];
}
throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key));
}
-
}
diff --git a/lib/Exceptions/ConflictException.php b/lib/Exceptions/ConflictException.php
index 53c33601c..29a5e3b55 100644
--- a/lib/Exceptions/ConflictException.php
+++ b/lib/Exceptions/ConflictException.php
@@ -26,7 +26,6 @@ namespace OCA\Deck\Exceptions;
use OCA\Deck\StatusException;
class ConflictException extends StatusException {
-
private $data;
public function __construct($message, $data = null) {
@@ -41,4 +40,4 @@ class ConflictException extends StatusException {
public function getData() {
return $this->data;
}
-}
\ No newline at end of file
+}
diff --git a/lib/InvalidAttachmentType.php b/lib/InvalidAttachmentType.php
index 1b43b680b..cf751e2ca 100644
--- a/lib/InvalidAttachmentType.php
+++ b/lib/InvalidAttachmentType.php
@@ -23,15 +23,12 @@
namespace OCA\Deck;
-
class InvalidAttachmentType extends \Exception {
/**
* InvalidAttachmentType constructor.
*/
public function __construct($type) {
-
parent::__construct('No matching IAttachmentService implementation found for type ' . $type);
-
}
-}
\ No newline at end of file
+}
diff --git a/lib/Middleware/DefaultBoardMiddleware.php b/lib/Middleware/DefaultBoardMiddleware.php
index 9d092cdf5..3b830c1b4 100644
--- a/lib/Middleware/DefaultBoardMiddleware.php
+++ b/lib/Middleware/DefaultBoardMiddleware.php
@@ -59,5 +59,4 @@ class DefaultBoardMiddleware extends Middleware {
$this->logger->logException($e);
}
}
-
}
diff --git a/lib/Middleware/ExceptionMiddleware.php b/lib/Middleware/ExceptionMiddleware.php
index 416ef105a..c02eab8c1 100644
--- a/lib/Middleware/ExceptionMiddleware.php
+++ b/lib/Middleware/ExceptionMiddleware.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Middleware;
-use OCA\Deck\Controller\PageController;
use OCA\Deck\StatusException;
use OCA\Deck\Exceptions\ConflictException;
use OCP\AppFramework\Db\DoesNotExistException;
@@ -35,7 +34,6 @@ use OCP\ILogger;
use OCP\Util;
use OCP\IConfig;
-
class ExceptionMiddleware extends Middleware {
/** @var ILogger */
@@ -116,5 +114,4 @@ class ExceptionMiddleware extends Middleware {
throw $exception;
}
-
}
diff --git a/lib/Migration/UnknownUsers.php b/lib/Migration/UnknownUsers.php
index ae3694a05..b9c5578fe 100644
--- a/lib/Migration/UnknownUsers.php
+++ b/lib/Migration/UnknownUsers.php
@@ -34,7 +34,6 @@ use OCP\Migration\IRepairStep;
use OCP\Migration\IOutput;
class UnknownUsers implements IRepairStep {
-
private $userManager;
private $groupManager;
private $aclMapper;
@@ -76,7 +75,6 @@ class UnknownUsers implements IRepairStep {
$this->aclMapper->delete($acl);
}
}
-
}
}
}
diff --git a/lib/Migration/Version1000Date20200306161713.php b/lib/Migration/Version1000Date20200306161713.php
index 9094a04cb..5ea48c20b 100644
--- a/lib/Migration/Version1000Date20200306161713.php
+++ b/lib/Migration/Version1000Date20200306161713.php
@@ -323,5 +323,4 @@ class Version1000Date20200306161713 extends SimpleMigrationStep {
}
return $schema;
}
-
}
diff --git a/lib/NoPermissionException.php b/lib/NoPermissionException.php
index 8484ad5e5..33ae6b95a 100644
--- a/lib/NoPermissionException.php
+++ b/lib/NoPermissionException.php
@@ -23,9 +23,7 @@
namespace OCA\Deck;
-
class NoPermissionException extends StatusException {
-
public function __construct($message, $controller = null, $method = null) {
parent::__construct($message);
if ($controller && $method) {
@@ -36,4 +34,4 @@ class NoPermissionException extends StatusException {
public function getStatus() {
return 403;
}
-}
\ No newline at end of file
+}
diff --git a/lib/NotFoundException.php b/lib/NotFoundException.php
index 52a2d6d91..5ea031dcd 100644
--- a/lib/NotFoundException.php
+++ b/lib/NotFoundException.php
@@ -23,9 +23,7 @@
namespace OCA\Deck;
-
class NotFoundException extends StatusException {
-
public function __construct($message = '') {
parent::__construct($message);
}
@@ -33,4 +31,4 @@ class NotFoundException extends StatusException {
public function getStatus() {
return 404;
}
-}
\ No newline at end of file
+}
diff --git a/lib/Notification/NotificationHelper.php b/lib/Notification/NotificationHelper.php
index dcc036e25..83bf67606 100644
--- a/lib/Notification/NotificationHelper.php
+++ b/lib/Notification/NotificationHelper.php
@@ -189,5 +189,4 @@ class NotificationHelper {
->setSubject('board-shared', [$board->getTitle(), $this->currentUser]);
return $notification;
}
-
}
diff --git a/lib/Provider/DeckProvider.php b/lib/Provider/DeckProvider.php
index fcec2b456..ff33cfc2f 100644
--- a/lib/Provider/DeckProvider.php
+++ b/lib/Provider/DeckProvider.php
@@ -1,4 +1,5 @@
runner->setInfo($info, $value);
}
-
}
-
diff --git a/lib/Service/AssignmentService.php b/lib/Service/AssignmentService.php
index 0ba1071a3..b3210bc44 100644
--- a/lib/Service/AssignmentService.php
+++ b/lib/Service/AssignmentService.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Service;
-
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\BadRequestException;
use OCA\Deck\Db\Acl;
@@ -40,8 +39,6 @@ use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\EventDispatcher\IEventDispatcher;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\EventDispatcher\GenericEvent;
class AssignmentService {
@@ -110,7 +107,6 @@ class AssignmentService {
* @throws DoesNotExistException
*/
public function assignUser($cardId, $userId, int $type = AssignedUsers::TYPE_USER) {
-
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
diff --git a/lib/Service/AttachmentService.php b/lib/Service/AttachmentService.php
index 1c9a2713f..945dd5bd0 100644
--- a/lib/Service/AttachmentService.php
+++ b/lib/Service/AttachmentService.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Service;
-
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\AppInfo\Application;
use OCA\Deck\BadRequestException;
@@ -42,7 +41,6 @@ use OCP\ICacheFactory;
use OCP\IL10N;
class AttachmentService {
-
private $attachmentMapper;
private $cardMapper;
private $permissionService;
@@ -116,7 +114,6 @@ class AttachmentService {
* @throws BadRequestException
*/
public function findAll($cardId, $withDeleted = false) {
-
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -144,7 +141,6 @@ class AttachmentService {
* @throws BadRequestException
*/
public function count($cardId) {
-
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -167,7 +163,6 @@ class AttachmentService {
* @throws BadRequestException
*/
public function create($cardId, $type, $data) {
-
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -228,7 +223,6 @@ class AttachmentService {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
*/
public function display($cardId, $attachmentId) {
-
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -261,7 +255,6 @@ class AttachmentService {
* @throws BadRequestException
*/
public function update($cardId, $attachmentId, $data) {
-
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -312,7 +305,6 @@ class AttachmentService {
* @throws BadRequestException
*/
public function delete($cardId, $attachmentId) {
-
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -343,7 +335,6 @@ class AttachmentService {
}
public function restore($cardId, $attachmentId) {
-
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php
index cc7062adc..58cd4022a 100644
--- a/lib/Service/BoardService.php
+++ b/lib/Service/BoardService.php
@@ -26,7 +26,6 @@ namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Activity\ChangeSet;
-use OCA\Deck\Collaboration\Resources\ResourceProvider;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\AclMapper;
use OCA\Deck\Db\AssignedUsersMapper;
@@ -48,9 +47,7 @@ use OCA\Deck\BadRequestException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
-
class BoardService {
-
private $boardMapper;
private $stackMapper;
private $labelMapper;
@@ -154,8 +151,7 @@ class BoardService {
* @throws BadRequestException
*/
public function find($boardId) {
-
- if ( is_numeric($boardId) === false ) {
+ if (is_numeric($boardId) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -202,8 +198,7 @@ class BoardService {
* @throws BadRequestException
*/
public function isArchived($mapper, $id) {
-
- if (is_numeric($id) === false) {
+ if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -232,12 +227,11 @@ class BoardService {
* @throws BadRequestException
*/
public function isDeleted($mapper, $id) {
-
if ($mapper === false || $mapper === null) {
throw new BadRequestException('mapper must be provided');
}
- if (is_numeric($id) === false) {
+ if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -265,7 +259,6 @@ class BoardService {
* @throws BadRequestException
*/
public function create($title, $userId, $color) {
-
if ($title === false || $title === null) {
throw new BadRequestException('title must be provided');
}
@@ -334,7 +327,6 @@ class BoardService {
* @throws BadRequestException
*/
public function delete($id) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -364,7 +356,6 @@ class BoardService {
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
*/
public function deleteUndo($id) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -392,7 +383,7 @@ class BoardService {
* @throws BadRequestException
*/
public function deleteForce($id) {
- if (is_numeric($id) === false) {
+ if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -419,7 +410,6 @@ class BoardService {
* @throws BadRequestException
*/
public function update($id, $title, $color, $archived) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -432,7 +422,7 @@ class BoardService {
throw new BadRequestException('color must be provided');
}
- if ( is_bool($archived) === false ) {
+ if (is_bool($archived) === false) {
throw new BadRequestException('archived must be a boolean');
}
@@ -479,7 +469,6 @@ class BoardService {
* @throws \OCA\Deck\NoPermissionException
*/
public function addAcl($boardId, $type, $participant, $edit, $share, $manage) {
-
if (is_numeric($boardId) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -529,7 +518,8 @@ class BoardService {
try {
$resourceProvider = \OC::$server->query(\OCA\Deck\Collaboration\Resources\ResourceProvider::class);
$resourceProvider->invalidateAccessCache($boardId);
- } catch (\Exception $e) {}
+ } catch (\Exception $e) {
+ }
}
$this->eventDispatcher->dispatch(
@@ -551,7 +541,6 @@ class BoardService {
* @throws BadRequestException
*/
public function updateAcl($id, $edit, $share, $manage) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -596,7 +585,6 @@ class BoardService {
* @throws BadRequestException
*/
public function deleteAcl($id) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -619,7 +607,8 @@ class BoardService {
try {
$resourceProvider = \OC::$server->query(\OCA\Deck\Collaboration\Resources\ResourceProvider::class);
$resourceProvider->invalidateAccessCache($acl->getBoardId());
- } catch (\Exception $e) {}
+ } catch (\Exception $e) {
+ }
}
$delete = $this->aclMapper->delete($acl);
@@ -639,7 +628,6 @@ class BoardService {
* @throws BadRequestException
*/
public function clone($id) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -683,7 +671,7 @@ class BoardService {
private function enrichWithStacks($board, $since = -1) {
$stacks = $this->stackMapper->findAll($board->getId(), null, null, $since);
- if(\count($stacks) === 0) {
+ if (\count($stacks) === 0) {
return;
}
@@ -693,7 +681,7 @@ class BoardService {
private function enrichWithLabels($board, $since = -1) {
$labels = $this->labelMapper->findAll($board->getId(), null, null, $since);
- if(\count($labels) === 0) {
+ if (\count($labels) === 0) {
return;
}
@@ -702,10 +690,9 @@ class BoardService {
private function enrichWithUsers($board, $since = -1) {
$boardUsers = $this->permissionService->findUsers($board->getId());
- if(\count($boardUsers) === 0) {
+ if (\count($boardUsers) === 0) {
return;
}
$board->setUsers(array_values($boardUsers));
}
-
}
diff --git a/lib/Service/CardService.php b/lib/Service/CardService.php
index afc8ab3da..ad6afcadf 100644
--- a/lib/Service/CardService.php
+++ b/lib/Service/CardService.php
@@ -28,7 +28,6 @@ namespace OCA\Deck\Service;
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Activity\ChangeSet;
-use OCA\Deck\Db\AssignedUsers;
use OCA\Deck\Db\AssignedUsersMapper;
use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper;
@@ -39,19 +38,13 @@ use OCA\Deck\Event\FTSEvent;
use OCA\Deck\Notification\NotificationHelper;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\LabelMapper;
-use OCA\Deck\NotFoundException;
use OCA\Deck\StatusException;
use OCA\Deck\BadRequestException;
-use OCP\Activity\IEvent;
use OCP\Comments\ICommentsManager;
-use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUserManager;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\EventDispatcher\GenericEvent;
class CardService {
-
private $cardMapper;
private $stackMapper;
private $boardMapper;
@@ -132,7 +125,6 @@ class CardService {
* @throws BadRequestException
*/
public function find($cardId) {
-
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -218,7 +210,6 @@ class CardService {
* @throws BadRequestException
*/
public function delete($id) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -257,7 +248,6 @@ class CardService {
* @throws BadRequestException
*/
public function update($id, $title, $stackId, $type, $order = 0, $description = '', $owner, $duedate = null, $deletedAt = null, $archived = null) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -347,7 +337,6 @@ class CardService {
* @throws BadRequestException
*/
public function rename($id, $title) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -387,7 +376,6 @@ class CardService {
* @throws BadRequestException
*/
public function reorder($id, $stackId, $order) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -448,7 +436,6 @@ class CardService {
* @throws BadRequestException
*/
public function archive($id) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -481,7 +468,6 @@ class CardService {
* @throws BadRequestException
*/
public function unarchive($id) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('id must be a number');
}
@@ -513,7 +499,6 @@ class CardService {
* @throws BadRequestException
*/
public function assignLabel($cardId, $labelId) {
-
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -550,7 +535,6 @@ class CardService {
* @throws BadRequestException
*/
public function removeLabel($cardId, $labelId) {
-
if (is_numeric($cardId) === false) {
throw new BadRequestException('card id must be a number');
}
@@ -576,5 +560,4 @@ class CardService {
'\OCA\Deck\Card::onUpdate', new FTSEvent(null, ['id' => $cardId, 'card' => $card])
);
}
-
}
diff --git a/lib/Service/CommentService.php b/lib/Service/CommentService.php
index 554108f67..d805dfc62 100644
--- a/lib/Service/CommentService.php
+++ b/lib/Service/CommentService.php
@@ -23,14 +23,12 @@
namespace OCA\Deck\Service;
-
use OCA\Deck\AppInfo\Application;
use OCA\Deck\BadRequestException;
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\CardMapper;
use OCA\Deck\NoPermissionException;
use OCA\Deck\NotFoundException;
-use OCA\Deck\StatusException;
use OCP\AppFramework\Http\DataResponse;
use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
@@ -39,7 +37,6 @@ use OCP\Comments\NotFoundException as CommentNotFoundException;
use OCP\ILogger;
use OCP\IUserManager;
use OutOfBoundsException;
-use Sabre\DAV\Exception\Forbidden;
use function is_numeric;
class CommentService {
@@ -125,7 +122,6 @@ class CommentService {
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
try {
$comment = $this->commentsManager->get($commentId);
-
} catch (CommentNotFoundException $e) {
throw new NotFoundException('No comment found.');
}
@@ -147,7 +143,6 @@ class CommentService {
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
try {
$comment = $this->commentsManager->get($commentId);
-
} catch (CommentNotFoundException $e) {
throw new NotFoundException('No comment found.');
}
@@ -170,7 +165,7 @@ class CommentService {
'actorType' => $comment->getActorType(),
'actorDisplayName' => $actorDisplayName,
'creationDateTime' => $comment->getCreationDateTime()->format(\DateTime::ATOM),
- 'mentions' => array_map(function($mention) {
+ 'mentions' => array_map(function ($mention) {
try {
$displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']);
} catch (OutOfBoundsException $e) {
@@ -187,5 +182,4 @@ class CommentService {
}, $comment->getMentions()),
];
}
-
}
diff --git a/lib/Service/DefaultBoardService.php b/lib/Service/DefaultBoardService.php
index 303e6c2b2..12df32513 100644
--- a/lib/Service/DefaultBoardService.php
+++ b/lib/Service/DefaultBoardService.php
@@ -31,7 +31,6 @@ use OCA\Deck\BadRequestException;
use OCP\PreConditionNotMetException;
class DefaultBoardService {
-
private $boardMapper;
private $boardService;
private $stackService;
@@ -39,7 +38,7 @@ class DefaultBoardService {
private $config;
private $l10n;
- public function __construct(
+ public function __construct(
IL10N $l10n,
BoardMapper $boardMapper,
BoardService $boardService,
@@ -47,14 +46,13 @@ class DefaultBoardService {
CardService $cardService,
IConfig $config
) {
-
$this->boardService = $boardService;
$this->stackService = $stackService;
$this->cardService = $cardService;
$this->config = $config;
$this->boardMapper = $boardMapper;
$this->l10n = $l10n;
- }
+ }
/**
* Return true if this is the first time a user is acessing their instance with deck enabled
@@ -76,7 +74,7 @@ class DefaultBoardService {
}
return false;
- }
+ }
/**
* @param $title
@@ -90,7 +88,6 @@ class DefaultBoardService {
* @throws BadRequestException
*/
public function createDefaultBoard(string $title, string $userId, string $color) {
-
if ($title === false || $title === null) {
throw new BadRequestException('title must be provided');
}
@@ -103,9 +100,9 @@ class DefaultBoardService {
throw new BadRequestException('color must be provided');
}
- $defaultBoard = $this->boardService->create($title, $userId, $color);
- $defaultStacks = [];
- $defaultCards = [];
+ $defaultBoard = $this->boardService->create($title, $userId, $color);
+ $defaultStacks = [];
+ $defaultCards = [];
$boardId = $defaultBoard->getId();
@@ -118,5 +115,5 @@ class DefaultBoardService {
$defaultCards[] = $this->cardService->create($this->l10n->t('Example Task 1'), $defaultStacks[2]->getId(), 'text', 0, $userId);
return $defaultBoard;
- }
+ }
}
diff --git a/lib/Service/FileService.php b/lib/Service/FileService.php
index 1e4216591..a669c609a 100644
--- a/lib/Service/FileService.php
+++ b/lib/Service/FileService.php
@@ -23,17 +23,13 @@
namespace OCA\Deck\Service;
-use OC\Security\CSP\ContentSecurityPolicyManager;
use OCA\Deck\Db\Attachment;
use OCA\Deck\Db\AttachmentMapper;
use OCA\Deck\StatusException;
use OCA\Deck\Exceptions\ConflictException;
use OCP\AppFramework\Http\ContentSecurityPolicy;
-use OCP\AppFramework\Http\EmptyContentSecurityPolicy;
use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\AppFramework\Http\StreamResponse;
-use OCP\Files\Cache\IScanner;
-use OCP\Files\Folder;
use OCP\Files\IAppData;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
@@ -45,9 +41,7 @@ use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
-
class FileService implements IAttachmentService {
-
private $l10n;
private $appData;
private $request;
@@ -122,18 +116,18 @@ class FileService implements IAttachmentService {
* @return array
* @throws StatusException
*/
- private function getUploadedFile () {
+ private function getUploadedFile() {
$file = $this->request->getUploadedFile('file');
$error = null;
$phpFileUploadErrors = [
- UPLOAD_ERR_OK => $this->l10n->t('The file was uploaded'),
- UPLOAD_ERR_INI_SIZE => $this->l10n->t('The uploaded file exceeds the upload_max_filesize directive in php.ini'),
- UPLOAD_ERR_FORM_SIZE => $this->l10n->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'),
- UPLOAD_ERR_PARTIAL => $this->l10n->t('The file was only partially uploaded'),
- UPLOAD_ERR_NO_FILE => $this->l10n->t('No file was uploaded'),
- UPLOAD_ERR_NO_TMP_DIR => $this->l10n->t('Missing a temporary folder'),
- UPLOAD_ERR_CANT_WRITE => $this->l10n->t('Could not write file to disk'),
- UPLOAD_ERR_EXTENSION => $this->l10n->t('A PHP extension stopped the file upload'),
+ UPLOAD_ERR_OK => $this->l10n->t('The file was uploaded'),
+ UPLOAD_ERR_INI_SIZE => $this->l10n->t('The uploaded file exceeds the upload_max_filesize directive in php.ini'),
+ UPLOAD_ERR_FORM_SIZE => $this->l10n->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'),
+ UPLOAD_ERR_PARTIAL => $this->l10n->t('The file was only partially uploaded'),
+ UPLOAD_ERR_NO_FILE => $this->l10n->t('No file was uploaded'),
+ UPLOAD_ERR_NO_TMP_DIR => $this->l10n->t('Missing a temporary folder'),
+ UPLOAD_ERR_CANT_WRITE => $this->l10n->t('Could not write file to disk'),
+ UPLOAD_ERR_EXTENSION => $this->l10n->t('A PHP extension stopped the file upload'),
];
if (empty($file)) {
@@ -271,4 +265,4 @@ class FileService implements IAttachmentService {
public function markAsDeleted(Attachment $attachment) {
$attachment->setDeletedAt(time());
}
-}
\ No newline at end of file
+}
diff --git a/lib/Service/FullTextSearchService.php b/lib/Service/FullTextSearchService.php
index 583b7bc20..3362ea162 100644
--- a/lib/Service/FullTextSearchService.php
+++ b/lib/Service/FullTextSearchService.php
@@ -1,4 +1,5 @@
getArgument('boardId');
$cards = array_map(
- function(Card $item) {
+ function (Card $item) {
return $item->getId();
},
$this->getCardsFromBoard($boardId)
@@ -266,7 +265,6 @@ class FullTextSearchService {
*/
private function getStacksFromBoard(int $boardId): array {
return $this->stackMapper->findAll($boardId, null, null);
-
}
@@ -278,7 +276,4 @@ class FullTextSearchService {
private function getBoardsFromUser(string $userId): array {
return $this->boardMapper->findAllByUser($userId, null, null, -1);
}
-
-
}
-
diff --git a/lib/Service/IAttachmentService.php b/lib/Service/IAttachmentService.php
index ae796b5f3..6ec1ed376 100644
--- a/lib/Service/IAttachmentService.php
+++ b/lib/Service/IAttachmentService.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Service;
-
use OCA\Deck\Db\Attachment;
use OCP\AppFramework\Http\Response;
@@ -95,5 +94,4 @@ interface IAttachmentService {
* @param Attachment $attachment
*/
public function markAsDeleted(Attachment $attachment);
-
-}
\ No newline at end of file
+}
diff --git a/lib/Service/LabelService.php b/lib/Service/LabelService.php
index f596b19a2..b27384760 100644
--- a/lib/Service/LabelService.php
+++ b/lib/Service/LabelService.php
@@ -30,7 +30,6 @@ use OCA\Deck\Db\LabelMapper;
use OCA\Deck\StatusException;
use OCA\Deck\BadRequestException;
-
class LabelService {
/** @var LabelMapper */
@@ -77,7 +76,6 @@ class LabelService {
* @throws BadRequestException
*/
public function create($title, $color, $boardId) {
-
if ($title === false || $title === null) {
throw new BadRequestException('title must be provided');
}
@@ -94,7 +92,7 @@ class LabelService {
$boardLabels = $this->labelMapper->findAll($boardId);
if (\is_array($boardLabels)) {
- foreach($boardLabels as $boardLabel) {
+ foreach ($boardLabels as $boardLabel) {
if ($boardLabel->getTitle() === $title) {
throw new BadRequestException('title must be unique');
break;
@@ -123,7 +121,6 @@ class LabelService {
* @throws BadRequestException
*/
public function delete($id) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('label id must be a number');
}
@@ -149,7 +146,6 @@ class LabelService {
* @throws BadRequestException
*/
public function update($id, $title, $color) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('label id must be a number');
}
@@ -168,7 +164,7 @@ class LabelService {
$boardLabels = $this->labelMapper->findAll($label->getBoardId());
if (\is_array($boardLabels)) {
- foreach($boardLabels as $boardLabel) {
+ foreach ($boardLabels as $boardLabel) {
if ($boardLabel->getId() === $label->getId()) {
continue;
}
@@ -188,5 +184,4 @@ class LabelService {
$this->changeHelper->boardChanged($label->getBoardId());
return $this->labelMapper->update($label);
}
-
}
diff --git a/lib/Service/PermissionService.php b/lib/Service/PermissionService.php
index d5aa4b761..8d528f2e4 100644
--- a/lib/Service/PermissionService.php
+++ b/lib/Service/PermissionService.php
@@ -33,14 +33,12 @@ use OCA\Deck\NoPermissionException;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
-use OCP\AppFramework\QueryException;
use OCP\IConfig;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IUserManager;
use OCP\Share\IManager;
-
class PermissionService {
/** @var BoardMapper */
diff --git a/lib/Service/StackService.php b/lib/Service/StackService.php
index 29763bb9e..6e01ee9e7 100644
--- a/lib/Service/StackService.php
+++ b/lib/Service/StackService.php
@@ -39,9 +39,7 @@ use OCA\Deck\StatusException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
-
class StackService {
-
private $stackMapper;
private $cardMapper;
private $boardMapper;
@@ -166,7 +164,6 @@ class StackService {
* @throws BadRequestException
*/
public function findAllArchived($boardId) {
-
if (is_numeric($boardId) === false) {
throw new BadRequestException('board id must be a number');
}
@@ -200,7 +197,6 @@ class StackService {
* @throws BadRequestException
*/
public function create($title, $boardId, $order) {
-
if ($title === false || $title === null) {
throw new BadRequestException('title must be provided');
}
@@ -245,7 +241,6 @@ class StackService {
* @throws BadRequestException
*/
public function delete($id) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('stack id must be a number');
}
@@ -284,7 +279,6 @@ class StackService {
* @throws BadRequestException
*/
public function update($id, $title, $boardId, $order, $deletedAt) {
-
if (is_numeric($id) === false) {
throw new BadRequestException('stack id must be a number');
}
@@ -336,7 +330,6 @@ class StackService {
* @throws BadRequestException
*/
public function reorder($id, $order) {
-
if (is_numeric($id) === false) {
throw new BadRquestException('id must be a number');
}
diff --git a/lib/StatusException.php b/lib/StatusException.php
index 8527916a5..6e88cf009 100644
--- a/lib/StatusException.php
+++ b/lib/StatusException.php
@@ -23,9 +23,7 @@
namespace OCA\Deck;
-
class StatusException extends \Exception {
-
public function __construct($message) {
parent::__construct($message);
}
@@ -33,4 +31,4 @@ class StatusException extends \Exception {
public function getStatus() {
return 500;
}
-}
\ No newline at end of file
+}
diff --git a/templates/main.php b/templates/main.php
index d359d97e7..83461e153 100644
--- a/templates/main.php
+++ b/templates/main.php
@@ -21,7 +21,6 @@
*
*/
-use OCP\Util;
style('deck', 'globalstyles');
script('deck', 'deck');
diff --git a/tests/.phpunit.result.cache b/tests/.phpunit.result.cache
new file mode 100644
index 000000000..1eb33b5b7
--- /dev/null
+++ b/tests/.phpunit.result.cache
@@ -0,0 +1 @@
+C:37:"PHPUnit\Runner\DefaultTestResultCache":3426:{a:2:{s:7:"defects";a:5:{s:89:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRememberedLogin";i:4;s:71:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcess";i:3;s:102:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRemeberedLoginWithAutologout";i:4;s:52:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLink";i:4;s:64:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLinkPublicUpload";i:3;}s:5:"times";a:38:{s:89:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRememberedLogin";d:0.008;s:71:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcess";d:0.001;s:102:"Test\Authentication\Login\FinishRememberedLoginCommandTest::testProcessNotRemeberedLoginWithAutologout";d:0.001;s:52:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLink";d:0.19;s:56:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareUserFile";d:0.485;s:58:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareUserFolder";d:0.226;s:57:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareGroupFile";d:0.244;s:59:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareGroupFolder";d:0.222;s:64:"OCA\Files_Sharing\Tests\ApiTest::testCreateShareLinkPublicUpload";d:0.121;s:56:"OCA\Files_Sharing\Tests\ApiTest::testEnforceLinkPassword";d:0.576;s:53:"OCA\Files_Sharing\Tests\ApiTest::testSharePermissions";d:0.167;s:49:"OCA\Files_Sharing\Tests\ApiTest::testGetAllShares";d:0.129;s:55:"OCA\Files_Sharing\Tests\ApiTest::testGetAllSharesWithMe";d:0.182;s:50:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkUrl";d:0.133;s:55:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromSource";d:0.135;s:67:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromSourceWithReshares";d:0.162;s:51:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromId";d:0.13;s:55:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFolder";d:0.165;s:63:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFolderWithFile";d:0.125;s:63:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFolderReshares";d:0.185;s:66:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromSubFolderReShares";d:0.183;s:65:"OCA\Files_Sharing\Tests\ApiTest::testGetShareMultipleSharedFolder";d:0.263;s:63:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromFileReReShares";d:0.203;s:58:"OCA\Files_Sharing\Tests\ApiTest::testGetShareFromUnknownId";d:0.11;s:48:"OCA\Files_Sharing\Tests\ApiTest::testUpdateShare";d:0.391;s:54:"OCA\Files_Sharing\Tests\ApiTest::testUpdateShareUpload";d:0.142;s:58:"OCA\Files_Sharing\Tests\ApiTest::testUpdateShareExpireDate";d:0.146;s:48:"OCA\Files_Sharing\Tests\ApiTest::testDeleteShare";d:0.159;s:50:"OCA\Files_Sharing\Tests\ApiTest::testDeleteReshare";d:0.177;s:63:"OCA\Files_Sharing\Tests\ApiTest::testShareFolderWithAMountPoint";d:0.236;s:59:"OCA\Files_Sharing\Tests\ApiTest::testShareStorageMountPoint";d:0.165;s:74:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate with data set #0";d:0.088;s:74:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate with data set #1";d:0.111;s:74:"OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate with data set #2";d:0.119;s:68:"OCA\Files_Sharing\Tests\ApiTest::testCreatePublicLinkExpireDateValid";d:0.135;s:76:"OCA\Files_Sharing\Tests\ApiTest::testCreatePublicLinkExpireDateInvalidFuture";d:0.119;s:56:"OCA\Files_Sharing\Tests\ApiTest::testInvisibleSharesUser";d:0.154;s:57:"OCA\Files_Sharing\Tests\ApiTest::testInvisibleSharesGroup";d:0.165;}}}
\ No newline at end of file
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 5501154e3..1eb90a71b 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -5,21 +5,21 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
require_once __DIR__ . '/../../../tests/bootstrap.php';
-require_once __DIR__ . '/../appinfo/autoload.php';
\ No newline at end of file
+require_once __DIR__ . '/../appinfo/autoload.php';
diff --git a/tests/integration/app/AppTest.php b/tests/integration/app/AppTest.php
index bfe805429..3c7401d79 100644
--- a/tests/integration/app/AppTest.php
+++ b/tests/integration/app/AppTest.php
@@ -21,34 +21,30 @@
*
*/
-use OCP\AppFramework\App;
use Test\TestCase;
-
/**
* This test shows how to make a small Integration Test. Query your class
* directly from the container, only pass in mocks if needed and run your tests
* against the database
*/
class AppTest extends TestCase {
-
- private $container;
+ private $container;
private $app;
- public function setUp(): void {
- parent::setUp();
- $this->app = new \OCA\Deck\AppInfo\Application();
- $this->container = $this->app->getContainer();
- }
+ public function setUp(): void {
+ parent::setUp();
+ $this->app = new \OCA\Deck\AppInfo\Application();
+ $this->container = $this->app->getContainer();
+ }
- public function testAppInstalled() {
- $appManager = $this->container->query('OCP\App\IAppManager');
- $this->assertTrue($appManager->isInstalled('deck'));
- }
+ public function testAppInstalled() {
+ $appManager = $this->container->query('OCP\App\IAppManager');
+ $this->assertTrue($appManager->isInstalled('deck'));
+ }
- public function testNavigationEntry() {
+ public function testNavigationEntry() {
$this->app->registerNavigationEntry();
$this->assertTrue(true);
}
-
}
diff --git a/tests/integration/database/AssignedUsersMapperTest.php b/tests/integration/database/AssignedUsersMapperTest.php
index 58ff07e6b..37a709c65 100644
--- a/tests/integration/database/AssignedUsersMapperTest.php
+++ b/tests/integration/database/AssignedUsersMapperTest.php
@@ -33,7 +33,6 @@ use OCA\Deck\Service\CardService;
* @coversDefaultClass OCA\Deck\Db\AssignedUsersMapper
*/
class AssignedUsersMapperTest extends \Test\TestCase {
-
private const TEST_USER1 = 'test-share-user1';
private const TEST_USER3 = 'test-share-user3';
private const TEST_USER2 = 'test-share-user2';
diff --git a/tests/integration/database/BoardDatabaseTest.php b/tests/integration/database/BoardDatabaseTest.php
index fd52b510d..d86b558df 100644
--- a/tests/integration/database/BoardDatabaseTest.php
+++ b/tests/integration/database/BoardDatabaseTest.php
@@ -24,63 +24,62 @@
/**
* @group DB
*/
-class BoardDatabaseTest extends \Test\TestCase
-{
- const TEST_USER1 = "test-share-user1";
- const TEST_USER2 = "test-share-user2";
- const TEST_USER3 = "test-share-user3";
- const TEST_USER4 = "test-share-user4";
- const TEST_GROUP1 = "test-share-group1";
+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";
- /** @var \OCA\Deck\Service\BoardService */
- private $boardService;
+ /** @var \OCA\Deck\Service\BoardService */
+ private $boardService;
- public static function setUpBeforeClass(): void {
- parent::setUpBeforeClass();
+ public static function setUpBeforeClass(): void {
+ parent::setUpBeforeClass();
- $backend = new \Test\Util\User\Dummy();
- \OC_User::useBackend($backend);
- $backend->createUser(self::TEST_USER1, self::TEST_USER1);
- $backend->createUser(self::TEST_USER2, self::TEST_USER2);
- $backend->createUser(self::TEST_USER3, self::TEST_USER3);
- $backend->createUser(self::TEST_USER4, self::TEST_USER4);
- // create group
- $groupBackend = new \Test\Util\Group\Dummy();
- $groupBackend->createGroup(self::TEST_GROUP1);
- $groupBackend->createGroup('group');
- $groupBackend->createGroup('group1');
- $groupBackend->createGroup('group2');
- $groupBackend->createGroup('group3');
- $groupBackend->addToGroup(self::TEST_USER1, 'group');
- $groupBackend->addToGroup(self::TEST_USER2, 'group');
- $groupBackend->addToGroup(self::TEST_USER3, 'group');
- $groupBackend->addToGroup(self::TEST_USER2, 'group1');
- $groupBackend->addToGroup(self::TEST_USER3, 'group2');
- $groupBackend->addToGroup(self::TEST_USER4, 'group3');
- $groupBackend->addToGroup(self::TEST_USER2, self::TEST_GROUP1);
- \OC::$server->getGroupManager()->addBackend($groupBackend);
- }
- public function setUp(): void {
- parent::setUp();
- \OC::$server->getUserSession()->login(self::TEST_USER1, self::TEST_USER1);
- $this->boardService = \OC::$server->query("\OCA\Deck\Service\BoardService");
- }
- public function testCreate() {
- $board = new \OCA\Deck\Db\Board();
- $board->setTitle('Test');
- $board->setOwner(self::TEST_USER1);
- $board->setColor('000000');
- $board->setLabels([]);
- $created = $this->boardService->create('Test', self::TEST_USER1, '000000');
- $id = $created->getId();
- $actual = $this->boardService->find($id);
- $this->assertEquals($actual->getTitle(), $board->getTitle());
- $this->assertEquals($actual->getColor(), $board->getColor());
- $this->assertEquals($actual->getOwner(), $board->getOwner());
- $this->boardService->deleteForce($id);
- }
+ $backend = new \Test\Util\User\Dummy();
+ \OC_User::useBackend($backend);
+ $backend->createUser(self::TEST_USER1, self::TEST_USER1);
+ $backend->createUser(self::TEST_USER2, self::TEST_USER2);
+ $backend->createUser(self::TEST_USER3, self::TEST_USER3);
+ $backend->createUser(self::TEST_USER4, self::TEST_USER4);
+ // create group
+ $groupBackend = new \Test\Util\Group\Dummy();
+ $groupBackend->createGroup(self::TEST_GROUP1);
+ $groupBackend->createGroup('group');
+ $groupBackend->createGroup('group1');
+ $groupBackend->createGroup('group2');
+ $groupBackend->createGroup('group3');
+ $groupBackend->addToGroup(self::TEST_USER1, 'group');
+ $groupBackend->addToGroup(self::TEST_USER2, 'group');
+ $groupBackend->addToGroup(self::TEST_USER3, 'group');
+ $groupBackend->addToGroup(self::TEST_USER2, 'group1');
+ $groupBackend->addToGroup(self::TEST_USER3, 'group2');
+ $groupBackend->addToGroup(self::TEST_USER4, 'group3');
+ $groupBackend->addToGroup(self::TEST_USER2, self::TEST_GROUP1);
+ \OC::$server->getGroupManager()->addBackend($groupBackend);
+ }
+ public function setUp(): void {
+ parent::setUp();
+ \OC::$server->getUserSession()->login(self::TEST_USER1, self::TEST_USER1);
+ $this->boardService = \OC::$server->query("\OCA\Deck\Service\BoardService");
+ }
+ public function testCreate() {
+ $board = new \OCA\Deck\Db\Board();
+ $board->setTitle('Test');
+ $board->setOwner(self::TEST_USER1);
+ $board->setColor('000000');
+ $board->setLabels([]);
+ $created = $this->boardService->create('Test', self::TEST_USER1, '000000');
+ $id = $created->getId();
+ $actual = $this->boardService->find($id);
+ $this->assertEquals($actual->getTitle(), $board->getTitle());
+ $this->assertEquals($actual->getColor(), $board->getColor());
+ $this->assertEquals($actual->getOwner(), $board->getOwner());
+ $this->boardService->deleteForce($id);
+ }
- public function tearDown(): void {
- parent::tearDown();
- }
+ public function tearDown(): void {
+ parent::tearDown();
+ }
}
diff --git a/tests/integration/features/bootstrap/BasicStructure.php b/tests/integration/features/bootstrap/BasicStructure.php
index cf4176da3..2e59cc6f3 100644
--- a/tests/integration/features/bootstrap/BasicStructure.php
+++ b/tests/integration/features/bootstrap/BasicStructure.php
@@ -32,7 +32,6 @@ use GuzzleHttp\Message\ResponseInterface;
require __DIR__ . '/../../vendor/autoload.php';
trait BasicStructure {
-
use Auth;
/** @var string */
@@ -104,7 +103,7 @@ trait BasicStructure {
*/
public function usingServer($server) {
$previousServer = $this->currentServer;
- if ($server === 'LOCAL'){
+ if ($server === 'LOCAL') {
$this->baseUrl = $this->localBaseUrl;
$this->currentServer = 'LOCAL';
return $previousServer;
@@ -139,8 +138,10 @@ trait BasicStructure {
* @param array $arrayOfArrays
* @return array
*/
- public function simplifyArray($arrayOfArrays){
- $a = array_map(function($subArray) { return $subArray[0]; }, $arrayOfArrays);
+ public function simplifyArray($arrayOfArrays) {
+ $a = array_map(function ($subArray) {
+ return $subArray[0];
+ }, $arrayOfArrays);
return $a;
}
@@ -211,7 +212,7 @@ trait BasicStructure {
}
}
- public function isExpectedUrl($possibleUrl, $finalPart){
+ public function isExpectedUrl($possibleUrl, $finalPart) {
$baseUrlChopped = substr($this->baseUrl, 0, -4);
$endCharacter = strlen($baseUrlChopped) + strlen($finalPart);
return (substr($possibleUrl,0,$endCharacter) == "$baseUrlChopped" . "$finalPart");
@@ -328,7 +329,7 @@ trait BasicStructure {
}
}
- public static function removeFile($path, $filename){
+ public static function removeFile($path, $filename) {
if (file_exists("$path" . "$filename")) {
unlink("$path" . "$filename");
}
@@ -352,7 +353,7 @@ trait BasicStructure {
fclose($file);
}
- public function createFileWithText($name, $text){
+ public function createFileWithText($name, $text) {
$file = fopen("work/" . "$name", 'w');
fwrite($file, $text);
fclose($file);
@@ -387,8 +388,8 @@ trait BasicStructure {
/**
* @BeforeSuite
*/
- public static function addFilesToSkeleton(){
- for ($i=0; $i<5; $i++){
+ public static function addFilesToSkeleton() {
+ for ($i=0; $i<5; $i++) {
file_put_contents("../../core/skeleton/" . "textfile" . "$i" . ".txt", "Nextcloud test text file\n");
}
if (!file_exists("../../core/skeleton/FOLDER")) {
@@ -407,8 +408,8 @@ trait BasicStructure {
/**
* @AfterSuite
*/
- public static function removeFilesFromSkeleton(){
- for ($i=0; $i<5; $i++){
+ public static function removeFilesFromSkeleton() {
+ for ($i=0; $i<5; $i++) {
self::removeFile("../../core/skeleton/", "textfile" . "$i" . ".txt");
}
if (is_dir("../../core/skeleton/FOLDER")) {
@@ -427,11 +428,11 @@ trait BasicStructure {
/**
* @BeforeScenario @local_storage
*/
- public static function removeFilesFromLocalStorageBefore(){
+ public static function removeFilesFromLocalStorageBefore() {
$dir = "./work/local_storage/";
$di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
- foreach ( $ri as $file ) {
+ foreach ($ri as $file) {
$file->isDir() ? rmdir($file) : unlink($file);
}
}
@@ -439,11 +440,11 @@ trait BasicStructure {
/**
* @AfterScenario @local_storage
*/
- public static function removeFilesFromLocalStorageAfter(){
+ public static function removeFilesFromLocalStorageAfter() {
$dir = "./work/local_storage/";
$di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
- foreach ( $ri as $file ) {
+ foreach ($ri as $file) {
$file->isDir() ? rmdir($file) : unlink($file);
}
}
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 67e79df7c..3f42c2d0a 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -3,20 +3,18 @@
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\TableNode;
use GuzzleHttp\Client;
-use Behat\Behat\Tester\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode;
use GuzzleHttp\Exception\ClientException;
require_once __DIR__ . '/../../vendor/autoload.php';
class FeatureContext implements Context {
-
use WebDav;
/** @var string */
private $mappedUserId;
- private $lastInsertIds = array();
+ private $lastInsertIds = [];
/**
* @BeforeSuite
@@ -117,8 +115,8 @@ class FeatureContext implements Context {
*/
public function theResponseShouldBeAJsonArrayWithALengthOf($length) {
$realResponseArray = json_decode($this->response->getBody()->getContents(), true);
- PHPUnit_Framework_Assert::assertEquals($realResponseArray, "foo");
- if((int)count($realResponseArray) !== (int)$length) {
+ PHPUnit_Framework_Assert::assertEquals($realResponseArray, "foo");
+ if ((int)count($realResponseArray) !== (int)$length) {
throw new InvalidArgumentException(
sprintf(
'Expected %d as length got %d',
@@ -129,26 +127,25 @@ class FeatureContext implements Context {
}
}
- /**
- * @Then /^I should get:$/
- *
- * @param PyStringNode $string
- * @throws \Exception
- */
- public function iShouldGet(PyStringNode $string)
- {
- if ((string) $string !== trim($this->cliOutput)) {
- throw new Exception(sprintf(
- 'Expected "%s" but received "%s".',
- $string,
- $this->cliOutput
- ));
- }
+ /**
+ * @Then /^I should get:$/
+ *
+ * @param PyStringNode $string
+ * @throws \Exception
+ */
+ public function iShouldGet(PyStringNode $string) {
+ if ((string) $string !== trim($this->cliOutput)) {
+ throw new Exception(sprintf(
+ 'Expected "%s" but received "%s".',
+ $string,
+ $this->cliOutput
+ ));
+ }
- return;
- }
+ return;
+ }
- private function sendJSONrequest($method, $url, $data) {
+ private function sendJSONrequest($method, $url, $data) {
$baseUrl = substr($this->baseUrl, 0, -5);
$client = new Client;
@@ -172,11 +169,10 @@ class FeatureContext implements Context {
* @Given /^creates a board named "([^"]*)" with color "([^"]*)"$/
*/
public function createsABoardNamedWithColor($title, $color) {
-
$this->sendJSONrequest('POST', '/index.php/apps/deck/boards', [
- 'title' => $title,
- 'color' => $color
- ]
+ 'title' => $title,
+ 'color' => $color
+ ]
);
$response = json_decode($this->response->getBody()->getContents(), true);
$this->lastInsertIds[$title] = $response['id'];
@@ -190,5 +186,4 @@ class FeatureContext implements Context {
$id = $this->lastInsertIds[$boardName];
$this->sendJSONrequest('GET', '/index.php/apps/deck/boards/'.$id, []);
}
-
}
diff --git a/tests/unit/Activity/ActivityManagerTest.php b/tests/unit/Activity/ActivityManagerTest.php
index 7e541aa55..a93177e35 100644
--- a/tests/unit/Activity/ActivityManagerTest.php
+++ b/tests/unit/Activity/ActivityManagerTest.php
@@ -91,7 +91,9 @@ class ActivityManagerTest extends TestCase {
$managerClass = new \ReflectionClass(ActivityManager::class);
$this->l10n->expects($this->any())
->method('t')
- ->will($this->returnCallback(function ($s) { return $s; }));
+ ->will($this->returnCallback(function ($s) {
+ return $s;
+ }));
foreach ($managerClass->getConstants() as $constant => $value) {
if (strpos($constant, 'SUBJECT') === 0) {
@@ -111,7 +113,6 @@ class ActivityManagerTest extends TestCase {
}
}
}
-
}
public function testCreateEvent() {
@@ -342,12 +343,10 @@ class ActivityManagerTest extends TestCase {
], $this->invokePrivate($this->activityManager, 'findDetailsForAttachment', [777]));
}
- public function invokePrivate(&$object, $methodName, array $parameters = array())
- {
+ public function invokePrivate(&$object, $methodName, array $parameters = []) {
$reflection = new \ReflectionClass(get_class($object));
$method = $reflection->getMethod($methodName);
$method->setAccessible(true);
return $method->invokeArgs($object, $parameters);
}
-
}
diff --git a/tests/unit/Activity/ChangeSetTest.php b/tests/unit/Activity/ChangeSetTest.php
index b7781868d..fe6da241f 100644
--- a/tests/unit/Activity/ChangeSetTest.php
+++ b/tests/unit/Activity/ChangeSetTest.php
@@ -25,9 +25,7 @@ namespace OCA\Deck\Activity;
use PHPUnit\Framework\TestCase;
-
class ChangeSetTest extends TestCase {
-
public function setUp(): void {
}
@@ -54,5 +52,4 @@ class ChangeSetTest extends TestCase {
$changeSet->enableDiff();
$this->assertTrue($changeSet->getDiff());
}
-
}
diff --git a/tests/unit/Activity/CommentEventHandlerTest.php b/tests/unit/Activity/CommentEventHandlerTest.php
index ff44e3f4c..522bab28c 100644
--- a/tests/unit/Activity/CommentEventHandlerTest.php
+++ b/tests/unit/Activity/CommentEventHandlerTest.php
@@ -23,27 +23,12 @@
namespace OCA\Deck\Activity;
-use OCA\Deck\Db\AclMapper;
-use OCA\Deck\Db\AssignedUsers;
-use OCA\Deck\Db\Attachment;
-use OCA\Deck\Db\AttachmentMapper;
-use OCA\Deck\Db\Board;
-use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper;
-use OCA\Deck\Db\Label;
-use OCA\Deck\Db\Stack;
-use OCA\Deck\Db\StackMapper;
use OCA\Deck\Notification\NotificationHelper;
-use OCA\Deck\Service\PermissionService;
-use OCP\Activity\IEvent;
-use OCP\Activity\IManager;
use OCP\Comments\CommentsEvent;
use OCP\Comments\IComment;
-use OCP\IL10N;
-use OCP\IUser;
use PHPUnit\Framework\TestCase;
-use PHPUnit_Framework_MockObject_MockObject as MockObject;
class CommentEventHandlerTest extends TestCase {
@@ -109,12 +94,10 @@ class CommentEventHandlerTest extends TestCase {
$this->commentEventHandler->handle($commentsEvent);
}
- public function invokePrivate(&$object, $methodName, array $parameters = array())
- {
+ public function invokePrivate(&$object, $methodName, array $parameters = []) {
$reflection = new \ReflectionClass(get_class($object));
$method = $reflection->getMethod($methodName);
$method->setAccessible(true);
return $method->invokeArgs($object, $parameters);
}
-
}
diff --git a/tests/unit/Activity/DeckProviderTest.php b/tests/unit/Activity/DeckProviderTest.php
index eba15d09f..07feaaa92 100644
--- a/tests/unit/Activity/DeckProviderTest.php
+++ b/tests/unit/Activity/DeckProviderTest.php
@@ -81,20 +81,20 @@ class DeckProviderTest extends TestCase {
$event->expects($this->any())->method('getObjectName')->willReturn($objectName);
$event->expects($this->any())->method('getAuthor')->willReturn('admin');
$event->expects($this->any())->method('getMessage')->willReturn('');
- $event->expects($this->any())->method('setIcon')->will($this->returnCallback(function($icon) use (&$data, $event) {
+ $event->expects($this->any())->method('setIcon')->will($this->returnCallback(function ($icon) use (&$data, $event) {
$data['icon'] = $icon;
return $event;
}));
- $event->expects($this->any())->method('setParsedSubject')->will($this->returnCallback(function($subject) use (&$data, $event) {
+ $event->expects($this->any())->method('setParsedSubject')->will($this->returnCallback(function ($subject) use (&$data, $event) {
$data['parsedSubject'] = $subject;
return $event;
}));
- $event->expects($this->any())->method('setRichSubject')->will($this->returnCallback(function($subject) use (&$data, $event) {
+ $event->expects($this->any())->method('setRichSubject')->will($this->returnCallback(function ($subject) use (&$data, $event) {
$data['richSubject'] = $subject;
return $event;
}));
$event->expects($this->any())->method('getIcon')->will(
- $this->returnCallback(function() use (&$data) {
+ $this->returnCallback(function () use (&$data) {
return array_key_exists('icon', $data) ? $data['icon'] : 'noicon';
})
);
@@ -133,12 +133,12 @@ class DeckProviderTest extends TestCase {
->willReturn('test string {board}');
$this->urlGenerator->expects($this->any())
->method('imagePath')
- ->will($this->returnCallback(function($a, $i) {
+ ->will($this->returnCallback(function ($a, $i) {
return $a . '/' . $i;
}));
$this->urlGenerator->expects($this->any())
->method('getAbsoluteURL')
- ->will($this->returnCallback(function($url) {
+ ->will($this->returnCallback(function ($url) {
return $url;
}));
$this->provider->parse('en_US', $event);
@@ -159,7 +159,7 @@ class DeckProviderTest extends TestCase {
public function testParseObjectTypeBoard() {
$this->urlGenerator->expects($this->any())
->method('imagePath')
- ->will($this->returnCallback(function($a, $i) {
+ ->will($this->returnCallback(function ($a, $i) {
return $a . '/' . $i;
}));
$this->activityManager->expects($this->once())
@@ -200,7 +200,7 @@ class DeckProviderTest extends TestCase {
public function testParseObjectTypeCard() {
$this->urlGenerator->expects($this->any())
->method('imagePath')
- ->will($this->returnCallback(function($a, $i) {
+ ->will($this->returnCallback(function ($a, $i) {
return $a . '/' . $i;
}));
$this->activityManager->expects($this->once())
@@ -238,13 +238,12 @@ class DeckProviderTest extends TestCase {
$this->assertEquals('test string Card', $event->getParsedSubject());
$this->assertEquals('test string {card}', $event->getRichSubject());
$this->assertEquals('', $event->getMessage());
-
}
public function testParseObjectTypeCardWithDiff() {
$this->urlGenerator->expects($this->any())
->method('imagePath')
- ->will($this->returnCallback(function($a, $i) {
+ ->will($this->returnCallback(function ($a, $i) {
return $a . '/' . $i;
}));
$this->activityManager->expects($this->once())
@@ -496,8 +495,7 @@ class DeckProviderTest extends TestCase {
$this->assertEquals($expected, $actual);
}
- public function invokePrivate(&$object, $methodName, array $parameters = array())
- {
+ public function invokePrivate(&$object, $methodName, array $parameters = []) {
$reflection = new \ReflectionClass(get_class($object));
$method = $reflection->getMethod($methodName);
$method->setAccessible(true);
diff --git a/tests/unit/Activity/FilterTest.php b/tests/unit/Activity/FilterTest.php
index c18b1098f..8a22b6a91 100644
--- a/tests/unit/Activity/FilterTest.php
+++ b/tests/unit/Activity/FilterTest.php
@@ -77,5 +77,4 @@ class FilterTest extends TestCase {
public function testAllowedApps() {
$this->assertEquals(['deck'], $this->filter->allowedApps());
}
-
}
diff --git a/tests/unit/Activity/SettingTest.php b/tests/unit/Activity/SettingTest.php
index 92002645e..6896b41dc 100644
--- a/tests/unit/Activity/SettingTest.php
+++ b/tests/unit/Activity/SettingTest.php
@@ -35,7 +35,9 @@ class SettingTest extends TestCase {
public function setUp(): void {
$this->l10n = $this->createMock(IL10N::class);
- $this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($s) { return $s; }));
+ $this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($s) {
+ return $s;
+ }));
$this->setting = new Setting($this->l10n);
}
@@ -66,5 +68,4 @@ class SettingTest extends TestCase {
public function testIsDefaultEnabledMail() {
$this->assertFalse($this->setting->isDefaultEnabledMail());
}
-
}
diff --git a/tests/unit/Command/UserExportTest.php b/tests/unit/Command/UserExportTest.php
index 16e455cfc..5527dba84 100644
--- a/tests/unit/Command/UserExportTest.php
+++ b/tests/unit/Command/UserExportTest.php
@@ -24,26 +24,19 @@
namespace OCA\Deck\Command;
use OCA\Deck\Db\AssignedUsersMapper;
-use OCA\Deck\Db\Attachment;
-use OCA\Deck\Db\AttachmentMapper;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\Stack;
use OCA\Deck\Db\StackMapper;
-use OCA\Deck\InvalidAttachmentType;
-use OCA\Deck\Service\AttachmentService;
use OCA\Deck\Service\BoardService;
-use OCA\Deck\Service\IAttachmentService;
use OCP\IGroupManager;
-use OCP\IUser;
use OCP\IUserManager;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class UserExportTest extends \Test\TestCase {
-
protected $boardMapper;
protected $boardService;
protected $stackMapper;
diff --git a/tests/unit/Cron/ScheduledNoificationsTest.php b/tests/unit/Cron/ScheduledNoificationsTest.php
index f378ba01e..ff7aad6a1 100644
--- a/tests/unit/Cron/ScheduledNoificationsTest.php
+++ b/tests/unit/Cron/ScheduledNoificationsTest.php
@@ -23,8 +23,6 @@
namespace OCA\Deck\Cron;
-use OCA\Deck\Db\Board;
-use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper;
use OCA\Deck\Notification\NotificationHelper;
diff --git a/tests/unit/Db/AclMapperTest.php b/tests/unit/Db/AclMapperTest.php
index b52c8adb3..095c3815a 100644
--- a/tests/unit/Db/AclMapperTest.php
+++ b/tests/unit/Db/AclMapperTest.php
@@ -30,9 +30,8 @@ use Test\AppFramework\Db\MapperTestUtility;
/**
* @group DB
*/
-class AclMapperTest extends MapperTestUtility {
-
- private $dbConnection;
+class AclMapperTest extends MapperTestUtility {
+ private $dbConnection;
private $aclMapper;
private $boardMapper;
private $userManager;
@@ -46,33 +45,33 @@ class AclMapperTest extends MapperTestUtility {
parent::setUp();
$this->dbConnection = \OC::$server->getDatabaseConnection();
- $this->aclMapper = new AclMapper($this->dbConnection);
- $this->userManager = $this->createMock(IUserManager::class);
- $this->groupManager = $this->createMock(IGroupManager::class);
- $this->boardMapper = new BoardMapper(
- $this->dbConnection,
- \OC::$server->query(LabelMapper::class),
- $this->aclMapper,
- \OC::$server->query(StackMapper::class),
+ $this->aclMapper = new AclMapper($this->dbConnection);
+ $this->userManager = $this->createMock(IUserManager::class);
+ $this->groupManager = $this->createMock(IGroupManager::class);
+ $this->boardMapper = new BoardMapper(
+ $this->dbConnection,
+ \OC::$server->query(LabelMapper::class),
+ $this->aclMapper,
+ \OC::$server->query(StackMapper::class),
$this->userManager,
$this->groupManager
);
- $this->boards = [
- $this->boardMapper->insert($this->getBoard('MyBoard 1', 'user1')),
- $this->boardMapper->insert($this->getBoard('MyBoard 2', 'user2')),
- $this->boardMapper->insert($this->getBoard('MyBoard 3', 'user3'))
- ];
+ $this->boards = [
+ $this->boardMapper->insert($this->getBoard('MyBoard 1', 'user1')),
+ $this->boardMapper->insert($this->getBoard('MyBoard 2', 'user2')),
+ $this->boardMapper->insert($this->getBoard('MyBoard 3', 'user3'))
+ ];
$this->acls = [
- $this->aclMapper->insert($this->getAcl('user','user1', false, false, false, $this->boards[1]->getId())),
- $this->aclMapper->insert($this->getAcl('user','user2', true, false, false, $this->boards[0]->getId())),
- $this->aclMapper->insert($this->getAcl('user','user3', true, true, false, $this->boards[0]->getId())),
- $this->aclMapper->insert($this->getAcl('user','user1', false, false, false, $this->boards[2]->getId()))
- ];
+ $this->aclMapper->insert($this->getAcl('user','user1', false, false, false, $this->boards[1]->getId())),
+ $this->aclMapper->insert($this->getAcl('user','user2', true, false, false, $this->boards[0]->getId())),
+ $this->aclMapper->insert($this->getAcl('user','user3', true, true, false, $this->boards[0]->getId())),
+ $this->aclMapper->insert($this->getAcl('user','user1', false, false, false, $this->boards[2]->getId()))
+ ];
- foreach ($this->acls as $acl) {
- $acl->resetUpdatedFields();
- }
+ foreach ($this->acls as $acl) {
+ $acl->resetUpdatedFields();
+ }
}
/** @return Acl */
public function getAcl($type='user', $participant='admin', $edit=false, $share=false, $manage=false, $boardId=123) {
@@ -88,39 +87,38 @@ class AclMapperTest extends MapperTestUtility {
/** @return Board */
public function getBoard($title, $owner) {
- $board = new Board();
- $board->setTitle($title);
- $board->setOwner($owner);
- return $board;
- }
+ $board = new Board();
+ $board->setTitle($title);
+ $board->setOwner($owner);
+ return $board;
+ }
public function testFindAllDatabase() {
- $actual = $this->aclMapper->findAll($this->boards[0]->getId());
- $expected = [$this->acls[1], $this->acls[2]];
- $this->assertEquals($expected, $actual);
- }
- public function testIsOwnerDatabase() {
- $this->assertTrue($this->aclMapper->isOwner('user2', $this->acls[0]->getId()));
- $this->assertTrue($this->aclMapper->isOwner('user1', $this->acls[1]->getId()));
- $this->assertTrue($this->aclMapper->isOwner('user1', $this->acls[2]->getId()));
- $this->assertTrue($this->aclMapper->isOwner('user3', $this->acls[3]->getId()));
- $this->assertFalse($this->aclMapper->isOwner('user3', $this->acls[0]->getId()));
- $this->assertFalse($this->aclMapper->isOwner('user1', $this->acls[0]->getId()));
- }
+ $actual = $this->aclMapper->findAll($this->boards[0]->getId());
+ $expected = [$this->acls[1], $this->acls[2]];
+ $this->assertEquals($expected, $actual);
+ }
+ public function testIsOwnerDatabase() {
+ $this->assertTrue($this->aclMapper->isOwner('user2', $this->acls[0]->getId()));
+ $this->assertTrue($this->aclMapper->isOwner('user1', $this->acls[1]->getId()));
+ $this->assertTrue($this->aclMapper->isOwner('user1', $this->acls[2]->getId()));
+ $this->assertTrue($this->aclMapper->isOwner('user3', $this->acls[3]->getId()));
+ $this->assertFalse($this->aclMapper->isOwner('user3', $this->acls[0]->getId()));
+ $this->assertFalse($this->aclMapper->isOwner('user1', $this->acls[0]->getId()));
+ }
- public function testFindBoardIdDatabase() {
- $this->assertEquals($this->boards[0]->getId(), $this->aclMapper->findBoardId($this->acls[1]->getId()));
- }
+ public function testFindBoardIdDatabase() {
+ $this->assertEquals($this->boards[0]->getId(), $this->aclMapper->findBoardId($this->acls[1]->getId()));
+ }
- public function tearDown(): void {
- parent::tearDown();
- foreach ($this->acls as $acl) {
- $this->aclMapper->delete($acl);
- }
- foreach ($this->boards as $board) {
- $this->boardMapper->delete($board);
- }
- }
-
+ public function tearDown(): void {
+ parent::tearDown();
+ foreach ($this->acls as $acl) {
+ $this->aclMapper->delete($acl);
+ }
+ foreach ($this->boards as $board) {
+ $this->boardMapper->delete($board);
+ }
+ }
}
diff --git a/tests/unit/Db/AclTest.php b/tests/unit/Db/AclTest.php
index d11e22226..bffcdda93 100644
--- a/tests/unit/Db/AclTest.php
+++ b/tests/unit/Db/AclTest.php
@@ -5,26 +5,25 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck\Db;
class AclTest extends \Test\TestCase {
-
private function createAclUser() {
$acl = new Acl();
$acl->setId(1);
@@ -103,7 +102,6 @@ class AclTest extends \Test\TestCase {
$this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_EDIT));
$this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_MANAGE));
$this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_SHARE));
- $this->assertEquals(false, $acl->getPermission(5));
-
+ $this->assertEquals(false, $acl->getPermission(5));
}
-}
\ No newline at end of file
+}
diff --git a/tests/unit/Db/AttachmentMapperTest.php b/tests/unit/Db/AttachmentMapperTest.php
index 6846710f5..32585cc5b 100644
--- a/tests/unit/Db/AttachmentMapperTest.php
+++ b/tests/unit/Db/AttachmentMapperTest.php
@@ -25,17 +25,16 @@ namespace OCA\Deck\Db;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\IDBConnection;
-use OCP\IGroupManager;
use OCP\IUserManager;
use Test\AppFramework\Db\MapperTestUtility;
/**
* @group DB
*/
-class AttachmentMapperTest extends MapperTestUtility {
+class AttachmentMapperTest extends MapperTestUtility {
/** @var IDBConnection */
- private $dbConnection;
+ private $dbConnection;
/** @var AttachmentMapper */
private $attachmentMapper;
/** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
@@ -54,13 +53,13 @@ class AttachmentMapperTest extends MapperTestUtility {
$this->cardMapper = $this->createMock(CardMapper::class);
$this->dbConnection = \OC::$server->getDatabaseConnection();
- $this->attachmentMapper = new AttachmentMapper(
- $this->dbConnection,
- $this->cardMapper,
+ $this->attachmentMapper = new AttachmentMapper(
+ $this->dbConnection,
+ $this->cardMapper,
$this->userManager
- );
- $this->attachments = [
- $this->createAttachmentEntity(1, 'deck_file', 'file1.pdf'),
+ );
+ $this->attachments = [
+ $this->createAttachmentEntity(1, 'deck_file', 'file1.pdf'),
$this->createAttachmentEntity(1, 'deck_file', 'file2.pdf'),
$this->createAttachmentEntity(2, 'deck_file', 'file3.pdf'),
$this->createAttachmentEntity(3, 'deck_file', 'file4.pdf')
@@ -138,11 +137,10 @@ class AttachmentMapperTest extends MapperTestUtility {
}
}
- public function tearDown(): void {
- parent::tearDown();
- foreach ($this->attachments as $attachment) {
- $this->attachmentMapper->delete($attachment);
- }
- }
-
+ public function tearDown(): void {
+ parent::tearDown();
+ foreach ($this->attachments as $attachment) {
+ $this->attachmentMapper->delete($attachment);
+ }
+ }
}
diff --git a/tests/unit/Db/AttachmentTest.php b/tests/unit/Db/AttachmentTest.php
index cc71b92ec..a17185eaa 100644
--- a/tests/unit/Db/AttachmentTest.php
+++ b/tests/unit/Db/AttachmentTest.php
@@ -18,7 +18,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck\Db;
@@ -48,4 +48,4 @@ class AttachmentTest extends \Test\TestCase {
], $board->jsonSerialize());
}
-}
\ No newline at end of file
+}
diff --git a/tests/unit/Db/BoardMapperTest.php b/tests/unit/Db/BoardMapperTest.php
index 14da16749..82a83e29e 100644
--- a/tests/unit/Db/BoardMapperTest.php
+++ b/tests/unit/Db/BoardMapperTest.php
@@ -31,11 +31,11 @@ use Test\AppFramework\Db\MapperTestUtility;
/**
* @group DB
*/
-class BoardMapperTest extends MapperTestUtility {
+class BoardMapperTest extends MapperTestUtility {
/** @var IDBConnection */
- private $dbConnection;
- /** @var AclMapper|\PHPUnit\Framework\MockObject\MockObject */
+ private $dbConnection;
+ /** @var AclMapper|\PHPUnit\Framework\MockObject\MockObject */
private $aclMapper;
/** @var BoardMapper */
private $boardMapper;
@@ -55,35 +55,35 @@ class BoardMapperTest extends MapperTestUtility {
$this->groupManager = $this->createMock(IGroupManager::class);
$this->dbConnection = \OC::$server->getDatabaseConnection();
- $this->boardMapper = new BoardMapper(
- $this->dbConnection,
- \OC::$server->query(LabelMapper::class),
- \OC::$server->query(AclMapper::class),
- \OC::$server->query(StackMapper::class),
+ $this->boardMapper = new BoardMapper(
+ $this->dbConnection,
+ \OC::$server->query(LabelMapper::class),
+ \OC::$server->query(AclMapper::class),
+ \OC::$server->query(StackMapper::class),
$this->userManager,
$this->groupManager
- );
- $this->aclMapper = \OC::$server->query(AclMapper::class);
- $this->labelMapper = \OC::$server->query(LabelMapper::class);
+ );
+ $this->aclMapper = \OC::$server->query(AclMapper::class);
+ $this->labelMapper = \OC::$server->query(LabelMapper::class);
- $this->boards = [
- $this->boardMapper->insert($this->getBoard('MyBoard 1', 'user1')),
- $this->boardMapper->insert($this->getBoard('MyBoard 2', 'user2')),
- $this->boardMapper->insert($this->getBoard('MyBoard 3', 'user3'))
- ];
+ $this->boards = [
+ $this->boardMapper->insert($this->getBoard('MyBoard 1', 'user1')),
+ $this->boardMapper->insert($this->getBoard('MyBoard 2', 'user2')),
+ $this->boardMapper->insert($this->getBoard('MyBoard 3', 'user3'))
+ ];
$this->acls = [
- $this->aclMapper->insert($this->getAcl('user','user1', false, false, false, $this->boards[1]->getId())),
- $this->aclMapper->insert($this->getAcl('user','user2', true, false, false, $this->boards[0]->getId())),
- $this->aclMapper->insert($this->getAcl('user','user3', true, true, false, $this->boards[0]->getId())),
- $this->aclMapper->insert($this->getAcl('user','user1', false, false, false, $this->boards[2]->getId()))
- ];
+ $this->aclMapper->insert($this->getAcl('user','user1', false, false, false, $this->boards[1]->getId())),
+ $this->aclMapper->insert($this->getAcl('user','user2', true, false, false, $this->boards[0]->getId())),
+ $this->aclMapper->insert($this->getAcl('user','user3', true, true, false, $this->boards[0]->getId())),
+ $this->aclMapper->insert($this->getAcl('user','user1', false, false, false, $this->boards[2]->getId()))
+ ];
foreach ($this->acls as $acl) {
- $acl->resetUpdatedFields();
- }
- foreach ($this->boards as $board) {
- $board->resetUpdatedFields();
- }
+ $acl->resetUpdatedFields();
+ }
+ foreach ($this->boards as $board) {
+ $board->resetUpdatedFields();
+ }
}
/** @return Acl */
public function getAcl($type='user', $participant='admin', $edit=false, $share=false, $manage=false, $boardId=123) {
@@ -99,20 +99,20 @@ class BoardMapperTest extends MapperTestUtility {
/** @return Board */
public function getBoard($title, $owner) {
- $board = new Board();
- $board->setTitle($title);
- $board->setOwner($owner);
- return $board;
- }
+ $board = new Board();
+ $board->setTitle($title);
+ $board->setOwner($owner);
+ return $board;
+ }
public function testFind() {
- $actual = $this->boardMapper->find($this->boards[0]->getId());
- /** @var Board $expected */
- $expected = clone $this->boards[0];
- $expected->setShared(-1);
- $expected->resetUpdatedFields();
- $this->assertEquals($expected, $actual);
- }
+ $actual = $this->boardMapper->find($this->boards[0]->getId());
+ /** @var Board $expected */
+ $expected = clone $this->boards[0];
+ $expected->setShared(-1);
+ $expected->resetUpdatedFields();
+ $this->assertEquals($expected, $actual);
+ }
public function testFindAllByUser() {
$actual = $this->boardMapper->findAllByUser('user1');
@@ -123,7 +123,7 @@ class BoardMapperTest extends MapperTestUtility {
];
foreach ($expected as $e) {
foreach ($actual as $a) {
- if($e->getId() === $a->getId()) {
+ if ($e->getId() === $a->getId()) {
$this->assertEquals($e->getTitle(), $a->getTitle());
}
}
@@ -149,27 +149,26 @@ class BoardMapperTest extends MapperTestUtility {
$this->boardMapper->update($this->boards[0]);
}
- public function testFindWithLabels() {
- $actual = $this->boardMapper->find($this->boards[0]->getId(), true, false);
+ public function testFindWithLabels() {
+ $actual = $this->boardMapper->find($this->boards[0]->getId(), true, false);
/** @var Board $expected */
$expected = $this->boards[0];
- $this->assertEquals($expected->getLabels(), $actual->getLabels());
- }
+ $this->assertEquals($expected->getLabels(), $actual->getLabels());
+ }
- public function testFindWithAcl() {
- $actual = $this->boardMapper->find($this->boards[0]->getId(), false, true);
- $expected = [$this->acls[1], $this->acls[2]];
- $this->assertEquals($expected, $actual->getAcl());
- }
-
- public function tearDown(): void {
- parent::tearDown();
- foreach ($this->acls as $acl) {
- $this->aclMapper->delete($acl);
- }
- foreach ($this->boards as $board) {
- $this->boardMapper->delete($board);
- }
- }
+ public function testFindWithAcl() {
+ $actual = $this->boardMapper->find($this->boards[0]->getId(), false, true);
+ $expected = [$this->acls[1], $this->acls[2]];
+ $this->assertEquals($expected, $actual->getAcl());
+ }
+ public function tearDown(): void {
+ parent::tearDown();
+ foreach ($this->acls as $acl) {
+ $this->aclMapper->delete($acl);
+ }
+ foreach ($this->boards as $board) {
+ $this->boardMapper->delete($board);
+ }
+ }
}
diff --git a/tests/unit/Db/BoardTest.php b/tests/unit/Db/BoardTest.php
index 5053c761d..63c7f2b82 100644
--- a/tests/unit/Db/BoardTest.php
+++ b/tests/unit/Db/BoardTest.php
@@ -23,12 +23,12 @@ class BoardTest extends TestCase {
'title' => "My Board",
'owner' => "admin",
'color' => "000000",
- 'labels' => array(),
+ 'labels' => [],
'permissions' => [],
'stacks' => [],
'deletedAt' => 0,
'lastModified' => 0,
- 'acl' => array(),
+ 'acl' => [],
'archived' => false,
'users' => ['user1', 'user2'],
], $board->jsonSerialize());
@@ -36,18 +36,18 @@ class BoardTest extends TestCase {
public function testSetLabels() {
$board = $this->createBoard();
- $board->setLabels(array("foo", "bar"));
+ $board->setLabels(["foo", "bar"]);
$this->assertEquals([
'id' => 1,
'title' => "My Board",
'owner' => "admin",
'color' => "000000",
- 'labels' => array("foo", "bar"),
+ 'labels' => ["foo", "bar"],
'permissions' => [],
'stacks' => [],
'deletedAt' => 0,
'lastModified' => 0,
- 'acl' => array(),
+ 'acl' => [],
'archived' => false,
'users' => [],
], $board->jsonSerialize());
@@ -56,7 +56,7 @@ class BoardTest extends TestCase {
$acl = new Acl();
$acl->setId(1);
$board = $this->createBoard();
- $board->setAcl(array($acl));
+ $board->setAcl([$acl]);
$result = $board->getAcl()[0];
$this->assertEquals($acl, $result);
}
@@ -68,12 +68,12 @@ class BoardTest extends TestCase {
'title' => "My Board",
'owner' => "admin",
'color' => "000000",
- 'labels' => array(),
+ 'labels' => [],
'permissions' => [],
'stacks' => [],
'deletedAt' => 0,
'lastModified' => 0,
- 'acl' => array(),
+ 'acl' => [],
'archived' => false,
'shared' => 1,
'users' => [],
diff --git a/tests/unit/Db/CardTest.php b/tests/unit/Db/CardTest.php
index ff8aeab39..995ff2d54 100644
--- a/tests/unit/Db/CardTest.php
+++ b/tests/unit/Db/CardTest.php
@@ -88,7 +88,7 @@ class CardTest extends TestCase {
}
public function testJsonSerializeLabels() {
$card = $this->createCard();
- $card->setLabels(array());
+ $card->setLabels([]);
$this->assertEquals([
'id' => 1,
'title' => "My Card",
@@ -99,7 +99,7 @@ class CardTest extends TestCase {
'owner' => 'admin',
'order' => 12,
'stackId' => 1,
- 'labels' => array(),
+ 'labels' => [],
'duedate' => null,
'overdue' => 0,
'archived' => false,
@@ -123,7 +123,7 @@ class CardTest extends TestCase {
public function testJsonSerializeAsignedUsers() {
$card = $this->createCard();
$card->setAssignedUsers([ 'user1' ]);
- $card->setLabels(array());
+ $card->setLabels([]);
$this->assertEquals([
'id' => 1,
'title' => "My Card",
@@ -134,7 +134,7 @@ class CardTest extends TestCase {
'owner' => 'admin',
'order' => 12,
'stackId' => 1,
- 'labels' => array(),
+ 'labels' => [],
'duedate' => null,
'overdue' => 0,
'archived' => false,
@@ -146,5 +146,4 @@ class CardTest extends TestCase {
'lastEditor' => null,
], $card->jsonSerialize());
}
-
}
diff --git a/tests/unit/Db/GroupTest.php b/tests/unit/Db/GroupTest.php
index 163974871..195c9268d 100644
--- a/tests/unit/Db/GroupTest.php
+++ b/tests/unit/Db/GroupTest.php
@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use OCP\IGroup;
class GroupTest extends \Test\TestCase {
-
public function testGroupObjectSerialize() {
/** @var IGroup $group */
$group = $this->createMock(IGroup::class);
diff --git a/tests/unit/Db/LabelTest.php b/tests/unit/Db/LabelTest.php
index f74c74e1d..b129c29a3 100644
--- a/tests/unit/Db/LabelTest.php
+++ b/tests/unit/Db/LabelTest.php
@@ -5,20 +5,20 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck\Db;
@@ -37,14 +37,13 @@ class LabelTest extends TestCase {
$label = $this->createLabel();
$label->setBoardId(123);
$this->assertEquals([
- 'id' => 1,
- 'title' => 'My Label',
- 'boardId' => 123,
- 'cardId' => null,
- 'lastModified' => null,
- 'color' => '000000'
- ], $label->jsonSerialize());
-
+ 'id' => 1,
+ 'title' => 'My Label',
+ 'boardId' => 123,
+ 'cardId' => null,
+ 'lastModified' => null,
+ 'color' => '000000'
+ ], $label->jsonSerialize());
}
public function testJsonSerializeCard() {
$label = $this->createLabel();
@@ -57,8 +56,5 @@ class LabelTest extends TestCase {
'lastModified' => null,
'color' => '000000'
], $label->jsonSerialize());
-
}
-
-
}
diff --git a/tests/unit/Db/RelationalEntityTest.php b/tests/unit/Db/RelationalEntityTest.php
index 4ede1ed60..f2791c8eb 100644
--- a/tests/unit/Db/RelationalEntityTest.php
+++ b/tests/unit/Db/RelationalEntityTest.php
@@ -5,26 +5,25 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck\Db;
class RelationalEntityTest extends \Test\TestCase {
-
public function testRelation() {
$entity = new RelationalEntity();
$entity->foo = null;
@@ -48,5 +47,4 @@ class RelationalEntityTest extends \Test\TestCase {
];
$this->assertEquals($json, $entity->jsonSerialize());
}
-
-}
\ No newline at end of file
+}
diff --git a/tests/unit/Db/StackTest.php b/tests/unit/Db/StackTest.php
index 1820851e0..76016d555 100644
--- a/tests/unit/Db/StackTest.php
+++ b/tests/unit/Db/StackTest.php
@@ -44,7 +44,7 @@ class StackTest extends \Test\TestCase {
], $board->jsonSerialize());
}
public function testJsonSerializeWithCards() {
- $cards = array("foo", "bar");
+ $cards = ["foo", "bar"];
$board = $this->createStack();
$board->setCards($cards);
$this->assertEquals([
@@ -52,7 +52,7 @@ class StackTest extends \Test\TestCase {
'title' => "My Stack",
'order' => 1,
'boardId' => 1,
- 'cards' => array("foo", "bar"),
+ 'cards' => ["foo", "bar"],
'deletedAt' => 0,
'lastModified' => 0,
], $board->jsonSerialize());
diff --git a/tests/unit/Db/UserTest.php b/tests/unit/Db/UserTest.php
index 221a7f06d..6004deda4 100644
--- a/tests/unit/Db/UserTest.php
+++ b/tests/unit/Db/UserTest.php
@@ -26,7 +26,6 @@ namespace OCA\Deck\Db;
use OCP\IUser;
class UserTest extends \Test\TestCase {
-
public function testGroupObjectSerialize() {
/** @var IUser $user */
$user = $this->createMock(IUser::class);
diff --git a/tests/unit/ExceptionsTest.php b/tests/unit/ExceptionsTest.php
index 7af24c765..902bc4e6e 100644
--- a/tests/unit/ExceptionsTest.php
+++ b/tests/unit/ExceptionsTest.php
@@ -5,33 +5,31 @@
* @author Julius Härtl
*
* @license GNU AGPL version 3 or any later version
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
- *
+ *
*/
namespace OCA\Deck\Db;
use OCA\Deck\ArchivedItemException;
-use OCA\Deck\Controller\PageController;
use OCA\Deck\InvalidAttachmentType;
use OCA\Deck\NoPermissionException;
use OCA\Deck\NotFoundException;
use OCA\Deck\StatusException;
class ExceptionsTest extends \Test\TestCase {
-
public function testNoPermissionException() {
$c = new \stdClass();
$e = new NoPermissionException('not allowed', $c, 'mymethod');
@@ -60,5 +58,4 @@ class ExceptionsTest extends \Test\TestCase {
$this->assertEquals('foo', $e->getMessage());
$this->assertEquals(500, $e->getStatus());
}
-
-}
\ No newline at end of file
+}
diff --git a/tests/unit/Middleware/ExceptionMiddlewareTest.php b/tests/unit/Middleware/ExceptionMiddlewareTest.php
index 29c38481d..d7df3ac1d 100644
--- a/tests/unit/Middleware/ExceptionMiddlewareTest.php
+++ b/tests/unit/Middleware/ExceptionMiddlewareTest.php
@@ -35,7 +35,6 @@ use OCP\ILogger;
use OCP\IConfig;
use OCP\IRequest;
-
class ExceptionMiddlewareTest extends \Test\TestCase {
/** @var ILogger */
@@ -87,7 +86,5 @@ class ExceptionMiddlewareTest extends \Test\TestCase {
$result = $this->exceptionMiddleware->afterException($boardController, 'bar', new \Exception('failed hard'));
$this->assertEquals('failed hard', $result->getData()['message']);
$this->assertEquals(500, $result->getData()['status']);
-
}
-
}
diff --git a/tests/unit/Notification/NotificationHelperTest.php b/tests/unit/Notification/NotificationHelperTest.php
index 95eb4c94f..a1d771da4 100644
--- a/tests/unit/Notification/NotificationHelperTest.php
+++ b/tests/unit/Notification/NotificationHelperTest.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Notification;
-
use OCA\Deck\Db\Acl;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\BoardMapper;
@@ -71,7 +70,6 @@ class NotificationHelperTest extends \Test\TestCase {
$this->groupManager,
$this->currentUser
);
-
}
public function testSendCardDuedateAlreadyNotified() {
@@ -101,7 +99,7 @@ class NotificationHelperTest extends \Test\TestCase {
->method('__call')
->with('getId', [])
->willReturn(123);
- for($i=0; $i<3; $i++) {
+ for ($i=0; $i<3; $i++) {
$card->expects($this->at($i*3+2))
->method('__call')
->with('getId', [])
@@ -351,6 +349,4 @@ class NotificationHelperTest extends \Test\TestCase {
$this->notificationHelper->sendMention($comment);
}
-
-
}
diff --git a/tests/unit/Notification/NotifierTest.php b/tests/unit/Notification/NotifierTest.php
index 6f48b381b..925ac813e 100644
--- a/tests/unit/Notification/NotifierTest.php
+++ b/tests/unit/Notification/NotifierTest.php
@@ -31,9 +31,6 @@ use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
use OCP\Notification\INotification;
-use OCP\Notification\INotifier;
-use OCP\RichObjectStrings\Definitions;
-
class NotifierTest extends \Test\TestCase {
@@ -124,7 +121,6 @@ class NotifierTest extends \Test\TestCase {
$actualNotification = $this->notifier->prepare($notification, 'en_US');
$this->assertEquals($notification, $actualNotification);
-
}
public function testPrepareCardCommentMentioned() {
@@ -171,7 +167,6 @@ class NotifierTest extends \Test\TestCase {
$actualNotification = $this->notifier->prepare($notification, 'en_US');
$this->assertEquals($notification, $actualNotification);
-
}
public function dataPrepareCardAssigned() {
@@ -313,5 +308,4 @@ class NotifierTest extends \Test\TestCase {
$this->assertEquals($notification, $actualNotification);
}
-
}
diff --git a/tests/unit/Service/AssignmentServiceTest.php b/tests/unit/Service/AssignmentServiceTest.php
index 033b83b6a..257f3706a 100644
--- a/tests/unit/Service/AssignmentServiceTest.php
+++ b/tests/unit/Service/AssignmentServiceTest.php
@@ -23,30 +23,18 @@
namespace OCA\Deck\Service;
-
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\BadRequestException;
use OCA\Deck\Db\AclMapper;
use OCA\Deck\Db\AssignedUsers;
use OCA\Deck\Db\AssignedUsersMapper;
-use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper;
use OCA\Deck\Db\ChangeHelper;
-use OCA\Deck\Db\StackMapper;
-use OCA\Deck\Db\BoardMapper;
-use OCA\Deck\Db\LabelMapper;
use OCA\Deck\NotFoundException;
use OCA\Deck\Notification\NotificationHelper;
-use OCA\Deck\StatusException;
use OCP\Activity\IEvent;
-use OCP\Comments\ICommentsManager;
-use OCP\EventDispatcher\ABroadcastedEvent;
-use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\IUser;
-use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\TestCase;
class AssignmentServiceTest extends TestCase {
@@ -231,6 +219,4 @@ class AssignmentServiceTest extends TestCase {
$this->expectException(NotFoundException::class);
$actual = $this->assignmentService->unassignUser(123, 'user');
}
-
-
}
diff --git a/tests/unit/Service/AttachmentServiceTest.php b/tests/unit/Service/AttachmentServiceTest.php
index 544e4316f..29b2ccb31 100644
--- a/tests/unit/Service/AttachmentServiceTest.php
+++ b/tests/unit/Service/AttachmentServiceTest.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Service;
-
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\AppInfo\Application;
use OCA\Deck\Db\Acl;
@@ -44,13 +43,20 @@ use Test\TestCase;
/** @internal Just for testing the service registration */
class MyAttachmentService {
- public function extendData(Attachment $attachment) {}
- public function display(Attachment $attachment) {}
- public function create(Attachment $attachment) {}
- public function update(Attachment $attachment) {}
- public function delete(Attachment $attachment) {}
- public function allowUndo() {}
- public function markAsDeleted(Attachment $attachment) {}
+ public function extendData(Attachment $attachment) {
+ }
+ public function display(Attachment $attachment) {
+ }
+ public function create(Attachment $attachment) {
+ }
+ public function update(Attachment $attachment) {
+ }
+ public function delete(Attachment $attachment) {
+ }
+ public function allowUndo() {
+ }
+ public function markAsDeleted(Attachment $attachment) {
+ }
}
class AttachmentServiceTest extends TestCase {
@@ -106,10 +112,10 @@ class AttachmentServiceTest extends TestCase {
$this->l10n = $this->createMock(IL10N::class);
$this->changeHelper = $this->createMock(ChangeHelper::class);
- $this->attachmentService = new AttachmentService($this->attachmentMapper, $this->cardMapper, $this->changeHelper, $this->permissionService, $this->application, $this->cacheFactory, $this->userId, $this->l10n, $this->activityManager);
- }
+ $this->attachmentService = new AttachmentService($this->attachmentMapper, $this->cardMapper, $this->changeHelper, $this->permissionService, $this->application, $this->cacheFactory, $this->userId, $this->l10n, $this->activityManager);
+ }
- public function testRegisterAttachmentService() {
+ public function testRegisterAttachmentService() {
$application = $this->createMock(Application::class);
$appContainer = $this->createMock(IAppContainer::class);
$fileServiceMock = $this->createMock(FileService::class);
@@ -227,7 +233,9 @@ class AttachmentServiceTest extends TestCase {
->willReturn($attachment);
$this->attachmentServiceImpl->expects($this->once())
->method('extendData')
- ->willReturnCallback(function($a) { $a->setExtendedData(['mime' => 'image/jpeg']); });
+ ->willReturnCallback(function ($a) {
+ $a->setExtendedData(['mime' => 'image/jpeg']);
+ });
$actual = $this->attachmentService->create(123, 'deck_file', 'file_name.jpg');
@@ -282,7 +290,9 @@ class AttachmentServiceTest extends TestCase {
->willReturn($attachment);
$this->attachmentServiceImpl->expects($this->once())
->method('extendData')
- ->willReturnCallback(function($a) { $a->setExtendedData(['mime' => 'image/jpeg']); });
+ ->willReturnCallback(function ($a) {
+ $a->setExtendedData(['mime' => 'image/jpeg']);
+ });
$actual = $this->attachmentService->update(123, 1, 'file_name.jpg');
@@ -326,7 +336,9 @@ class AttachmentServiceTest extends TestCase {
->willReturn(true);
$this->attachmentServiceImpl->expects($this->once())
->method('markAsDeleted')
- ->willReturnCallback(function($a) { $a->setDeletedAt(23); });
+ ->willReturnCallback(function ($a) {
+ $a->setDeletedAt(23);
+ });
$this->attachmentMapper->expects($this->once())
->method('update')
->willReturn($attachment);
@@ -370,5 +382,4 @@ class AttachmentServiceTest extends TestCase {
->willReturn(false);
$actual = $this->attachmentService->restore(123, 1);
}
-
}
diff --git a/tests/unit/Service/BoardServiceTest.php b/tests/unit/Service/BoardServiceTest.php
index 2bc874c54..6553a6245 100644
--- a/tests/unit/Service/BoardServiceTest.php
+++ b/tests/unit/Service/BoardServiceTest.php
@@ -162,9 +162,9 @@ class BoardServiceTest extends TestCase {
public function testCreate() {
$board = new Board();
- $board->setTitle('MyBoard');
- $board->setOwner('admin');
- $board->setColor('00ff00');
+ $board->setTitle('MyBoard');
+ $board->setOwner('admin');
+ $board->setColor('00ff00');
$this->boardMapper->expects($this->once())
->method('insert')
->willReturn($board);
@@ -247,7 +247,7 @@ class BoardServiceTest extends TestCase {
$acl->setPermissionEdit(true);
$acl->setPermissionShare(true);
$acl->setPermissionManage(true);
- $acl->resolveRelation('participant', function($participant) use (&$user) {
+ $acl->resolveRelation('participant', function ($participant) use (&$user) {
return null;
});
$this->notificationHelper->expects($this->once())
@@ -333,7 +333,7 @@ class BoardServiceTest extends TestCase {
$acl->setPermissionEdit($resultingAcl[0]);
$acl->setPermissionShare($resultingAcl[1]);
$acl->setPermissionManage($resultingAcl[2]);
- $acl->resolveRelation('participant', function($participant) use (&$user) {
+ $acl->resolveRelation('participant', function ($participant) use (&$user) {
return null;
});
$this->notificationHelper->expects($this->once())
@@ -373,7 +373,6 @@ class BoardServiceTest extends TestCase {
$this->assertFalse($result->getPermissionEdit());
$this->assertFalse($result->getPermissionShare());
$this->assertFalse($result->getPermissionManage());
-
}
public function testDeleteAcl() {
diff --git a/tests/unit/Service/CardServiceTest.php b/tests/unit/Service/CardServiceTest.php
index b6b6b033e..bf6368299 100644
--- a/tests/unit/Service/CardServiceTest.php
+++ b/tests/unit/Service/CardServiceTest.php
@@ -23,10 +23,7 @@
namespace OCA\Deck\Service;
-
use OCA\Deck\Activity\ActivityManager;
-use OCA\Deck\BadRequestException;
-use OCA\Deck\Db\AssignedUsers;
use OCA\Deck\Db\AssignedUsersMapper;
use OCA\Deck\Db\Card;
use OCA\Deck\Db\CardMapper;
@@ -34,13 +31,10 @@ use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\Db\StackMapper;
use OCA\Deck\Db\BoardMapper;
use OCA\Deck\Db\LabelMapper;
-use OCA\Deck\NotFoundException;
use OCA\Deck\Notification\NotificationHelper;
use OCA\Deck\StatusException;
use OCP\Activity\IEvent;
use OCP\Comments\ICommentsManager;
-use OCP\EventDispatcher\ABroadcastedEvent;
-use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUser;
use OCP\IUserManager;
@@ -81,7 +75,7 @@ class CardServiceTest extends TestCase {
private $changeHelper;
public function setUp(): void {
- parent::setUp();
+ parent::setUp();
$this->cardMapper = $this->createMock(CardMapper::class);
$this->stackMapper = $this->createMock(StackMapper::class);
$this->boardMapper = $this->createMock(BoardMapper::class);
@@ -184,7 +178,9 @@ class CardServiceTest extends TestCase {
$card->setTitle('title');
$card->setArchived(false);
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
- $this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function($c) { return $c; });
+ $this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function ($c) {
+ return $c;
+ });
$actual = $this->cardService->update(123, 'newtitle', 234, 'text', 999, 'foo', 'admin', '2017-01-01 00:00:00', null);
$this->assertEquals('newtitle', $actual->getTitle());
$this->assertEquals(234, $actual->getStackId());
@@ -209,7 +205,9 @@ class CardServiceTest extends TestCase {
$card->setTitle('title');
$card->setArchived(false);
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
- $this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function($c) { return $c; });
+ $this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function ($c) {
+ return $c;
+ });
$actual = $this->cardService->rename(123, 'newtitle');
$this->assertEquals('newtitle', $actual->getTitle());
}
@@ -224,31 +222,31 @@ class CardServiceTest extends TestCase {
$this->cardService->rename(123, 'newtitle');
}
- public function dataReorder() {
- return [
- [0, 0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]],
- [0, 9, [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]],
- [1, 3, [0, 2, 3, 1, 4, 5, 6, 7, 8, 9]]
- ];
- }
- /** @dataProvider dataReorder */
- public function testReorder($cardId, $newPosition, $order) {
- $cards = $this->getCards();
- $cardsTmp = [];
- $this->cardMapper->expects($this->once())->method('findAll')->willReturn($cards);
- $card = new Card();
- $card->setStackId(123);
+ public function dataReorder() {
+ return [
+ [0, 0, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]],
+ [0, 9, [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]],
+ [1, 3, [0, 2, 3, 1, 4, 5, 6, 7, 8, 9]]
+ ];
+ }
+ /** @dataProvider dataReorder */
+ public function testReorder($cardId, $newPosition, $order) {
+ $cards = $this->getCards();
+ $cardsTmp = [];
+ $this->cardMapper->expects($this->once())->method('findAll')->willReturn($cards);
+ $card = new Card();
+ $card->setStackId(123);
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
- $result = $this->cardService->reorder($cardId, 123, $newPosition);
- foreach ($result as $card) {
- $actual[$card->getOrder()] = $card->getId();
- }
- $this->assertEquals($order, $actual);
- }
+ $result = $this->cardService->reorder($cardId, 123, $newPosition);
+ foreach ($result as $card) {
+ $actual[$card->getOrder()] = $card->getId();
+ }
+ $this->assertEquals($order, $actual);
+ }
private function getCards() {
$cards = [];
- for($i=0; $i<10; $i++) {
+ for ($i=0; $i<10; $i++) {
$cards[$i] = new Card();
$cards[$i]->setTitle($i);
$cards[$i]->setOrder($i);
@@ -257,35 +255,37 @@ class CardServiceTest extends TestCase {
return $cards;
}
- public function testReorderArchived() {
- $card = new Card();
- $card->setTitle('title');
- $card->setArchived(true);
+ public function testReorderArchived() {
+ $card = new Card();
+ $card->setTitle('title');
+ $card->setArchived(true);
$card->setStackId(123);
$this->cardMapper->expects($this->once())->method('find')->willReturn($card);
- $this->cardMapper->expects($this->never())->method('update')->willReturnCallback(function($c) { return $c; });
- $this->expectException(StatusException::class);
- $actual = $this->cardService->reorder(123, 234, 1);
- }
- public function testArchive() {
- $card = new Card();
- $this->assertFalse($card->getArchived());
- $this->cardMapper->expects($this->once())->method('find')->willReturn($card);
- $this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function($c) {
- return $c;
- });
- $this->assertTrue($this->cardService->archive(123)->getArchived());
- }
- public function testUnarchive() {
- $card = new Card();
- $card->setArchived(true);
- $this->assertTrue($card->getArchived());
- $this->cardMapper->expects($this->once())->method('find')->willReturn($card);
- $this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function($c) {
- return $c;
- });
- $this->assertFalse($this->cardService->unarchive(123)->getArchived());
- }
+ $this->cardMapper->expects($this->never())->method('update')->willReturnCallback(function ($c) {
+ return $c;
+ });
+ $this->expectException(StatusException::class);
+ $actual = $this->cardService->reorder(123, 234, 1);
+ }
+ public function testArchive() {
+ $card = new Card();
+ $this->assertFalse($card->getArchived());
+ $this->cardMapper->expects($this->once())->method('find')->willReturn($card);
+ $this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function ($c) {
+ return $c;
+ });
+ $this->assertTrue($this->cardService->archive(123)->getArchived());
+ }
+ public function testUnarchive() {
+ $card = new Card();
+ $card->setArchived(true);
+ $this->assertTrue($card->getArchived());
+ $this->cardMapper->expects($this->once())->method('find')->willReturn($card);
+ $this->cardMapper->expects($this->once())->method('update')->willReturnCallback(function ($c) {
+ return $c;
+ });
+ $this->assertFalse($this->cardService->unarchive(123)->getArchived());
+ }
public function testAssignLabel() {
$card = new Card();
@@ -320,5 +320,4 @@ class CardServiceTest extends TestCase {
$this->expectException(StatusException::class);
$this->cardService->removeLabel(123, 999);
}
-
}
diff --git a/tests/unit/Service/DefaultBoardServiceTest.php b/tests/unit/Service/DefaultBoardServiceTest.php
index 65b46fd91..804bb6226 100644
--- a/tests/unit/Service/DefaultBoardServiceTest.php
+++ b/tests/unit/Service/DefaultBoardServiceTest.php
@@ -27,10 +27,6 @@ use OCA\Deck\Db\Card;
use OCA\Deck\Db\Board;
use OCA\Deck\Db\Stack;
use OCA\Deck\Db\BoardMapper;
-use OCA\Deck\Service\DefaultBoardService;
-use OCA\Deck\Service\BoardService;
-use OCA\Deck\Service\StackService;
-use OCA\Deck\Service\CardService;
use OCP\IConfig;
use OCP\IL10N;
use \Test\TestCase;
@@ -135,7 +131,9 @@ class DefaultBoardServiceTest extends TestCase {
$this->l10n->expects($this->any())
->method('t')
- ->willReturnCallback(function($text) { return $text; });
+ ->willReturnCallback(function ($text) {
+ return $text;
+ });
$stackToDoId = '123';
$stackToDo = $this->assembleTestStack('To do', $stackToDoId, $boardId);
diff --git a/tests/unit/Service/FileServiceTest.php b/tests/unit/Service/FileServiceTest.php
index 72dd57dd6..57dda5722 100644
--- a/tests/unit/Service/FileServiceTest.php
+++ b/tests/unit/Service/FileServiceTest.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Service;
-
use OCA\Deck\Db\Attachment;
use OCA\Deck\Db\AttachmentMapper;
use OCP\AppFramework\Http\ContentSecurityPolicy;
@@ -69,9 +68,9 @@ class FileServiceTest extends TestCase {
$this->config = $this->createMock(IConfig::class);
$this->attachmentMapper = $this->createMock(AttachmentMapper::class);
$this->fileService = new FileService($this->l10n, $this->appData, $this->request, $this->logger, $this->rootFolder, $this->config, $this->attachmentMapper);
- }
+ }
- public function mockGetFolder($cardId) {
+ public function mockGetFolder($cardId) {
$folder = $this->createMock(ISimpleFolder::class);
$this->appData->expects($this->once())
->method('getFolder')
diff --git a/tests/unit/Service/LabelServiceTest.php b/tests/unit/Service/LabelServiceTest.php
index d7d82a93f..52cc36e4b 100644
--- a/tests/unit/Service/LabelServiceTest.php
+++ b/tests/unit/Service/LabelServiceTest.php
@@ -23,7 +23,6 @@
namespace OCA\Deck\Service;
-
use OCA\Deck\Db\ChangeHelper;
use OCA\Deck\Db\Label;
use OCA\Deck\Db\LabelMapper;
@@ -31,84 +30,83 @@ use Test\TestCase;
class LabelServiceTest extends TestCase {
- /** @var LabelMapper|\PHPUnit\Framework\MockObject\MockObject */
- private $labelMapper;
- /** @var PermissionService|\PHPUnit\Framework\MockObject\MockObject */
- private $permissionService;
- /** @var LabelService */
- private $labelService;
+ /** @var LabelMapper|\PHPUnit\Framework\MockObject\MockObject */
+ private $labelMapper;
+ /** @var PermissionService|\PHPUnit\Framework\MockObject\MockObject */
+ private $permissionService;
+ /** @var LabelService */
+ private $labelService;
/** @var BoardService|\PHPUnit\Framework\MockObject\MockObject */
private $boardService;
/** @var ChangeHelper|\PHPUnit\Framework\MockObject\MockObject */
private $changeHelper;
- public function setUp(): void {
+ public function setUp(): void {
parent::setUp();
- $this->labelMapper = $this->getMockBuilder(LabelMapper::class)
- ->disableOriginalConstructor()->getMock();
- $this->permissionService = $this->getMockBuilder(PermissionService::class)
- ->disableOriginalConstructor()->getMock();
- $this->boardService = $this->createMock(BoardService::class);
- $this->changeHelper = $this->createMock(ChangeHelper::class);
- $this->labelService = new LabelService(
- $this->labelMapper,
- $this->permissionService,
+ $this->labelMapper = $this->getMockBuilder(LabelMapper::class)
+ ->disableOriginalConstructor()->getMock();
+ $this->permissionService = $this->getMockBuilder(PermissionService::class)
+ ->disableOriginalConstructor()->getMock();
+ $this->boardService = $this->createMock(BoardService::class);
+ $this->changeHelper = $this->createMock(ChangeHelper::class);
+ $this->labelService = new LabelService(
+ $this->labelMapper,
+ $this->permissionService,
$this->boardService,
$this->changeHelper
- );
- }
+ );
+ }
- public function testFind() {
- $this->labelMapper->expects($this->once())->method('find')->willReturn(true);
- $this->assertTrue($this->labelService->find(123));
- }
+ public function testFind() {
+ $this->labelMapper->expects($this->once())->method('find')->willReturn(true);
+ $this->assertTrue($this->labelService->find(123));
+ }
- public function testCreate() {
- $label = new Label();
- $label->setTitle('Label title');
- $label->setBoardId(123);
- $label->setColor('00ff00');
- $this->labelMapper->expects($this->once())
- ->method('insert')
- ->willReturn($label);
- $b = $this->labelService->create('Label title', '00ff00', 123);
+ public function testCreate() {
+ $label = new Label();
+ $label->setTitle('Label title');
+ $label->setBoardId(123);
+ $label->setColor('00ff00');
+ $this->labelMapper->expects($this->once())
+ ->method('insert')
+ ->willReturn($label);
+ $b = $this->labelService->create('Label title', '00ff00', 123);
- $this->assertEquals($b->getTitle(), 'Label title');
- $this->assertEquals($b->getBoardId(), 123);
- $this->assertEquals($b->getColor(), '00ff00');
- }
+ $this->assertEquals($b->getTitle(), 'Label title');
+ $this->assertEquals($b->getBoardId(), 123);
+ $this->assertEquals($b->getColor(), '00ff00');
+ }
- public function testUpdate() {
- $label = new Label();
- $label->setTitle('Title');
- $label->setBoardId(123);
- $label->setColor('00ff00');
- $this->labelMapper->expects($this->once())
- ->method('find')
- ->with(1)
- ->willReturn($label);
- $this->labelMapper->expects($this->once())
- ->method('update')
- ->with($label)
- ->willReturn($label);
- $b = $this->labelService->update(1, 'NewTitle', 'ffffff');
+ public function testUpdate() {
+ $label = new Label();
+ $label->setTitle('Title');
+ $label->setBoardId(123);
+ $label->setColor('00ff00');
+ $this->labelMapper->expects($this->once())
+ ->method('find')
+ ->with(1)
+ ->willReturn($label);
+ $this->labelMapper->expects($this->once())
+ ->method('update')
+ ->with($label)
+ ->willReturn($label);
+ $b = $this->labelService->update(1, 'NewTitle', 'ffffff');
- $this->assertEquals($b->getTitle(), 'NewTitle');
- $this->assertEquals($b->getBoardId(), 123);
- $this->assertEquals($b->getColor(), 'ffffff');
- }
+ $this->assertEquals($b->getTitle(), 'NewTitle');
+ $this->assertEquals($b->getBoardId(), 123);
+ $this->assertEquals($b->getColor(), 'ffffff');
+ }
- public function testDelete() {
+ public function testDelete() {
$label = new Label();
$label->setId(1);
- $this->labelMapper->expects($this->once())
- ->method('find')
- ->willReturn($label);
- $this->labelMapper->expects($this->once())
- ->method('delete')
- ->willReturn($label);
- $this->assertEquals($label, $this->labelService->delete(1));
- }
-
+ $this->labelMapper->expects($this->once())
+ ->method('find')
+ ->willReturn($label);
+ $this->labelMapper->expects($this->once())
+ ->method('delete')
+ ->willReturn($label);
+ $this->assertEquals($label, $this->labelService->delete(1));
+ }
}
diff --git a/tests/unit/Service/PermissionServiceTest.php b/tests/unit/Service/PermissionServiceTest.php
index cb0fc9307..737237e9f 100644
--- a/tests/unit/Service/PermissionServiceTest.php
+++ b/tests/unit/Service/PermissionServiceTest.php
@@ -43,15 +43,15 @@ class PermissionServiceTest extends \Test\TestCase {
/** @var PermissionService*/
private $service;
- /** @var ILogger */
+ /** @var ILogger */
private $logger;
/** @var AclMapper */
private $aclMapper;
- /** @var BoardMapper */
- private $boardMapper;
- /** @var IUserManager */
- private $userManager;
- /** @var IGroupManager */
+ /** @var BoardMapper */
+ private $boardMapper;
+ /** @var IUserManager */
+ private $userManager;
+ /** @var IGroupManager */
private $groupManager;
/** @var IManager */
private $shareManager;
@@ -176,135 +176,133 @@ class PermissionServiceTest extends \Test\TestCase {
$this->assertEquals($canEdit, $this->service->userCan($acls, Acl::PERMISSION_EDIT));
$this->assertEquals($canShare, $this->service->userCan($acls, Acl::PERMISSION_SHARE));
$this->assertEquals($canManage, $this->service->userCan($acls, Acl::PERMISSION_MANAGE));
- }
+ }
public function testUserCanFail() {
$this->assertFalse($this->service->userCan([], Acl::PERMISSION_EDIT));
}
- public function dataCheckPermission() {
- return [
- // see getAcls() for set permissions
- [1, Acl::PERMISSION_READ, true],
- [1, Acl::PERMISSION_EDIT, false],
- [1, Acl::PERMISSION_MANAGE, false],
- [1, Acl::PERMISSION_SHARE, false],
+ public function dataCheckPermission() {
+ return [
+ // see getAcls() for set permissions
+ [1, Acl::PERMISSION_READ, true],
+ [1, Acl::PERMISSION_EDIT, false],
+ [1, Acl::PERMISSION_MANAGE, false],
+ [1, Acl::PERMISSION_SHARE, false],
- [2, Acl::PERMISSION_READ, true],
- [2, Acl::PERMISSION_EDIT, true],
- [2, Acl::PERMISSION_MANAGE, false],
- [2, Acl::PERMISSION_SHARE, false],
+ [2, Acl::PERMISSION_READ, true],
+ [2, Acl::PERMISSION_EDIT, true],
+ [2, Acl::PERMISSION_MANAGE, false],
+ [2, Acl::PERMISSION_SHARE, false],
- [3, Acl::PERMISSION_READ, true],
- [3, Acl::PERMISSION_EDIT, false],
- [3, Acl::PERMISSION_MANAGE, true],
- [3, Acl::PERMISSION_SHARE, false],
+ [3, Acl::PERMISSION_READ, true],
+ [3, Acl::PERMISSION_EDIT, false],
+ [3, Acl::PERMISSION_MANAGE, true],
+ [3, Acl::PERMISSION_SHARE, false],
- [4, Acl::PERMISSION_READ, true],
- [4, Acl::PERMISSION_EDIT, false],
- [4, Acl::PERMISSION_MANAGE, false],
- [4, Acl::PERMISSION_SHARE, true],
+ [4, Acl::PERMISSION_READ, true],
+ [4, Acl::PERMISSION_EDIT, false],
+ [4, Acl::PERMISSION_MANAGE, false],
+ [4, Acl::PERMISSION_SHARE, true],
- [null, Acl::PERMISSION_READ, false],
- [6, Acl::PERMISSION_READ, false],
+ [null, Acl::PERMISSION_READ, false],
+ [6, Acl::PERMISSION_READ, false],
- [1, Acl::PERMISSION_READ, true, 'admin'],
- [1, Acl::PERMISSION_EDIT, true, 'admin'],
- [1, Acl::PERMISSION_MANAGE, true, 'admin'],
- [1, Acl::PERMISSION_SHARE, true, 'admin'],
- ];
- }
+ [1, Acl::PERMISSION_READ, true, 'admin'],
+ [1, Acl::PERMISSION_EDIT, true, 'admin'],
+ [1, Acl::PERMISSION_MANAGE, true, 'admin'],
+ [1, Acl::PERMISSION_SHARE, true, 'admin'],
+ ];
+ }
/** @dataProvider dataCheckPermission */
public function testCheckPermission($boardId, $permission, $result, $owner='foo') {
- // Setup mapper
- $mapper = $this->getMockBuilder(IPermissionMapper::class)->getMock();
+ // Setup mapper
+ $mapper = $this->getMockBuilder(IPermissionMapper::class)->getMock();
- // board owner
- $mapper->expects($this->once())->method('findBoardId')->willReturn($boardId);
- $board = new Board();
- $board->setId($boardId);
- $board->setOwner($owner);
- $this->boardMapper->expects($this->any())->method('find')->willReturn($board);
+ // board owner
+ $mapper->expects($this->once())->method('findBoardId')->willReturn($boardId);
+ $board = new Board();
+ $board->setId($boardId);
+ $board->setOwner($owner);
+ $this->boardMapper->expects($this->any())->method('find')->willReturn($board);
- // acl check
- $acls = $this->getAcls($boardId);
- $this->aclMapper->expects($this->any())->method('findAll')->willReturn($acls);
+ // acl check
+ $acls = $this->getAcls($boardId);
+ $this->aclMapper->expects($this->any())->method('findAll')->willReturn($acls);
- $this->shareManager->expects($this->any())
+ $this->shareManager->expects($this->any())
->method('sharingDisabledForUser')
->willReturn(false);
- if($result) {
- $actual = $this->service->checkPermission($mapper, 1234, $permission);
- $this->assertTrue($actual);
- } else {
- $this->expectException(NoPermissionException::class);
- $this->service->checkPermission($mapper, 1234, $permission);
- }
+ if ($result) {
+ $actual = $this->service->checkPermission($mapper, 1234, $permission);
+ $this->assertTrue($actual);
+ } else {
+ $this->expectException(NoPermissionException::class);
+ $this->service->checkPermission($mapper, 1234, $permission);
+ }
+ }
- }
-
- /** @dataProvider dataCheckPermission */
- public function testCheckPermissionWithoutMapper($boardId, $permission, $result, $owner='foo') {
- $mapper = null;
- $board = new Board();
- $board->setId($boardId);
- $board->setOwner($owner);
- if($boardId === null) {
- $this->boardMapper->expects($this->any())->method('find')->willThrowException(new DoesNotExistException('not found'));
- } else {
- $this->boardMapper->expects($this->any())->method('find')->willReturn($board);
- }
- $acls = $this->getAcls($boardId);
- $this->aclMapper->expects($this->any())->method('findAll')->willReturn($acls);
+ /** @dataProvider dataCheckPermission */
+ public function testCheckPermissionWithoutMapper($boardId, $permission, $result, $owner='foo') {
+ $mapper = null;
+ $board = new Board();
+ $board->setId($boardId);
+ $board->setOwner($owner);
+ if ($boardId === null) {
+ $this->boardMapper->expects($this->any())->method('find')->willThrowException(new DoesNotExistException('not found'));
+ } else {
+ $this->boardMapper->expects($this->any())->method('find')->willReturn($board);
+ }
+ $acls = $this->getAcls($boardId);
+ $this->aclMapper->expects($this->any())->method('findAll')->willReturn($acls);
- if($result) {
- $actual = $this->service->checkPermission($mapper, 1234, $permission);
- $this->assertTrue($actual);
- } else {
- $this->expectException(NoPermissionException::class);
- $this->service->checkPermission($mapper, 1234, $permission);
- }
+ if ($result) {
+ $actual = $this->service->checkPermission($mapper, 1234, $permission);
+ $this->assertTrue($actual);
+ } else {
+ $this->expectException(NoPermissionException::class);
+ $this->service->checkPermission($mapper, 1234, $permission);
+ }
+ }
- }
-
- public function testCheckPermissionNotFound() {
- $mapper = $this->getMockBuilder(IPermissionMapper::class)->getMock();
- $mapper->expects($this->once())->method('findBoardId')->willThrowException(new NoPermissionException(null));
+ public function testCheckPermissionNotFound() {
+ $mapper = $this->getMockBuilder(IPermissionMapper::class)->getMock();
+ $mapper->expects($this->once())->method('findBoardId')->willThrowException(new NoPermissionException(null));
$this->expectException(NoPermissionException::class);
- $this->service->checkPermission($mapper, 1234, Acl::PERMISSION_READ);
- }
+ $this->service->checkPermission($mapper, 1234, Acl::PERMISSION_READ);
+ }
- private function generateAcl($boardId, $type, $participant, $edit, $manage, $share) {
- $acl = new Acl();
- $acl->setParticipant($participant);
- $acl->setBoardId($boardId);
- $acl->setType($type);
- $acl->setPermissionEdit($edit);
- $acl->setPermissionShare($share);
- $acl->setPermissionManage($manage);
- return $acl;
- }
+ private function generateAcl($boardId, $type, $participant, $edit, $manage, $share) {
+ $acl = new Acl();
+ $acl->setParticipant($participant);
+ $acl->setBoardId($boardId);
+ $acl->setType($type);
+ $acl->setPermissionEdit($edit);
+ $acl->setPermissionShare($share);
+ $acl->setPermissionManage($manage);
+ return $acl;
+ }
- private function getAcls($boardId) {
- $acls = [
- $this->generateAcl(1, 'user', 'admin', false, false, false),
- $this->generateAcl(2, 'user', 'admin', true, false, false),
- $this->generateAcl(3, 'user', 'admin', false, true, false),
- $this->generateAcl(4, 'user', 'admin', false, false, true),
- $this->generateAcl(5, 'group', 'admin', false, false, false),
- $this->generateAcl(6, 'user', 'foo', false, false, false)
- ];
- $result = [];
- foreach ($acls as $acl) {
- if($acl->getBoardId() === $boardId) {
- $result[] = $acl;
- }
- }
- return $result;
- }
+ private function getAcls($boardId) {
+ $acls = [
+ $this->generateAcl(1, 'user', 'admin', false, false, false),
+ $this->generateAcl(2, 'user', 'admin', true, false, false),
+ $this->generateAcl(3, 'user', 'admin', false, true, false),
+ $this->generateAcl(4, 'user', 'admin', false, false, true),
+ $this->generateAcl(5, 'group', 'admin', false, false, false),
+ $this->generateAcl(6, 'user', 'foo', false, false, false)
+ ];
+ $result = [];
+ foreach ($acls as $acl) {
+ if ($acl->getBoardId() === $boardId) {
+ $result[] = $acl;
+ }
+ }
+ return $result;
+ }
public function testFindUsersFail() {
$this->boardMapper->expects($this->once())
@@ -374,5 +372,4 @@ class PermissionServiceTest extends \Test\TestCase {
'user3' => new User($user3),
], $users);
}
-
}
diff --git a/tests/unit/Service/StackServiceTest.php b/tests/unit/Service/StackServiceTest.php
index 38984216f..0ec5567ca 100644
--- a/tests/unit/Service/StackServiceTest.php
+++ b/tests/unit/Service/StackServiceTest.php
@@ -23,8 +23,6 @@
namespace OCA\Deck\Service;
-
-
use OCA\Deck\Activity\ActivityManager;
use OCA\Deck\Db\AssignedUsersMapper;
use OCA\Deck\Db\Card;
@@ -46,17 +44,17 @@ use \Test\TestCase;
*/
class StackServiceTest extends TestCase {
- /** @var StackService */
+ /** @var StackService */
private $stackService;
- /** @var \PHPUnit\Framework\MockObject\MockObject|StackMapper */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|StackMapper */
private $stackMapper;
- /** @var \PHPUnit\Framework\MockObject\MockObject|CardMapper */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|CardMapper */
private $cardMapper;
- /** @var \PHPUnit\Framework\MockObject\MockObject|BoardMapper */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|BoardMapper */
private $boardMapper;
- /** @var \PHPUnit\Framework\MockObject\MockObject|LabelMapper */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|LabelMapper */
private $labelMapper;
- /** @var \PHPUnit\Framework\MockObject\MockObject|PermissionService */
+ /** @var \PHPUnit\Framework\MockObject\MockObject|PermissionService */
private $permissionService;
/** @var AssignedUsersMapper|\PHPUnit\Framework\MockObject\MockObject */
private $assignedUsersMapper;
@@ -105,89 +103,89 @@ class StackServiceTest extends TestCase {
}
public function testFindAll() {
- $this->permissionService->expects($this->once())->method('checkPermission');
- $this->stackMapper->expects($this->once())->method('findAll')->willReturn($this->getStacks());
- $this->cardService->expects($this->atLeastOnce())->method('enrich')->will(
+ $this->permissionService->expects($this->once())->method('checkPermission');
+ $this->stackMapper->expects($this->once())->method('findAll')->willReturn($this->getStacks());
+ $this->cardService->expects($this->atLeastOnce())->method('enrich')->will(
$this->returnCallback(
- function($card) {
+ function ($card) {
$card->setLabels($this->getLabels()[$card->getId()]);
}
)
);
- $this->cardMapper->expects($this->any())->method('findAll')->willReturn($this->getCards(222));
+ $this->cardMapper->expects($this->any())->method('findAll')->willReturn($this->getCards(222));
- $actual = $this->stackService->findAll(123);
- for($stackId=0; $stackId<3; $stackId++) {
- for ($cardId=0;$cardId<10;$cardId++) {
- $this->assertEquals($actual[0]->getCards()[$cardId]->getId(), $cardId);
- $this->assertEquals($actual[0]->getCards()[$cardId]->getStackId(), 222);
- $this->assertEquals($actual[0]->getCards()[$cardId]->getLabels(), $this->getLabels()[$cardId]);
- }
- }
- }
+ $actual = $this->stackService->findAll(123);
+ for ($stackId=0; $stackId<3; $stackId++) {
+ for ($cardId=0;$cardId<10;$cardId++) {
+ $this->assertEquals($actual[0]->getCards()[$cardId]->getId(), $cardId);
+ $this->assertEquals($actual[0]->getCards()[$cardId]->getStackId(), 222);
+ $this->assertEquals($actual[0]->getCards()[$cardId]->getLabels(), $this->getLabels()[$cardId]);
+ }
+ }
+ }
- public function testFindAllArchived() {
- $this->permissionService->expects($this->once())->method('checkPermission');
- $this->stackMapper->expects($this->once())->method('findAll')->willReturn($this->getStacks());
- $this->labelMapper->expects($this->once())->method('getAssignedLabelsForBoard')->willReturn($this->getLabels());
- $this->cardMapper->expects($this->any())->method('findAllArchived')->willReturn($this->getCards(222));
+ public function testFindAllArchived() {
+ $this->permissionService->expects($this->once())->method('checkPermission');
+ $this->stackMapper->expects($this->once())->method('findAll')->willReturn($this->getStacks());
+ $this->labelMapper->expects($this->once())->method('getAssignedLabelsForBoard')->willReturn($this->getLabels());
+ $this->cardMapper->expects($this->any())->method('findAllArchived')->willReturn($this->getCards(222));
- $actual = $this->stackService->findAllArchived(123);
- for($stackId=0; $stackId<3; $stackId++) {
- for ($cardId=0;$cardId<10;$cardId++) {
- $this->assertEquals($actual[0]->getCards()[$cardId]->getId(), $cardId);
- $this->assertEquals($actual[0]->getCards()[$cardId]->getStackId(), 222);
- $this->assertEquals($actual[0]->getCards()[$cardId]->getLabels(), $this->getLabels()[$cardId]);
- }
- }
-}
+ $actual = $this->stackService->findAllArchived(123);
+ for ($stackId=0; $stackId<3; $stackId++) {
+ for ($cardId=0;$cardId<10;$cardId++) {
+ $this->assertEquals($actual[0]->getCards()[$cardId]->getId(), $cardId);
+ $this->assertEquals($actual[0]->getCards()[$cardId]->getStackId(), 222);
+ $this->assertEquals($actual[0]->getCards()[$cardId]->getLabels(), $this->getLabels()[$cardId]);
+ }
+ }
+ }
- private function getLabels() {
- for ($i=0;$i<10;$i++) {
- $label1 = new Label();
- $label1->setTitle('Important');
- $label1->setCardId(1);
- $label2 = new Label();
- $label2->setTitle('Maybe');
- $label2->setCardId(2);
- $labels[$i] = [
- $label1,
- $label2
- ];
- }
- return $labels;
- }
- private function getStacks() {
- $s1 = new Stack();
- $s1->setId(222);
- $s1->setBoardId(1);
- $s2 = new Stack();
- $s2->setId(223);
- $s1->setBoardId(1);
- return [$s1, $s2];
- }
- private function getCards($stackId=0) {
- $cards = [];
- for ($i=0;$i<10;$i++) {
- $cards[$i] = new Card();
- $cards[$i]->setId($i);
- $cards[$i]->setStackId($stackId);
- }
- return $cards;
- }
+ private function getLabels() {
+ for ($i=0;$i<10;$i++) {
+ $label1 = new Label();
+ $label1->setTitle('Important');
+ $label1->setCardId(1);
+ $label2 = new Label();
+ $label2->setTitle('Maybe');
+ $label2->setCardId(2);
+ $labels[$i] = [
+ $label1,
+ $label2
+ ];
+ }
+ return $labels;
+ }
+ private function getStacks() {
+ $s1 = new Stack();
+ $s1->setId(222);
+ $s1->setBoardId(1);
+ $s2 = new Stack();
+ $s2->setId(223);
+ $s1->setBoardId(1);
+ return [$s1, $s2];
+ }
+ private function getCards($stackId=0) {
+ $cards = [];
+ for ($i=0;$i<10;$i++) {
+ $cards[$i] = new Card();
+ $cards[$i]->setId($i);
+ $cards[$i]->setStackId($stackId);
+ }
+ return $cards;
+ }
- public function testCreate() {
- $this->permissionService->expects($this->once())->method('checkPermission');
- $stack = new Stack();
- $stack->setId(123);
- $stack->setTitle('Foo');
- $stack->setBoardId(2);
- $stack->setOrder(1);
- $this->stackMapper->expects($this->once())->method('insert')->willReturn($stack);
- $result = $this->stackService->create('Foo', 2, 1);
- $this->assertEquals($stack, $result);
- }
+ public function testCreate() {
+ $this->permissionService->expects($this->once())->method('checkPermission');
+ $stack = new Stack();
+ $stack->setId(123);
+ $stack->setTitle('Foo');
+ $stack->setBoardId(2);
+ $stack->setOrder(1);
+ $this->stackMapper->expects($this->once())->method('insert')->willReturn($stack);
+ $result = $this->stackService->create('Foo', 2, 1);
+ $this->assertEquals($stack, $result);
+ }
public function testDelete() {
$this->permissionService->expects($this->once())->method('checkPermission');
@@ -199,26 +197,25 @@ class StackServiceTest extends TestCase {
$this->stackService->delete(123);
$this->assertTrue($stackToBeDeleted->getDeletedAt() <= time(), "deletedAt is in the past");
$this->assertTrue($stackToBeDeleted->getDeletedAt() > 0, "deletedAt is set");
-
}
- public function testUpdate() {
- $this->permissionService->expects($this->once())->method('checkPermission');
- $stack = new Stack();
- $this->stackMapper->expects($this->once())->method('find')->willReturn($stack);
- $this->stackMapper->expects($this->once())->method('update')->willReturn($stack);
- $stack->setId(123);
- $stack->setTitle('Foo');
- $stack->setBoardId(2);
- $stack->setOrder(1);
- $result = $this->stackService->update(123, 'Foo', 2, 1, null);
- $this->assertEquals($stack, $result);
- }
+ public function testUpdate() {
+ $this->permissionService->expects($this->once())->method('checkPermission');
+ $stack = new Stack();
+ $this->stackMapper->expects($this->once())->method('find')->willReturn($stack);
+ $this->stackMapper->expects($this->once())->method('update')->willReturn($stack);
+ $stack->setId(123);
+ $stack->setTitle('Foo');
+ $stack->setBoardId(2);
+ $stack->setOrder(1);
+ $result = $this->stackService->update(123, 'Foo', 2, 1, null);
+ $this->assertEquals($stack, $result);
+ }
/**
* @group DB
*/
- public function testReorder() {
+ public function testReorder() {
$this->permissionService->expects($this->once())->method('checkPermission');
$a = $this->createStack(1, 0);
$b = $this->createStack(2, 1);
@@ -245,5 +242,4 @@ class StackServiceTest extends TestCase {
$stack->setOrder($order);
return $stack;
}
-
}
diff --git a/tests/unit/controller/AttachmentApiControllerTest.php b/tests/unit/controller/AttachmentApiControllerTest.php
index 871c57fa2..a7e5c2a4b 100644
--- a/tests/unit/controller/AttachmentApiControllerTest.php
+++ b/tests/unit/controller/AttachmentApiControllerTest.php
@@ -30,143 +30,139 @@ use OCA\Deck\Service\AttachmentService;
use OCA\Deck\Db\Attachment;
class AttachmentApiControllerTest extends \Test\TestCase {
+ private $appName = 'deck';
+ private $controller;
+ private $request;
+ private $attachmentExample;
+ private $cardId;
+ private $attachmentService;
- private $appName = 'deck';
- private $controller;
- private $request;
- private $attachmentExample;
- private $cardId;
- private $attachmentService;
+ public function setUp(): void {
+ parent::setUp();
+ $this->attachmentExample = new Attachment();
+ $this->attachmentExample->setId(1);
+ $this->cardId = 1;
+ $this->request = $this->createMock(IRequest::class);
+ $this->attachmentService = $this->createMock(AttachmentService::class);
+ $this->controller = new AttachmentApiController(
+ $this->appName,
+ $this->request,
+ $this->attachmentService
+ );
+ }
- public function setUp(): void {
- parent::setUp();
- $this->attachmentExample = new Attachment();
- $this->attachmentExample->setId(1);
- $this->cardId = 1;
- $this->request = $this->createMock(IRequest::class);
- $this->attachmentService = $this->createMock(AttachmentService::class);
- $this->controller = new AttachmentApiController(
- $this->appName,
- $this->request,
- $this->attachmentService
- );
- }
+ public function testGetAll() {
+ $allAttachments = [$this->attachmentExample];
- public function testGetAll() {
+ $this->attachmentService->expects($this->once())
+ ->method('findAll')
+ ->willReturn($allAttachments);
- $allAttachments = [$this->attachmentExample];
+ $this->request->expects($this->once())
+ ->method('getParam')
+ ->with('cardId')
+ ->willReturn($allAttachments);
- $this->attachmentService->expects($this->once())
- ->method('findAll')
- ->willReturn($allAttachments);
+ $expected = new DataResponse($allAttachments, HTTP::STATUS_OK);
+ $actual = $this->controller->getAll();
+ $this->assertEquals($expected, $actual);
+ }
- $this->request->expects($this->once())
- ->method('getParam')
- ->with('cardId')
- ->willReturn($allAttachments);
+ public function testDisplay() {
+ $this->attachmentService->expects($this->once())
+ ->method('display')
+ ->willReturn($this->attachmentExample);
- $expected = new DataResponse($allAttachments, HTTP::STATUS_OK);
- $actual = $this->controller->getAll();
- $this->assertEquals($expected, $actual);
- }
+ $this->request->expects($this->exactly(2))
+ ->method('getParam')
+ ->withConsecutive(
+ ['cardId'],
+ ['attachmentId']
+ )->willReturnonConsecutiveCalls(
+ $this->cardId,
+ $this->attachmentExample->getId());
- public function testDisplay() {
+ $expected = $this->attachmentExample;
+ $actual = $this->controller->display();
+ $this->assertEquals($expected, $actual);
+ }
- $this->attachmentService->expects($this->once())
- ->method('display')
- ->willReturn($this->attachmentExample);
+ public function testCreate() {
+ $type = 'not null';
+ $data = ['not null'];
- $this->request->expects($this->exactly(2))
- ->method('getParam')
- ->withConsecutive(
- ['cardId'],
- ['attachmentId']
- )->willReturnonConsecutiveCalls(
- $this->cardId,
- $this->attachmentExample->getId());
+ $this->attachmentService->expects($this->once())
+ ->method('create')
+ ->willReturn($this->attachmentExample);
- $expected = $this->attachmentExample;
- $actual = $this->controller->display();
- $this->assertEquals($expected, $actual);
- }
+ $this->request->expects($this->once())
+ ->method('getParam')
+ ->with('cardId')
+ ->willReturn($this->cardId);
- public function testCreate() {
+ $expected = new DataResponse($this->attachmentExample, HTTP::STATUS_OK);
+ $actual = $this->controller->create($type, $data);
+ $this->assertEquals($expected, $actual);
+ }
- $type = 'not null';
- $data = ['not null'];
+ public function testUpdate() {
- $this->attachmentService->expects($this->once())
- ->method('create')
- ->willReturn($this->attachmentExample);
+ // FIXME: what is data supposed to be in this context?
+ $data = ['not empty data'];
- $this->request->expects($this->once())
- ->method('getParam')
- ->with('cardId')
- ->willReturn($this->cardId);
+ $this->attachmentService->expects($this->once())
+ ->method('update')
+ ->willReturn($this->attachmentExample);
- $expected = new DataResponse($this->attachmentExample, HTTP::STATUS_OK);
- $actual = $this->controller->create($type, $data);
- $this->assertEquals($expected, $actual);
- }
+ $this->request->expects($this->exactly(2))
+ ->method('getParam')
+ ->withConsecutive(
+ ['cardId'],
+ ['attachmentId']
+ )->willReturnonConsecutiveCalls(
+ $this->cardId,
+ $this->attachmentExample->getId());
- public function testUpdate() {
+ $expected = new DataResponse($this->attachmentExample, HTTP::STATUS_OK);
+ $actual = $this->controller->update($data);
+ $this->assertEquals($expected, $actual);
+ }
- // FIXME: what is data supposed to be in this context?
- $data = ['not empty data'];
+ public function testDelete() {
+ $this->attachmentService->expects($this->once())
+ ->method('delete')
+ ->willReturn($this->attachmentExample);
- $this->attachmentService->expects($this->once())
- ->method('update')
- ->willReturn($this->attachmentExample);
+ $this->request->expects($this->exactly(2))
+ ->method('getParam')
+ ->withConsecutive(
+ ['cardId'],
+ ['attachmentId']
+ )->willReturnonConsecutiveCalls(
+ $this->cardId,
+ $this->attachmentExample->getId());
- $this->request->expects($this->exactly(2))
- ->method('getParam')
- ->withConsecutive(
- ['cardId'],
- ['attachmentId']
- )->willReturnonConsecutiveCalls(
- $this->cardId,
- $this->attachmentExample->getId());
+ $expected = new DataResponse($this->attachmentExample, HTTP::STATUS_OK);
+ $actual = $this->controller->delete();
+ $this->assertEquals($expected, $actual);
+ }
- $expected = new DataResponse($this->attachmentExample, HTTP::STATUS_OK);
- $actual = $this->controller->update($data);
- $this->assertEquals($expected, $actual);
- }
+ public function testRestore() {
+ $this->attachmentService->expects($this->once())
+ ->method('restore')
+ ->willReturn($this->attachmentExample);
- public function testDelete() {
- $this->attachmentService->expects($this->once())
- ->method('delete')
- ->willReturn($this->attachmentExample);
+ $this->request->expects($this->exactly(2))
+ ->method('getParam')
+ ->withConsecutive(
+ ['cardId'],
+ ['attachmentId']
+ )->willReturnonConsecutiveCalls(
+ $this->cardId,
+ $this->attachmentExample->getId());
- $this->request->expects($this->exactly(2))
- ->method('getParam')
- ->withConsecutive(
- ['cardId'],
- ['attachmentId']
- )->willReturnonConsecutiveCalls(
- $this->cardId,
- $this->attachmentExample->getId());
-
- $expected = new DataResponse($this->attachmentExample, HTTP::STATUS_OK);
- $actual = $this->controller->delete();
- $this->assertEquals($expected, $actual);
- }
-
- public function testRestore() {
- $this->attachmentService->expects($this->once())
- ->method('restore')
- ->willReturn($this->attachmentExample);
-
- $this->request->expects($this->exactly(2))
- ->method('getParam')
- ->withConsecutive(
- ['cardId'],
- ['attachmentId']
- )->willReturnonConsecutiveCalls(
- $this->cardId,
- $this->attachmentExample->getId());
-
- $expected = new DataResponse($this->attachmentExample, HTTP::STATUS_OK);
- $actual = $this->controller->restore();
- $this->assertEquals($expected, $actual);
- }
+ $expected = new DataResponse($this->attachmentExample, HTTP::STATUS_OK);
+ $actual = $this->controller->restore();
+ $this->assertEquals($expected, $actual);
+ }
}
diff --git a/tests/unit/controller/AttachmentControllerTest.php b/tests/unit/controller/AttachmentControllerTest.php
index ddb830eeb..5bdc29bdb 100644
--- a/tests/unit/controller/AttachmentControllerTest.php
+++ b/tests/unit/controller/AttachmentControllerTest.php
@@ -23,21 +23,17 @@
namespace OCA\Deck\Controller;
-use OCA\Deck\Db\Acl;
use OCA\Deck\Service\AttachmentService;
-use OCA\Deck\Service\CardService;
-use OCA\Deck\Service\LabelService;
-use OCA\Deck\Service\StackService;
use OCP\AppFramework\Controller;
use OCP\IRequest;
class AttachmentControllerTest extends \Test\TestCase {
- /** @var Controller|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject */
private $controller;
- /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
- private $request;
- /** @var AttachmentService|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
+ private $request;
+ /** @var AttachmentService|\PHPUnit\Framework\MockObject\MockObject */
private $attachmentService;
/** @var string */
private $userId = 'user';
@@ -49,19 +45,19 @@ class AttachmentControllerTest extends \Test\TestCase {
'deck',
$this->request,
$this->attachmentService,
- $this->userId
- );
+ $this->userId
+ );
}
- public function testGetAll() {
- $this->attachmentService->expects($this->once())->method('findAll')->with(1);
- $this->controller->getAll(1);
- }
+ public function testGetAll() {
+ $this->attachmentService->expects($this->once())->method('findAll')->with(1);
+ $this->controller->getAll(1);
+ }
- public function testDisplay() {
- $this->attachmentService->expects($this->once())->method('display')->with(1, 2);
- $this->controller->display(1, 2);
- }
+ public function testDisplay() {
+ $this->attachmentService->expects($this->once())->method('display')->with(1, 2);
+ $this->controller->display(1, 2);
+ }
public function testCreate() {
$this->request->expects($this->exactly(2))
@@ -101,5 +97,4 @@ class AttachmentControllerTest extends \Test\TestCase {
->willReturn(1);
$this->assertEquals(1, $this->controller->restore(123, 234));
}
-
}
diff --git a/tests/unit/controller/BoardApiControllerTest.php b/tests/unit/controller/BoardApiControllerTest.php
index 72d7d450d..1f63acf4f 100644
--- a/tests/unit/controller/BoardApiControllerTest.php
+++ b/tests/unit/controller/BoardApiControllerTest.php
@@ -30,7 +30,6 @@ use OCA\Deck\Service\BoardService;
use OCA\Deck\Db\Board;
class BoardApiControllerTest extends \Test\TestCase {
-
private $appName = 'deck';
private $userId = 'admin';
private $controller;
diff --git a/tests/unit/controller/BoardControllerTest.php b/tests/unit/controller/BoardControllerTest.php
index 3321e0e3b..d9dffb928 100644
--- a/tests/unit/controller/BoardControllerTest.php
+++ b/tests/unit/controller/BoardControllerTest.php
@@ -27,7 +27,6 @@ use OCA\Deck\Db\Acl;
use OCP\IUser;
class BoardControllerTest extends \Test\TestCase {
-
private $controller;
private $request;
private $userManager;
diff --git a/tests/unit/controller/CardApiControllerTest.php b/tests/unit/controller/CardApiControllerTest.php
index 7299da9dc..e4980a834 100644
--- a/tests/unit/controller/CardApiControllerTest.php
+++ b/tests/unit/controller/CardApiControllerTest.php
@@ -31,7 +31,6 @@ use OCA\Deck\Db\Card;
use OCA\Deck\Service\CardService;
class CardApiControllerTest extends \Test\TestCase {
-
private $controller;
private $request;
private $cardService;
@@ -50,7 +49,7 @@ class CardApiControllerTest extends \Test\TestCase {
$this->cardExample['id'] = 1;
$this->stackExample['id'] = 1;
- $this->controller = new CardApiController (
+ $this->controller = new CardApiController(
$appName = 'deck',
$this->request,
$this->cardService,
@@ -78,7 +77,6 @@ class CardApiControllerTest extends \Test\TestCase {
}
public function testCreate() {
-
$card = new Card();
$card->setId($this->cardExample['id']);
$card->setStackId($this->stackExample['id']);
@@ -121,7 +119,6 @@ class CardApiControllerTest extends \Test\TestCase {
}
public function testDelete() {
-
$card = new Card();
$card->setId($this->cardExample['id']);
@@ -138,5 +135,4 @@ class CardApiControllerTest extends \Test\TestCase {
$actual = $this->controller->delete();
$this->assertEquals($expected, $actual);
}
-
}
diff --git a/tests/unit/controller/CardControllerTest.php b/tests/unit/controller/CardControllerTest.php
index 53f73ff25..6a8f87a7f 100644
--- a/tests/unit/controller/CardControllerTest.php
+++ b/tests/unit/controller/CardControllerTest.php
@@ -31,11 +31,11 @@ use Test\TestCase;
class CardControllerTest extends TestCase {
- /** @var CardController|MockObject */
+ /** @var CardController|MockObject */
private $controller;
- /** @var IRequest|MockObject */
- private $request;
- /** @var CardService|MockObject */
+ /** @var IRequest|MockObject */
+ private $request;
+ /** @var CardService|MockObject */
private $cardService;
/** @var AssignmentService|MockObject */
private $assignmentService;
@@ -89,31 +89,31 @@ class CardControllerTest extends TestCase {
}
public function testArchive() {
- $this->cardService->expects($this->once())->method('archive')->willReturn(true);
- $this->controller->archive(1);
- }
- public function testUnarchive() {
- $this->cardService->expects($this->once())->method('unarchive');
- $this->controller->unarchive(1);
- }
- public function testAssignLabel() {
- $this->cardService->expects($this->once())->method('assignLabel');
- $this->controller->assignLabel(1,2);
- }
- public function testRemoveLabel() {
- $this->cardService->expects($this->once())->method('removeLabel');
- $this->controller->removeLabel(1,2);
- }
+ $this->cardService->expects($this->once())->method('archive')->willReturn(true);
+ $this->controller->archive(1);
+ }
+ public function testUnarchive() {
+ $this->cardService->expects($this->once())->method('unarchive');
+ $this->controller->unarchive(1);
+ }
+ public function testAssignLabel() {
+ $this->cardService->expects($this->once())->method('assignLabel');
+ $this->controller->assignLabel(1,2);
+ }
+ public function testRemoveLabel() {
+ $this->cardService->expects($this->once())->method('removeLabel');
+ $this->controller->removeLabel(1,2);
+ }
- public function testReorder() {
- $this->cardService->expects($this->once())->method('reorder');
- $this->controller->reorder(1, 2, 3);
- }
+ public function testReorder() {
+ $this->cardService->expects($this->once())->method('reorder');
+ $this->controller->reorder(1, 2, 3);
+ }
- public function testRename() {
- $this->cardService->expects($this->once())->method('rename');
- $this->controller->rename(1, 'test');
- }
+ public function testRename() {
+ $this->cardService->expects($this->once())->method('rename');
+ $this->controller->rename(1, 'test');
+ }
public function testAssignUser() {
$this->assignmentService->expects($this->once())->method('assignUser');
@@ -124,5 +124,4 @@ class CardControllerTest extends TestCase {
$this->assignmentService->expects($this->once())->method('unassignUser');
$this->controller->unassignUser(1, 'admin');
}
-
}
diff --git a/tests/unit/controller/LabelApiControllerTest.php b/tests/unit/controller/LabelApiControllerTest.php
index 419a16889..a4de3aad4 100644
--- a/tests/unit/controller/LabelApiControllerTest.php
+++ b/tests/unit/controller/LabelApiControllerTest.php
@@ -30,7 +30,6 @@ use OCA\Deck\Db\Label;
use OCA\Deck\Service\LabelService;
class LabelApiControllerTest extends \Test\TestCase {
-
private $controller;
private $request;
private $labelService;
@@ -69,7 +68,6 @@ class LabelApiControllerTest extends \Test\TestCase {
}
public function testCreate() {
-
$label = new Label();
$label->setId($this->exampleLabel['id']);
@@ -88,7 +86,6 @@ class LabelApiControllerTest extends \Test\TestCase {
}
public function testUpdate() {
-
$label = new Label();
$label->setId($this->exampleLabel['id']);
@@ -107,7 +104,6 @@ class LabelApiControllerTest extends \Test\TestCase {
}
public function testDelete() {
-
$label = new Label();
$label->setId($this->exampleLabel['id']);
@@ -124,5 +120,4 @@ class LabelApiControllerTest extends \Test\TestCase {
$actual = $this->controller->delete();
$this->assertEquals($expected, $actual);
}
-
}
diff --git a/tests/unit/controller/LabelControllerTest.php b/tests/unit/controller/LabelControllerTest.php
index dfa9e430e..a66821c9b 100644
--- a/tests/unit/controller/LabelControllerTest.php
+++ b/tests/unit/controller/LabelControllerTest.php
@@ -23,19 +23,17 @@
namespace OCA\Deck\Controller;
-use OCA\Deck\Db\Acl;
-use OCA\Deck\Service\CardService;
use OCA\Deck\Service\LabelService;
use OCP\AppFramework\Controller;
use OCP\IRequest;
class LabelControllerTest extends \Test\TestCase {
- /** @var Controller|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject */
private $controller;
- /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
- private $request;
- /** @var LabelService|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
+ private $request;
+ /** @var LabelService|\PHPUnit\Framework\MockObject\MockObject */
private $labelService;
/** @var string */
private $userId = 'user';
@@ -53,7 +51,7 @@ class LabelControllerTest extends \Test\TestCase {
'deck',
$this->request,
$this->labelService
- );
+ );
}
@@ -80,5 +78,4 @@ class LabelControllerTest extends \Test\TestCase {
->willReturn(1);
$this->assertEquals(1, $this->controller->delete(123));
}
-
}
diff --git a/tests/unit/controller/PageControllerTest.php b/tests/unit/controller/PageControllerTest.php
index 732170798..d84724e4a 100644
--- a/tests/unit/controller/PageControllerTest.php
+++ b/tests/unit/controller/PageControllerTest.php
@@ -28,13 +28,10 @@ use OCA\Deck\Service\PermissionService;
use OCP\IInitialStateService;
use OCP\IL10N;
use OCP\IRequest;
-use PHPUnit_Framework_TestCase;
-use OCA\Deck\Service\DefaultBoardService;
use OCA\Deck\Db\Board;
use OCP\IConfig;
class PageControllerTest extends \Test\TestCase {
-
private $controller;
private $request;
private $l10n;
@@ -56,7 +53,6 @@ class PageControllerTest extends \Test\TestCase {
}
public function testIndex() {
-
$board = new Board();
$board->setTitle('Personal');
$board->setOwner($this->userId);
@@ -69,5 +65,4 @@ class PageControllerTest extends \Test\TestCase {
$response = $this->controller->index();
$this->assertEquals('main', $response->getTemplateName());
}
-
}
diff --git a/tests/unit/controller/StackApiControllerTest.php b/tests/unit/controller/StackApiControllerTest.php
index fd75789e6..64b4ec7e9 100644
--- a/tests/unit/controller/StackApiControllerTest.php
+++ b/tests/unit/controller/StackApiControllerTest.php
@@ -28,11 +28,9 @@ use OCP\IRequest;
use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\StackService;
-use OCA\Deck\Db\Board;
use OCA\Deck\Db\Stack;
class StackApiControllerTest extends \Test\TestCase {
-
private $appName = 'deck';
private $userId = 'admin';
private $controller;
@@ -104,7 +102,6 @@ class StackApiControllerTest extends \Test\TestCase {
}
public function testCreate() {
-
$this->request->expects($this->any())
->method('getParam')
->with('boardId')
@@ -126,7 +123,6 @@ class StackApiControllerTest extends \Test\TestCase {
}
public function testUpdate() {
-
$this->request->expects($this->exactly(2))
->method('getParam')
->withConsecutive(
@@ -151,7 +147,6 @@ class StackApiControllerTest extends \Test\TestCase {
}
public function testDelete() {
-
$stack = new Stack();
$stack->setId($this->exampleStack['id']);
$stack->setBoardId($this->exampleStack['boardId']);
diff --git a/tests/unit/controller/StackControllerTest.php b/tests/unit/controller/StackControllerTest.php
index 0f597bd97..2c19383d3 100644
--- a/tests/unit/controller/StackControllerTest.php
+++ b/tests/unit/controller/StackControllerTest.php
@@ -23,20 +23,17 @@
namespace OCA\Deck\Controller;
-use OCA\Deck\Db\Acl;
-use OCA\Deck\Service\CardService;
-use OCA\Deck\Service\LabelService;
use OCA\Deck\Service\StackService;
use OCP\AppFramework\Controller;
use OCP\IRequest;
class StackControllerTest extends \Test\TestCase {
- /** @var Controller|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var Controller|\PHPUnit\Framework\MockObject\MockObject */
private $controller;
- /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
- private $request;
- /** @var StackService|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IRequest|\PHPUnit\Framework\MockObject\MockObject */
+ private $request;
+ /** @var StackService|\PHPUnit\Framework\MockObject\MockObject */
private $stackService;
/** @var string */
private $userId = 'user';
@@ -54,19 +51,19 @@ class StackControllerTest extends \Test\TestCase {
'deck',
$this->request,
$this->stackService,
- $this->userId
- );
+ $this->userId
+ );
}
- public function testIndex() {
- $this->stackService->expects($this->once())->method('findAll');
- $this->controller->index(1);
- }
+ public function testIndex() {
+ $this->stackService->expects($this->once())->method('findAll');
+ $this->controller->index(1);
+ }
- public function testArchived() {
- $this->stackService->expects($this->once())->method('findAllArchived');
- $this->controller->archived(1);
- }
+ public function testArchived() {
+ $this->stackService->expects($this->once())->method('findAllArchived');
+ $this->controller->archived(1);
+ }
public function testCreate() {
$this->stackService->expects($this->once())
@@ -99,5 +96,4 @@ class StackControllerTest extends \Test\TestCase {
->willReturn(1);
$this->assertEquals(1, $this->controller->delete(123));
}
-
}