-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dav): Create SAB at installation
Signed-off-by: Christoph Wurst <[email protected]>
- Loading branch information
1 parent
afae742
commit 2528e70
Showing
6 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
namespace OCA\DAV\Migration; | ||
|
||
use OCA\DAV\CardDAV\SyncService; | ||
use OCP\Migration\IOutput; | ||
use OCP\Migration\IRepairStep; | ||
|
||
class CreateSystemAddressBookStep implements IRepairStep { | ||
|
||
public function __construct( | ||
private SyncService $syncService, | ||
) { | ||
} | ||
|
||
public function getName(): string { | ||
return 'Create system address book'; | ||
} | ||
|
||
public function run(IOutput $output): void { | ||
$this->syncService->ensureLocalSystemAddressBookExists(); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
apps/dav/tests/unit/Migration/CreateSystemAddressBookStepTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
namespace OCA\DAV\Tests\Unit\Migration; | ||
|
||
use OCA\DAV\CardDAV\SyncService; | ||
use OCA\DAV\Migration\CreateSystemAddressBookStep; | ||
use OCP\Migration\IOutput; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class CreateSystemAddressBookStepTest extends TestCase { | ||
|
||
private SyncService|MockObject $syncService; | ||
private CreateSystemAddressBookStep $step; | ||
|
||
protected function setUp(): void { | ||
parent::setUp(); | ||
|
||
$this->syncService = $this->createMock(SyncService::class); | ||
|
||
$this->step = new CreateSystemAddressBookStep( | ||
$this->syncService, | ||
); | ||
} | ||
|
||
public function testGetName(): void { | ||
$name = $this->step->getName(); | ||
|
||
self::assertEquals('Create system address book', $name); | ||
} | ||
|
||
public function testRun(): void { | ||
$output = $this->createMock(IOutput::class); | ||
|
||
$this->step->run($output); | ||
|
||
$this->addToAssertionCount(1); | ||
} | ||
|
||
} |