0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-03-04 20:14:50 +00:00
nextcloud_server/tests/lib/Repair/NC29/SanitizeAccountPropertiesTest.php
Ferdinand Thiessen e3af27b280
refactor: convert sanitize account properties repair step to background job
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-02-24 15:16:28 +01:00

43 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Repair\NC29;
use OCP\BackgroundJob\IJobList;
use OCP\Migration\IOutput;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class SanitizeAccountPropertiesTest extends TestCase {
private IJobList&MockObject $jobList;
private SanitizeAccountProperties $repairStep;
protected function setUp(): void {
$this->jobList = $this->createMock(IJobList::class);
$this->repairStep = new SanitizeAccountProperties($this->jobList);
}
public function testGetName(): void {
self::assertStringContainsString('Validate account properties', $this->repairStep->getName());
}
public function testRun(): void {
$this->jobList->expects(self::once())
->method('add')
->with(SanitizeAccountPropertiesJob::class, null);
$output = $this->createMock(IOutput::class);
$output->expects(self::once())
->method('info')
->with(self::matchesRegularExpression('/queued background/i'));
$this->repairStep->run($output);
}
}