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
2 changes: 1 addition & 1 deletion lib/Service/SubmissionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ private function exportData(array $header, array $data, string $fileFormat, ?Fil

$newSubmissionIds = [];
if ($submissionIdColIndex !== false) {
$newSubmissionIds = array_map('strval', array_column($data, $submissionIdColIndex));
$newSubmissionIds = array_map(strval(...), array_column($data, $submissionIdColIndex));
}

// Sync Rows
Expand Down
2 changes: 1 addition & 1 deletion lib/ShareReview/ShareReviewSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getShares(): array {
return [];
}
return array_map(
fn (array $share) => $this->buildEntry($share),
$this->buildEntry(...),
$rawShares,
);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Integration/Api/ApiV3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ public function testExportSubmissionsWithSync() {

// 2. Verify Initial Export
$content = $this->userFolder->get($exportPath)->getContent();
$data = array_map('str_getcsv', explode("\n", trim($content)));
$data = array_map(str_getcsv(...), explode("\n", trim($content)));

$this->assertCount(5, $data, 'Expected 5 rows: header, hidden-header, 3 data rows');
// Check headers
Expand Down Expand Up @@ -1517,7 +1517,7 @@ public function testExportSubmissionsWithSync() {

// 5. Verify Export after deletions
$content = $this->userFolder->get($exportPath)->getContent();
$data = array_map('str_getcsv', explode("\n", trim($content)));
$data = array_map(str_getcsv(...), explode("\n", trim($content)));

$this->assertCount(4, $data, 'Expected 4 rows after deletion: header, hidden-header, 2 data rows');
$this->assertStringNotContainsString($question1['text'], implode(',', $data[0]));
Expand All @@ -1538,7 +1538,7 @@ public function testExportSubmissionsWithSync() {

// 8. Verify export after update
$content = $this->userFolder->get($exportPath)->getContent();
$data = array_map('str_getcsv', explode("\n", trim($content)));
$data = array_map(str_getcsv(...), explode("\n", trim($content)));

$updatedRow = null;
foreach (array_slice($data, 2) as $row) {
Expand Down
2 changes: 0 additions & 2 deletions tests/Unit/Db/ShareMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class ShareMapperTest extends TestCase {
private ShareMapper $shareMapper;

protected function setUp(): void {
parent::setUp();

$this->qb = $this->createMock(IQueryBuilder::class);
$this->qb->method('select')->willReturnSelf();
$this->qb->method('selectAlias')->willReturnSelf();
Expand Down
1 change: 0 additions & 1 deletion tests/Unit/ShareReview/ShareReviewListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ final class ShareReviewListenerTest extends TestCase {
private ShareReviewListener $listener;

protected function setUp(): void {
parent::setUp();
$this->listener = new ShareReviewListener();
}

Expand Down
17 changes: 7 additions & 10 deletions tests/Unit/ShareReview/ShareReviewSourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,23 @@
use Psr\Log\LoggerInterface;

final class ShareReviewSourceTest extends TestCase {
private MockObject $shareMapper;
private MockObject $formMapper;
private MockObject $uploadedFilesShareService;
private MockObject $eventDispatcher;
private MockObject $logger;
private MockObject $l10n;
private ShareMapper|MockObject $shareMapper;
private FormMapper|MockObject $formMapper;
private UploadedFilesShareService|MockObject $uploadedFilesShareService;
private IEventDispatcher|MockObject $eventDispatcher;
private LoggerInterface|MockObject $logger;
private IL10N|MockObject $l10n;
private ShareReviewSource $source;

protected function setUp(): void {
parent::setUp();
$this->shareMapper = $this->createMock(ShareMapper::class);
$this->formMapper = $this->createMock(FormMapper::class);
$this->uploadedFilesShareService = $this->createMock(UploadedFilesShareService::class);
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->l10n = $this->createMock(IL10N::class);
$this->l10n->method('t')->willReturnCallback(
function (string $text, array $params = []): string {
return empty($params) ? $text : vsprintf($text, $params);
}
fn (string $text, array $params = []): string => empty($params) ? $text : vsprintf($text, $params)
);
$this->source = new ShareReviewSource(
$this->shareMapper,
Expand Down
34 changes: 17 additions & 17 deletions tests/Unit/ShareReview/Stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@ public function getSources(): array {
}
}

final class ShareReviewPermission {
final readonly class ShareReviewPermission {
public function __construct(
public readonly string $id,
public readonly string $displayName,
public readonly ?string $hint = null,
public readonly int $priority = 50,
public string $id,
public string $displayName,
public ?string $hint = null,
public int $priority = 50,
) {
}
}

final class ShareReviewEntry {
final readonly class ShareReviewEntry {
public function __construct(
public readonly string $id,
public readonly string $object,
public readonly string $initiator,
public readonly int $type,
public readonly string $recipient,
public readonly int $lastModifiedTimestamp,
public readonly array $permissions = [],
public readonly string $action = '',
public readonly bool $hasPassword = false,
public readonly ?int $expirationTimestamp = null,
public readonly ?string $parent = null,
public string $id,
public string $object,
public string $initiator,
public int $type,
public string $recipient,
public int $lastModifiedTimestamp,
public array $permissions = [],
public string $action = '',
public bool $hasPassword = false,
public ?int $expirationTimestamp = null,
public ?string $parent = null,
) {
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@

Server::get(IAppManager::class)->loadApp('forms');

if (!interface_exists('OCP\Share\ShareReview\IShareReviewSource')) {
if (!interface_exists(\OCP\Share\ShareReview\IShareReviewSource::class)) {
require_once __DIR__ . '/Unit/ShareReview/Stubs.php';
}
34 changes: 17 additions & 17 deletions tests/stubs/ocp-share-sharereview.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,29 @@ public function getSources(): array {
}
}

final class ShareReviewPermission {
final readonly class ShareReviewPermission {
public function __construct(
public readonly string $id,
public readonly string $displayName,
public readonly ?string $hint = null,
public readonly int $priority = 50,
public string $id,
public string $displayName,
public ?string $hint = null,
public int $priority = 50,
) {
}
}

final class ShareReviewEntry {
final readonly class ShareReviewEntry {
public function __construct(
public readonly string $id,
public readonly string $object,
public readonly string $initiator,
public readonly int $type,
public readonly string $recipient,
public readonly int $lastModifiedTimestamp,
public readonly array $permissions = [],
public readonly string $action = '',
public readonly bool $hasPassword = false,
public readonly ?int $expirationTimestamp = null,
public readonly ?string $parent = null,
public string $id,
public string $object,
public string $initiator,
public int $type,
public string $recipient,
public int $lastModifiedTimestamp,
public array $permissions = [],
public string $action = '',
public bool $hasPassword = false,
public ?int $expirationTimestamp = null,
public ?string $parent = null,
) {
}
}
Expand Down
Loading