Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/webhook_listeners/lib/Service/TokenService.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ public function __construct(
*
* @param WebhookListener $webhookListener
* @param ?string $triggerUserId the user that triggered the webhook call
* @return array{user_ids?:array<string,string>,user_roles?:array{owner?:array<string,string>,trigger?:array<string,string>}}
* @return array{
* user_ids?: array<string, array{baseUrl: string, token: string, userId: mixed}>,
* trigger?: array{baseUrl: string, token: string, userId: string},
* owner?: array{baseUrl: string, token: string, userId: string},
* }
*/
public function getTokens(WebhookListener $webhookListener, ?string $triggerUserId): array {
$tokens = [];
Expand Down
9 changes: 9 additions & 0 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4306,4 +4306,13 @@
<code><![CDATA[getAppValue]]></code>
</DeprecatedMethod>
</file>
<file src="tests/lib/TestCase.php">
<DeprecatedMethod>
<code><![CDATA[$container]]></code>
</DeprecatedMethod>
<InternalMethod>
<code><![CDATA[lockFile]]></code>
<code><![CDATA[unlockFile]]></code>
</InternalMethod>
</file>
</files>
2 changes: 1 addition & 1 deletion lib/private/OpenMetrics/Exporters/FilesByType.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function gatherMetrics(): Generator {
foreach ($metrics->iterateAssociative() as $count) {
yield new Metric(
$count['count'],
['mimetype' => $this->mimetypeLoader->getMimetypeById($count['mimetype'])],
['mimetype' => $this->mimetypeLoader->getMimetypeById($count['mimetype']) ?? ''],
$now,
);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/public/Comments/ICommentsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ public function deleteReadMarksOnObject($objectType, $objectId);
* to consumers of the comments infrastructure
*
* @param \Closure $closure
* @return void
* @since 11.0.0
*/
public function registerEventHandler(\Closure $closure);
Expand All @@ -447,6 +448,7 @@ public function registerEventHandler(\Closure $closure);
*
* @param string $type
* @param \Closure $closure
* @return void
* @throws \OutOfBoundsException
* @since 11.0.0
*
Expand Down
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@
<directory name="core"/>
<directory name="lib"/>
<directory name="ocs"/>
<directory name="tests/lib/Comments"/>
<directory name="ocs-provider"/>
<file name="cron.php"/>
<file name="index.php"/>
<file name="public.php"/>
<file name="remote.php"/>
<file name="status.php"/>
<file name="version.php"/>
<file name="tests/lib/TestCase.php"/>
<ignoreFiles>
<directory name="apps/**/composer"/>
<directory name="apps/**/tests"/>
Expand All @@ -71,6 +73,7 @@
</projectFiles>
<extraFiles>
<directory name="3rdparty"/>
<directory name="vendor-bin/phpunit/vendor/phpunit"/>
</extraFiles>
<stubs>
<file name="build/stubs/apcu.php"/>
Expand Down
13 changes: 4 additions & 9 deletions tests/lib/Comments/CommentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use OCP\Comments\IComment;
use OCP\Comments\IllegalIDChangeException;
use OCP\Comments\MessageTooLongException;
use PHPUnit\Framework\Attributes\DataProvider;
use Test\TestCase;

class CommentTest extends TestCase {
Expand Down Expand Up @@ -96,7 +97,7 @@ public static function simpleSetterProvider(): array {
];
}

#[\PHPUnit\Framework\Attributes\DataProvider('simpleSetterProvider')]
#[DataProvider(methodName: 'simpleSetterProvider')]
public function testSimpleSetterInvalidInput($field, $input): void {
$this->expectException(\InvalidArgumentException::class);

Expand All @@ -119,7 +120,7 @@ public static function roleSetterProvider(): array {
];
}

#[\PHPUnit\Framework\Attributes\DataProvider('roleSetterProvider')]
#[DataProvider(methodName: 'roleSetterProvider')]
public function testSetRoleInvalidInput($role, $type, $id): void {
$this->expectException(\InvalidArgumentException::class);

Expand Down Expand Up @@ -204,13 +205,7 @@ public static function mentionsProvider(): array {
];
}

/**
*
* @param string $message
* @param array $expectedMentions
* @param ?string $author
*/
#[\PHPUnit\Framework\Attributes\DataProvider('mentionsProvider')]
#[DataProvider(methodName: 'mentionsProvider')]
public function testMentions(string $message, array $expectedMentions, ?string $author = null): void {
$comment = new Comment();
$comment->setMessage($message);
Expand Down
51 changes: 31 additions & 20 deletions tests/lib/Comments/FakeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
* Class FakeManager
*/
class FakeManager implements ICommentsManager {
public function get($id) {
public function get($id): IComment {
throw new \Exception('Not implemented');
}

public function getTree($id, $limit = 0, $offset = 0) {
public function getTree($id, $limit = 0, $offset = 0): array {
return ['comment' => new Comment(), 'replies' => []];
}

public function getForObject(
Expand All @@ -28,7 +30,8 @@ public function getForObject(
$limit = 0,
$offset = 0,
?\DateTime $notOlderThan = null,
) {
): array {
return [];
}

public function getForObjectSince(
Expand Down Expand Up @@ -57,6 +60,7 @@ public function getCommentsWithVerbForObjectSinceComment(
}

public function getNumberOfCommentsForObject($objectType, $objectId, ?\DateTime $notOlderThan = null, $verb = ''): int {
return 0;
}

public function getNumberOfCommentsForObjects(string $objectType, array $objectIds, ?\DateTime $notOlderThan = null, string $verb = ''): array {
Expand All @@ -67,10 +71,12 @@ public function search(string $search, string $objectType, string $objectId, str
return [];
}

public function create($actorType, $actorId, $objectType, $objectId) {
public function create($actorType, $actorId, $objectType, $objectId): IComment {
return new Comment();
}

public function delete($id) {
public function delete($id): bool {
return false;
}

public function getReactionComment(int $parentId, string $actorType, string $actorId, string $reaction): IComment {
Expand All @@ -89,47 +95,52 @@ public function supportReactions(): bool {
return false;
}

public function save(IComment $comment) {
public function save(IComment $comment): bool {
return false;
}

public function deleteReferencesOfActor($actorType, $actorId) {
public function deleteReferencesOfActor($actorType, $actorId): bool {
return false;
}

public function deleteCommentsAtObject($objectType, $objectId) {
public function deleteCommentsAtObject($objectType, $objectId): bool {
return false;
}

public function setReadMark($objectType, $objectId, \DateTime $dateTime, IUser $user) {
public function setReadMark($objectType, $objectId, \DateTime $dateTime, IUser $user): bool {
return false;
}

public function getReadMark($objectType, $objectId, IUser $user) {
public function getReadMark($objectType, $objectId, IUser $user): bool {
return false;
}

public function deleteReadMarksFromUser(IUser $user) {
public function deleteReadMarksFromUser(IUser $user): bool {
return false;
}

public function deleteReadMarksOnObject($objectType, $objectId) {
public function deleteReadMarksOnObject($objectType, $objectId): bool {
return false;
}

public function registerEventHandler(\Closure $closure) {
public function registerEventHandler(\Closure $closure): void {
}

public function registerDisplayNameResolver($type, \Closure $closure) {
public function registerDisplayNameResolver($type, \Closure $closure): void {
}

public function resolveDisplayName($type, $id) {
public function resolveDisplayName($type, $id): string {
return '';
}

public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user) {
public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user): array {
return [];
}

public function getNumberOfUnreadCommentsForObjects(string $objectType, array $objectIds, IUser $user, $verb = ''): array {
return [];
}


public function getActorsInTree($id) {
}

public function load(): void {
}

Expand Down
Loading
Loading