Skip to content

Commit 2510485

Browse files
committed
refactor: Port External\Manager to the query builder
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
1 parent f16958f commit 2510485

File tree

9 files changed

+135
-246
lines changed

9 files changed

+135
-246
lines changed

apps/dav/lib/Migration/BuildSocialSearchIndex.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
class BuildSocialSearchIndex implements IRepairStep {
1616

1717
public function __construct(
18-
readonly private IDBConnection $db,
19-
readonly private IJobList $jobList,
20-
readonly private IAppConfig $config,
18+
private readonly IDBConnection $db,
19+
private readonly IJobList $jobList,
20+
private readonly IAppConfig $config,
2121
) {
2222
}
2323

@@ -30,7 +30,7 @@ public function getName(): string {
3030
*/
3131
public function run(IOutput $output) {
3232
// only run once
33-
if ($this->config->getValueString('dav', 'builtSocialSearchIndex') === 'yes') {
33+
if ($this->config->getValueBool('dav', 'builtSocialSearchIndex')) {
3434
$output->info('Repair step already executed');
3535
return;
3636
}
@@ -52,6 +52,6 @@ public function run(IOutput $output) {
5252
]);
5353

5454
// no need to redo the repair during next upgrade
55-
$this->config->setValueString('dav', 'builtSocialSearchIndex', 'yes');
55+
$this->config->setValueBool('dav', 'builtSocialSearchIndex', true);
5656
}
5757
}

apps/dav/tests/unit/BackgroundJob/CleanupInvitationTokenJobTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public function testRun(): void {
3939

4040
$queryBuilder = $this->createMock(IQueryBuilder::class);
4141
$expr = $this->createMock(IExpressionBuilder::class);
42-
$stmt = $this->createMock(\Doctrine\DBAL\Driver\Statement::class);
4342

4443
$this->dbConnection->expects($this->once())
4544
->method('getQueryBuilder')
@@ -72,9 +71,9 @@ public function testRun(): void {
7271
->with($function)
7372
->willReturn($queryBuilder);
7473
$queryBuilder->expects($this->once())
75-
->method('execute')
74+
->method('executeStatement')
7675
->with()
77-
->willReturn($stmt);
76+
->willReturn(1);
7877

7978
$this->backgroundJob->run([]);
8079
}

apps/dav/tests/unit/Migration/RefreshWebcalJobRegistrarTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function testRun(): void {
5454
->with('calendarsubscriptions')
5555
->willReturn($queryBuilder);
5656
$queryBuilder->expects($this->once())
57-
->method('execute')
57+
->method('executeQuery')
5858
->willReturn($statement);
5959

6060
$statement->expects($this->exactly(4))

apps/dav/tests/unit/Migration/RemoveDeletedUsersCalendarSubscriptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function testRun(array $subscriptions, array $userExists, int $deletions)
7272

7373
$result = $this->createMock(IResult::class);
7474

75-
$qb->method('execute')
75+
$qb->method('executeQuery')
7676
->willReturn($result);
7777

7878
$result->expects($this->once())

0 commit comments

Comments
 (0)