Fix tests

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2021-01-04 15:55:42 +01:00
parent 482a679cef
commit 08842d239e
7 changed files with 63 additions and 450 deletions

View File

@@ -118,7 +118,7 @@ class AttachmentService {
/** @var IAttachmentService $service */ /** @var IAttachmentService $service */
$service = $this->getService($attachmentType); $service = $this->getService($attachmentType);
if ($service instanceof ICustomAttachmentService) { if ($service instanceof ICustomAttachmentService) {
$attachments = array_merge($attachments, $service->listAttachments($cardId)); $attachments = array_merge($attachments, $service->listAttachments((int)$cardId));
} }
} }
@@ -151,7 +151,7 @@ class AttachmentService {
foreach (array_keys($this->services) as $attachmentType) { foreach (array_keys($this->services) as $attachmentType) {
$service = $this->getService($attachmentType); $service = $this->getService($attachmentType);
if ($service instanceof ICustomAttachmentService) { if ($service instanceof ICustomAttachmentService) {
$count += $service->getAttachmentCount($cardId); $count += $service->getAttachmentCount((int)$cardId);
} }
} }

View File

@@ -77,11 +77,11 @@ class FilesAppService implements IAttachmentService, ICustomAttachmentService {
$shares = array_filter($shares, function ($share) { $shares = array_filter($shares, function ($share) {
return $share->getPermissions() > 0; return $share->getPermissions() > 0;
}); });
return array_map(function (IShare $share) use ($cardId, $userFolder) { return array_map(function (IShare $share) use ($cardId) {
$file = $share->getNode(); $file = $share->getNode();
$attachment = new Attachment(); $attachment = new Attachment();
$attachment->setType('file'); $attachment->setType('file');
$attachment->setId($share->getId()); $attachment->setId((int)$share->getId());
$attachment->setCardId($cardId); $attachment->setCardId($cardId);
$attachment->setCreatedBy($share->getSharedBy()); $attachment->setCreatedBy($share->getSharedBy());
$attachment->setData($file->getName()); $attachment->setData($file->getName());
@@ -179,18 +179,16 @@ class FilesAppService implements IAttachmentService, ICustomAttachmentService {
throw new StatusException('Could not read file'); throw new StatusException('Could not read file');
} }
$target->putContent($content); $target->putContent($content);
if (is_resource($content)) {
fclose($content); fclose($content);
}
$share = $this->shareManager->newShare(); $share = $this->shareManager->newShare();
$share->setNode($target); $share->setNode($target);
$share->setShareType(Share::SHARE_TYPE_DECK); $share->setShareType(ISHARE::TYPE_DECK);
$share->setSharedWith((string)$attachment->getCardId()); $share->setSharedWith((string)$attachment->getCardId());
$share->setPermissions(Constants::PERMISSION_READ); $share->setPermissions(Constants::PERMISSION_READ);
$share->setSharedBy($this->userId); $share->setSharedBy($this->userId);
$share = $this->shareManager->createShare($share); $share = $this->shareManager->createShare($share);
$attachment->setId($share->getId()); $attachment->setId((int)$share->getId());
$attachment->setData($target->getName()); $attachment->setData($target->getName());
return $attachment; return $attachment;
} }
@@ -237,9 +235,7 @@ class FilesAppService implements IAttachmentService, ICustomAttachmentService {
throw new StatusException('Could not read file'); throw new StatusException('Could not read file');
} }
$target->putContent($content); $target->putContent($content);
if (is_resource($content)) {
fclose($content); fclose($content);
}
$attachment->setLastModified(time()); $attachment->setLastModified(time());
return $attachment; return $attachment;
@@ -249,9 +245,6 @@ class FilesAppService implements IAttachmentService, ICustomAttachmentService {
$share = $this->shareProvider->getShareById($attachment->getId()); $share = $this->shareProvider->getShareById($attachment->getId());
$file = $share->getNode(); $file = $share->getNode();
$attachment->setData($file->getName()); $attachment->setData($file->getName());
if ($file === null) {
throw new NotFoundException('File not found');
}
if ($file->getOwner() !== null && $file->getOwner()->getUID() === $this->userId) { if ($file->getOwner() !== null && $file->getOwner()->getUID() === $this->userId) {
$file->delete(); $file->delete();

View File

@@ -114,7 +114,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
try { try {
$board = $this->boardMapper->find($boardId); $board = $this->boardMapper->find($boardId);
$valid &= !$board->getArchived(); $valid = $valid && !$board->getArchived();
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) { } catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
$valid = false; $valid = false;
} }
@@ -234,7 +234,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
*/ */
private function createShareObject(array $data): IShare { private function createShareObject(array $data): IShare {
$share = $this->shareManager->newShare(); $share = $this->shareManager->newShare();
$share->setId((int)$data['id']) $share->setId($data['id'])
->setShareType((int)$data['share_type']) ->setShareType((int)$data['share_type'])
->setPermissions((int)$data['permissions']) ->setPermissions((int)$data['permissions'])
->setTarget($data['file_target']) ->setTarget($data['file_target'])
@@ -401,7 +401,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
$qb->execute(); $qb->execute();
return $this->getShareById($share->getId(), $recipient); return $this->getShareById((int)$share->getId(), $recipient);
} }
/** /**
@@ -456,6 +456,7 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
/** /**
* @inheritDoc * @inheritDoc
* @returns
*/ */
public function getSharesInFolder($userId, Folder $node, $reshares) { public function getSharesInFolder($userId, Folder $node, $reshares) {
$qb = $this->dbConnection->getQueryBuilder(); $qb = $this->dbConnection->getQueryBuilder();
@@ -755,14 +756,13 @@ class DeckShareProvider implements \OCP\Share\IShareProvider {
/** /**
* Get shared with the card * Get shared with the card
* *
* @param string $userId get shares where this user is the recipient * @param int $cardId
* @param int $shareType * @param int $shareType
* @param Node|null $node
* @param int $limit The max number of entries returned, -1 for all * @param int $limit The max number of entries returned, -1 for all
* @param int $offset * @param int $offset
* @return IShare[] * @return IShare[]
*/ */
public function getSharedWithByType(string $cardId, int $shareType, $limit, $offset): array { public function getSharedWithByType(int $cardId, int $shareType, $limit, $offset): array {
/** @var IShare[] $shares */ /** @var IShare[] $shares */
$shares = []; $shares = [];

View File

@@ -32,6 +32,7 @@ use OCA\Deck\NoPermissionException;
use OCA\Deck\Service\PermissionService; use OCA\Deck\Service\PermissionService;
use OCP\AppFramework\OCS\OCSNotFoundException; use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\AppFramework\Utility\ITimeFactory; use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IL10N;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use OCP\Share\IShare; use OCP\Share\IShare;
@@ -40,12 +41,14 @@ class ShareAPIHelper {
private $timeFactory; private $timeFactory;
private $cardMapper; private $cardMapper;
private $permissionService; private $permissionService;
private $l10n;
public function __construct(IURLGenerator $urlGenerator, ITimeFactory $timeFactory, CardMapper $cardMapper, PermissionService $permissionService) { public function __construct(IURLGenerator $urlGenerator, ITimeFactory $timeFactory, CardMapper $cardMapper, PermissionService $permissionService, IL10N $l10n) {
$this->urlGenerator = $urlGenerator; $this->urlGenerator = $urlGenerator;
$this->timeFactory = $timeFactory; $this->timeFactory = $timeFactory;
$this->cardMapper = $cardMapper; $this->cardMapper = $cardMapper;
$this->permissionService = $permissionService; $this->permissionService = $permissionService;
$this->l10n = $l10n;
} }
public function formatShare(IShare $share): array { public function formatShare(IShare $share): array {
@@ -67,7 +70,7 @@ class ShareAPIHelper {
$expireDate = $this->parseDate($expireDate); $expireDate = $this->parseDate($expireDate);
$share->setExpirationDate($expireDate); $share->setExpirationDate($expireDate);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new OCSNotFoundException($this->l->t('Invalid date, date format must be YYYY-MM-DD')); throw new OCSNotFoundException($this->l10n->t('Invalid date, date format must be YYYY-MM-DD'));
} }
} }
} }
@@ -90,10 +93,6 @@ class ShareAPIHelper {
throw new \Exception('Invalid date. Format must be YYYY-MM-DD'); throw new \Exception('Invalid date. Format must be YYYY-MM-DD');
} }
if ($date === false) {
throw new \Exception('Invalid date. Format must be YYYY-MM-DD');
}
$date->setTime(0, 0, 0); $date->setTime(0, 0, 0);
return $date; return $date;

View File

@@ -4,18 +4,6 @@
<TypeDoesNotContainType occurrences="1"> <TypeDoesNotContainType occurrences="1">
<code>$message !== null</code> <code>$message !== null</code>
</TypeDoesNotContainType> </TypeDoesNotContainType>
<UndefinedMagicMethod occurrences="9">
<code>getArchived</code>
<code>getBoardId</code>
<code>getBoardId</code>
<code>getBoardId</code>
<code>getBoardId</code>
<code>getCardId</code>
<code>getCardId</code>
<code>getStackId</code>
<code>getTitle</code>
<code>getTitle</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Activity/DeckProvider.php"> <file src="lib/Activity/DeckProvider.php">
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
@@ -28,23 +16,9 @@
</DuplicateClass> </DuplicateClass>
</file> </file>
<file src="lib/AppInfo/Application20.php"> <file src="lib/AppInfo/Application20.php">
<UndefinedClass occurrences="1"> <RedundantCondition occurrences="1">
<code>IBootstrap</code> <code>method_exists($shareManager, 'registerShareProvider')</code>
</UndefinedClass> </RedundantCondition>
</file>
<file src="lib/AppInfo/ApplicationLegacy.php">
<UndefinedInterfaceMethod occurrences="2">
<code>listen</code>
<code>listen</code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/Collaboration/Resources/ResourceProviderCard.php">
<UndefinedMagicMethod occurrences="4">
<code>getAcl</code>
<code>getOwner</code>
<code>getTitle</code>
<code>getTitle</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Command/UserExport.php"> <file src="lib/Command/UserExport.php">
<ImplementedReturnTypeMismatch occurrences="1"> <ImplementedReturnTypeMismatch occurrences="1">
@@ -90,11 +64,9 @@
</InvalidScalarArgument> </InvalidScalarArgument>
</file> </file>
<file src="lib/Controller/PageController.php"> <file src="lib/Controller/PageController.php">
<MissingDependency occurrences="3"> <UndefinedClass occurrences="1">
<code>Application</code> <code>LoadSidebar</code>
<code>Application</code> </UndefinedClass>
<code>Application</code>
</MissingDependency>
</file> </file>
<file src="lib/Controller/StackApiController.php"> <file src="lib/Controller/StackApiController.php">
<RedundantCondition occurrences="1"> <RedundantCondition occurrences="1">
@@ -104,21 +76,6 @@
<code>Util</code> <code>Util</code>
</UndefinedClass> </UndefinedClass>
</file> </file>
<file src="lib/Cron/CardDescriptionActivity.php">
<UndefinedClass occurrences="1">
<code>Job</code>
</UndefinedClass>
</file>
<file src="lib/Cron/DeleteCron.php">
<UndefinedClass occurrences="1">
<code>Job</code>
</UndefinedClass>
</file>
<file src="lib/Cron/ScheduledNotifications.php">
<UndefinedClass occurrences="1">
<code>Job</code>
</UndefinedClass>
</file>
<file src="lib/DAV/Calendar.php"> <file src="lib/DAV/Calendar.php">
<UndefinedClass occurrences="1"> <UndefinedClass occurrences="1">
<code>ExternalCalendar</code> <code>ExternalCalendar</code>
@@ -140,18 +97,6 @@
<code>NotFound</code> <code>NotFound</code>
</UndefinedClass> </UndefinedClass>
</file> </file>
<file src="lib/Dashboard/DeckWidget.php">
<UndefinedClass occurrences="1">
<code>IWidget</code>
</UndefinedClass>
</file>
<file src="lib/Db/Acl.php">
<UndefinedMagicMethod occurrences="3">
<code>getPermissionEdit</code>
<code>getPermissionManage</code>
<code>getPermissionShare</code>
</UndefinedMagicMethod>
</file>
<file src="lib/Db/AclMapper.php"> <file src="lib/Db/AclMapper.php">
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$aclId</code> <code>$aclId</code>
@@ -161,32 +106,12 @@
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$cardId</code> <code>$cardId</code>
</ParamNameMismatch> </ParamNameMismatch>
<UndefinedMagicMethod occurrences="9">
<code>getParticipant</code>
<code>getParticipant</code>
<code>getParticipant</code>
<code>getParticipant</code>
<code>getParticipant</code>
<code>getParticipant</code>
<code>getType</code>
<code>getType</code>
<code>getType</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Db/AttachmentMapper.php"> <file src="lib/Db/AttachmentMapper.php">
<UndefinedMagicMethod occurrences="2">
<code>getCardId</code>
<code>getCardId</code>
</UndefinedMagicMethod>
<UndefinedVariable occurrences="1"> <UndefinedVariable occurrences="1">
<code>$query</code> <code>$query</code>
</UndefinedVariable> </UndefinedVariable>
</file> </file>
<file src="lib/Db/Board.php">
<UndefinedMagicMethod occurrences="1">
<code>getLastModified</code>
</UndefinedMagicMethod>
</file>
<file src="lib/Db/BoardMapper.php"> <file src="lib/Db/BoardMapper.php">
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$boardId</code> <code>$boardId</code>
@@ -194,53 +119,20 @@
<UndefinedClass occurrences="1"> <UndefinedClass occurrences="1">
<code>\OCA\Circles\Api\v1\Circles</code> <code>\OCA\Circles\Api\v1\Circles</code>
</UndefinedClass> </UndefinedClass>
<UndefinedMagicMethod occurrences="2">
<code>setAcl</code>
<code>setLabels</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Db/Card.php"> <file src="lib/Db/Card.php">
<UndefinedClass occurrences="2"> <UndefinedClass occurrences="2">
<code>VCalendar</code> <code>VCalendar</code>
<code>VCalendar</code> <code>VCalendar</code>
</UndefinedClass> </UndefinedClass>
<UndefinedMagicMethod occurrences="9">
<code>getArchived</code>
<code>getArchived</code>
<code>getDescription</code>
<code>getLabels</code>
<code>getLabels</code>
<code>getLastModified</code>
<code>getLastModified</code>
<code>getStackId</code>
<code>getTitle</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Db/CardMapper.php"> <file src="lib/Db/CardMapper.php">
<ImplicitToStringCast occurrences="1">
<code>$qb-&gt;createNamedParameter($boardIds, IQueryBuilder::PARAM_INT_ARRAY)</code>
</ImplicitToStringCast>
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>$entity-&gt;getId()</code> <code>$entity-&gt;getId()</code>
</InvalidScalarArgument> </InvalidScalarArgument>
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$cardId</code> <code>$cardId</code>
</ParamNameMismatch> </ParamNameMismatch>
<UndefinedMagicMethod occurrences="13">
<code>getDescription</code>
<code>getDescription</code>
<code>getDuedate</code>
<code>setCreatedAt</code>
<code>setDatabaseType</code>
<code>setDatabaseType</code>
<code>setDescription</code>
<code>setDescription</code>
<code>setLabels</code>
<code>setLastModified</code>
<code>setLastModified</code>
<code>setNotified</code>
<code>setNotified</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Db/ChangeHelper.php"> <file src="lib/Db/ChangeHelper.php">
<UndefinedThisPropertyAssignment occurrences="3"> <UndefinedThisPropertyAssignment occurrences="3">
@@ -269,69 +161,26 @@
<code>\OCA\Circles\Model\Circle</code> <code>\OCA\Circles\Model\Circle</code>
</UndefinedDocblockClass> </UndefinedDocblockClass>
</file> </file>
<file src="lib/Db/Label.php">
<UndefinedMagicMethod occurrences="1">
<code>getLastModified</code>
</UndefinedMagicMethod>
</file>
<file src="lib/Db/LabelMapper.php"> <file src="lib/Db/LabelMapper.php">
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$labelId</code> <code>$labelId</code>
</ParamNameMismatch> </ParamNameMismatch>
<UndefinedMagicMethod occurrences="2">
<code>setLastModified</code>
<code>setLastModified</code>
</UndefinedMagicMethod>
</file>
<file src="lib/Db/RelationalEntity.php">
<UndefinedMagicMethod occurrences="1">
<code>getETag</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Db/Stack.php"> <file src="lib/Db/Stack.php">
<UndefinedClass occurrences="2"> <UndefinedClass occurrences="2">
<code>VCalendar</code> <code>VCalendar</code>
<code>VCalendar</code> <code>VCalendar</code>
</UndefinedClass> </UndefinedClass>
<UndefinedMagicMethod occurrences="2">
<code>getLastModified</code>
<code>getTitle</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Db/StackMapper.php"> <file src="lib/Db/StackMapper.php">
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$stackId</code> <code>$stackId</code>
</ParamNameMismatch> </ParamNameMismatch>
<UndefinedMagicMethod occurrences="1">
<code>getBoardId</code>
</UndefinedMagicMethod>
</file>
<file src="lib/Listeners/BeforeTemplateRenderedListener.php">
<UndefinedClass occurrences="1">
<code>BeforeTemplateRenderedEvent</code>
</UndefinedClass>
</file>
<file src="lib/Migration/UnknownUsers.php">
<UndefinedMagicMethod occurrences="4">
<code>getParticipant</code>
<code>getParticipant</code>
<code>getType</code>
<code>getType</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Notification/NotificationHelper.php"> <file src="lib/Notification/NotificationHelper.php">
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>$board-&gt;getId()</code> <code>$board-&gt;getId()</code>
</InvalidScalarArgument> </InvalidScalarArgument>
<MissingDependency occurrences="1">
<code>Application</code>
</MissingDependency>
<UndefinedMagicMethod occurrences="3">
<code>getTitle</code>
<code>getTitle</code>
<code>getTitle</code>
<code>getTitle</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Notification/Notifier.php"> <file src="lib/Notification/Notifier.php">
<RedundantCast occurrences="7"> <RedundantCast occurrences="7">
@@ -348,42 +197,12 @@
<InvalidPropertyAssignmentValue occurrences="1"> <InvalidPropertyAssignmentValue occurrences="1">
<code>[]</code> <code>[]</code>
</InvalidPropertyAssignmentValue> </InvalidPropertyAssignmentValue>
<UndefinedClass occurrences="2">
<code>IndexDocument</code>
<code>SearchTemplate</code>
</UndefinedClass>
</file>
<file src="lib/Search/BoardSearchResultEntry.php">
<UndefinedClass occurrences="1">
<code>SearchResultEntry</code>
</UndefinedClass>
</file>
<file src="lib/Search/CardSearchResultEntry.php">
<UndefinedClass occurrences="1">
<code>SearchResultEntry</code>
</UndefinedClass>
</file>
<file src="lib/Search/DeckProvider.php">
<UndefinedClass occurrences="1">
<code>IProvider</code>
</UndefinedClass>
</file> </file>
<file src="lib/Service/AssignmentService.php"> <file src="lib/Service/AssignmentService.php">
<InvalidScalarArgument occurrences="2"> <InvalidScalarArgument occurrences="2">
<code>$cardId</code> <code>$cardId</code>
<code>$cardId</code> <code>$cardId</code>
</InvalidScalarArgument> </InvalidScalarArgument>
<UndefinedMagicMethod occurrences="9">
<code>getParticipant</code>
<code>getParticipant</code>
<code>getParticipant</code>
<code>getType</code>
<code>getType</code>
<code>getType</code>
<code>setCardId</code>
<code>setParticipant</code>
<code>setType</code>
</UndefinedMagicMethod>
<UndefinedThisPropertyAssignment occurrences="1"> <UndefinedThisPropertyAssignment occurrences="1">
<code>$this-&gt;currentUser</code> <code>$this-&gt;currentUser</code>
</UndefinedThisPropertyAssignment> </UndefinedThisPropertyAssignment>
@@ -391,86 +210,11 @@
<code>$this-&gt;currentUser</code> <code>$this-&gt;currentUser</code>
</UndefinedThisPropertyFetch> </UndefinedThisPropertyFetch>
</file> </file>
<file src="lib/Service/AttachmentService.php">
<MissingDependency occurrences="1">
<code>Application</code>
</MissingDependency>
<UndefinedMagicMethod occurrences="13">
<code>getCardId</code>
<code>getCardId</code>
<code>getCardId</code>
<code>getData</code>
<code>getType</code>
<code>getType</code>
<code>setCardId</code>
<code>setCreatedAt</code>
<code>setCreatedBy</code>
<code>setData</code>
<code>setLastModified</code>
<code>setLastModified</code>
<code>setType</code>
</UndefinedMagicMethod>
</file>
<file src="lib/Service/BoardService.php"> <file src="lib/Service/BoardService.php">
<InvalidArgument occurrences="6">
<code>'\OCA\Deck\Board::onCreate'</code>
<code>'\OCA\Deck\Board::onDelete'</code>
<code>'\OCA\Deck\Board::onDelete'</code>
<code>'\OCA\Deck\Board::onShareEdit'</code>
<code>'\OCA\Deck\Board::onUpdate'</code>
<code>'\OCA\Deck\Board::onUpdate'</code>
</InvalidArgument>
<MissingDependency occurrences="3">
<code>Application</code>
<code>Application</code>
<code>Application</code>
</MissingDependency>
<TooManyArguments occurrences="2"> <TooManyArguments occurrences="2">
<code>findAll</code> <code>findAll</code>
<code>findAll</code> <code>findAll</code>
</TooManyArguments> </TooManyArguments>
<UndefinedMagicMethod occurrences="40">
<code>getAcl</code>
<code>getAcl</code>
<code>getAcl</code>
<code>getBoardId</code>
<code>getBoardId</code>
<code>getBoardId</code>
<code>getBoardId</code>
<code>getParticipant</code>
<code>getType</code>
<code>setBoardId</code>
<code>setBoardId</code>
<code>setBoardId</code>
<code>setBoardId</code>
<code>setColor</code>
<code>setColor</code>
<code>setColor</code>
<code>setColor</code>
<code>setColor</code>
<code>setLabels</code>
<code>setOwner</code>
<code>setOwner</code>
<code>setParticipant</code>
<code>setPermissionEdit</code>
<code>setPermissionEdit</code>
<code>setPermissionManage</code>
<code>setPermissionManage</code>
<code>setPermissionShare</code>
<code>setPermissionShare</code>
<code>setPermissions</code>
<code>setPermissions</code>
<code>setPermissions</code>
<code>setPermissions</code>
<code>setSettings</code>
<code>setTitle</code>
<code>setTitle</code>
<code>setTitle</code>
<code>setTitle</code>
<code>setTitle</code>
<code>setTitle</code>
<code>setType</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Service/CardService.php"> <file src="lib/Service/CardService.php">
<TooFewArguments occurrences="1"> <TooFewArguments occurrences="1">
@@ -479,52 +223,6 @@
<UndefinedDocblockClass occurrences="1"> <UndefinedDocblockClass occurrences="1">
<code>\OCP\AppFramework\Db\</code> <code>\OCP\AppFramework\Db\</code>
</UndefinedDocblockClass> </UndefinedDocblockClass>
<UndefinedMagicMethod occurrences="44">
<code>getArchived</code>
<code>getArchived</code>
<code>getArchived</code>
<code>getArchived</code>
<code>getArchived</code>
<code>getDescription</code>
<code>getDescription</code>
<code>getDescription</code>
<code>getDescriptionPrev</code>
<code>getDescriptionPrev</code>
<code>getLastEditor</code>
<code>getLastEditor</code>
<code>getLastEditor</code>
<code>getOrder</code>
<code>setArchived</code>
<code>setArchived</code>
<code>setArchived</code>
<code>setAssignedUsers</code>
<code>setAssignedUsers</code>
<code>setAttachmentCount</code>
<code>setAttachments</code>
<code>setCommentsUnread</code>
<code>setDeletedAt</code>
<code>setDeletedAt</code>
<code>setDescription</code>
<code>setDescription</code>
<code>setDescriptionPrev</code>
<code>setDescriptionPrev</code>
<code>setDuedate</code>
<code>setDuedate</code>
<code>setLabels</code>
<code>setLastEditor</code>
<code>setOrder</code>
<code>setOrder</code>
<code>setOwner</code>
<code>setOwner</code>
<code>setStackId</code>
<code>setStackId</code>
<code>setStackId</code>
<code>setTitle</code>
<code>setTitle</code>
<code>setTitle</code>
<code>setType</code>
<code>setType</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Service/CirclesService.php"> <file src="lib/Service/CirclesService.php">
<UndefinedClass occurrences="2"> <UndefinedClass occurrences="2">
@@ -533,13 +231,6 @@
</UndefinedClass> </UndefinedClass>
</file> </file>
<file src="lib/Service/CommentService.php"> <file src="lib/Service/CommentService.php">
<MissingDependency occurrences="5">
<code>Application</code>
<code>Application</code>
<code>Application</code>
<code>Application</code>
<code>Application</code>
</MissingDependency>
<UndefinedThisPropertyAssignment occurrences="2"> <UndefinedThisPropertyAssignment occurrences="2">
<code>$this-&gt;cardMapper</code> <code>$this-&gt;cardMapper</code>
<code>$this-&gt;permissionService</code> <code>$this-&gt;permissionService</code>
@@ -555,25 +246,7 @@
<code>$this-&gt;permissionService</code> <code>$this-&gt;permissionService</code>
</UndefinedThisPropertyFetch> </UndefinedThisPropertyFetch>
</file> </file>
<file src="lib/Service/ConfigService.php">
<InvalidScalarArgument occurrences="1">
<code>(int)$value</code>
</InvalidScalarArgument>
<MissingDependency occurrences="7">
<code>Application</code>
<code>Application</code>
<code>Application</code>
<code>Application</code>
<code>Application</code>
<code>Application</code>
<code>Application</code>
</MissingDependency>
</file>
<file src="lib/Service/DefaultBoardService.php"> <file src="lib/Service/DefaultBoardService.php">
<MissingDependency occurrences="2">
<code>Application</code>
<code>Application</code>
</MissingDependency>
<TypeDoesNotContainNull occurrences="6"> <TypeDoesNotContainNull occurrences="6">
<code>$color === false || $color === null</code> <code>$color === false || $color === null</code>
<code>$color === null</code> <code>$color === null</code>
@@ -597,94 +270,46 @@
<code>is_resource($content)</code> <code>is_resource($content)</code>
<code>is_resource($content)</code> <code>is_resource($content)</code>
</RedundantCondition> </RedundantCondition>
<UndefinedMagicMethod occurrences="10">
<code>getCardId</code>
<code>getCardId</code>
<code>getCardId</code>
<code>getData</code>
<code>getData</code>
<code>setData</code>
<code>setData</code>
<code>setDeletedAt</code>
<code>setExtendedData</code>
<code>setLastModified</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Service/FullTextSearchService.php"> <file src="lib/Service/FilesAppService.php">
<UndefinedClass occurrences="2"> <MissingDependency occurrences="4">
<code>DocumentAccess</code> <code>$this-&gt;rootFolder</code>
<code>IndexDocument</code> <code>$this-&gt;rootFolder</code>
</UndefinedClass> <code>IRootFolder</code>
<UndefinedMagicMethod occurrences="4"> <code>Share\Exceptions\ShareNotFound</code>
<code>getDescription</code> </MissingDependency>
<code>getDescription</code>
<code>getTitle</code>
<code>getTitle</code>
</UndefinedMagicMethod>
</file>
<file src="lib/Service/LabelService.php">
<UndefinedMagicMethod occurrences="4">
<code>getBoardId</code>
<code>getBoardId</code>
<code>getBoardId</code>
<code>setBoardId</code>
<code>setColor</code>
<code>setColor</code>
<code>setTitle</code>
<code>setTitle</code>
</UndefinedMagicMethod>
</file>
<file src="lib/Service/OverviewService.php">
<UndefinedMagicMethod occurrences="4">
<code>setAssignedUsers</code>
<code>setAttachmentCount</code>
<code>setCommentsUnread</code>
<code>setLabels</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Service/PermissionService.php"> <file src="lib/Service/PermissionService.php">
<UndefinedClass occurrences="2"> <UndefinedClass occurrences="2">
<code>\OCA\Circles\Api\v1\Circles</code> <code>\OCA\Circles\Api\v1\Circles</code>
<code>\OCA\Circles\Api\v1\Circles</code> <code>\OCA\Circles\Api\v1\Circles</code>
</UndefinedClass> </UndefinedClass>
<UndefinedMagicMethod occurrences="6">
<code>getAcl</code>
<code>getParticipant</code>
<code>getParticipant</code>
<code>getParticipant</code>
<code>getParticipant</code>
<code>getType</code>
<code>getType</code>
<code>getType</code>
<code>getType</code>
<code>getType</code>
<code>getType</code>
</UndefinedMagicMethod>
</file> </file>
<file src="lib/Service/StackService.php"> <file src="lib/Service/StackService.php">
<InvalidArgument occurrences="3">
<code>'\OCA\Deck\Stack::onCreate'</code>
<code>'\OCA\Deck\Stack::onDelete'</code>
<code>'\OCA\Deck\Stack::onUpdate'</code>
</InvalidArgument>
<UndefinedClass occurrences="1"> <UndefinedClass occurrences="1">
<code>BadRquestException</code> <code>BadRquestException</code>
</UndefinedClass> </UndefinedClass>
<UndefinedMagicMethod occurrences="14"> </file>
<code>getBoardId</code> <file src="lib/Sharing/DeckShareProvider.php">
<code>getBoardId</code> <InvalidReturnStatement occurrences="1">
<code>getBoardId</code> <code>$shares</code>
<code>getBoardId</code> </InvalidReturnStatement>
<code>getOrder</code> <InvalidReturnType occurrences="1">
<code>setBoardId</code> <code>getSharesInFolder</code>
<code>setBoardId</code> </InvalidReturnType>
<code>setCards</code> <MissingDependency occurrences="7">
<code>setDeletedAt</code> <code>GenericShareException</code>
<code>setDeletedAt</code> <code>GenericShareException</code>
<code>setOrder</code> <code>ShareNotFound</code>
<code>setOrder</code> <code>ShareNotFound</code>
<code>setTitle</code> <code>ShareNotFound</code>
<code>setTitle</code> <code>ShareNotFound</code>
</UndefinedMagicMethod> <code>ShareNotFound</code>
</MissingDependency>
</file>
<file src="lib/Sharing/Listener.php">
<InvalidArgument occurrences="1">
<code>[self::class, 'listenPreShare']</code>
</InvalidArgument>
</file> </file>
</files> </files>

View File

@@ -316,10 +316,6 @@ class ActivityManagerTest extends TestCase {
$stack->setBoardId(999); $stack->setBoardId(999);
$board = new Board(); $board = new Board();
$board->setId(999); $board->setId(999);
$this->attachmentMapper->expects($this->once())
->method('find')
->with(777)
->willReturn($attachment);
$this->cardMapper->expects($this->once()) $this->cardMapper->expects($this->once())
->method('find') ->method('find')
->with(555) ->with(555)
@@ -340,7 +336,7 @@ class ActivityManagerTest extends TestCase {
'archived' => $card->getArchived() 'archived' => $card->getArchived()
], ],
'attachment' => $attachment 'attachment' => $attachment
], $this->invokePrivate($this->activityManager, 'findDetailsForAttachment', [777])); ], $this->invokePrivate($this->activityManager, 'findDetailsForAttachment', [$attachment]));
} }
public function invokePrivate(&$object, $methodName, array $parameters = []) { public function invokePrivate(&$object, $methodName, array $parameters = []) {

View File

@@ -270,7 +270,7 @@ class AttachmentServiceTest extends TestCase {
->method('display') ->method('display')
->with($attachment) ->with($attachment)
->willReturn($response); ->willReturn($response);
$actual = $this->attachmentService->display(1); $actual = $this->attachmentService->display(1, 1);
$this->assertEquals($response, $actual); $this->assertEquals($response, $actual);
} }
@@ -286,8 +286,8 @@ class AttachmentServiceTest extends TestCase {
$this->attachmentServiceImpl->expects($this->once()) $this->attachmentServiceImpl->expects($this->once())
->method('display') ->method('display')
->with($attachment) ->with($attachment)
->will($this->throwException(new InvalidAttachmentType('deck_file'))); ->will($this->throwException(new NotFoundException('deck_file')));
$this->attachmentService->display(1); $this->attachmentService->display(1, 1);
} }
public function testUpdate() { public function testUpdate() {
$attachment = $this->createAttachment('deck_file', 'file_name.jpg'); $attachment = $this->createAttachment('deck_file', 'file_name.jpg');
@@ -309,7 +309,7 @@ class AttachmentServiceTest extends TestCase {
$a->setExtendedData(['mime' => 'image/jpeg']); $a->setExtendedData(['mime' => 'image/jpeg']);
}); });
$actual = $this->attachmentService->update(1, 'file_name.jpg'); $actual = $this->attachmentService->update(1, 1, 'file_name.jpg');
$expected->setExtendedData(['mime' => 'image/jpeg']); $expected->setExtendedData(['mime' => 'image/jpeg']);
$expected->setLastModified($attachment->getLastModified()); $expected->setLastModified($attachment->getLastModified());
@@ -333,7 +333,7 @@ class AttachmentServiceTest extends TestCase {
$this->attachmentMapper->expects($this->once()) $this->attachmentMapper->expects($this->once())
->method('delete') ->method('delete')
->willReturn($attachment); ->willReturn($attachment);
$actual = $this->attachmentService->delete(1); $actual = $this->attachmentService->delete(1, 1);
$this->assertEquals($expected, $actual); $this->assertEquals($expected, $actual);
} }
@@ -358,7 +358,7 @@ class AttachmentServiceTest extends TestCase {
->method('update') ->method('update')
->willReturn($attachment); ->willReturn($attachment);
$expected->setDeletedAt(23); $expected->setDeletedAt(23);
$actual = $this->attachmentService->delete(1); $actual = $this->attachmentService->delete(1, 1);
$this->assertEquals($expected, $actual); $this->assertEquals($expected, $actual);
} }
@@ -378,7 +378,7 @@ class AttachmentServiceTest extends TestCase {
->method('update') ->method('update')
->willReturn($attachment); ->willReturn($attachment);
$expected->setDeletedAt(0); $expected->setDeletedAt(0);
$actual = $this->attachmentService->restore(1); $actual = $this->attachmentService->restore(1, 1);
$this->assertEquals($expected, $actual); $this->assertEquals($expected, $actual);
} }
@@ -395,6 +395,6 @@ class AttachmentServiceTest extends TestCase {
$this->attachmentServiceImpl->expects($this->once()) $this->attachmentServiceImpl->expects($this->once())
->method('allowUndo') ->method('allowUndo')
->willReturn(false); ->willReturn(false);
$actual = $this->attachmentService->restore(1); $actual = $this->attachmentService->restore(1, 1);
} }
} }