aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Repair/NC29/SanitizeAccountPropertiesTest.php
blob: d0d33eb2817ca91a6921f4b5ffa7b6328f0fac58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?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);
	}
}