blob: 5ff2da28946a6bf4f1fb7ca9f7bcb35b6fb625b3 (
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
44
45
46
47
|
<?php
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
declare(strict_types=1);
namespace Test\Authentication\Login;
use OC\Authentication\Login\ClearLostPasswordTokensCommand;
use OCP\IConfig;
use PHPUnit\Framework\MockObject\MockObject;
class ClearLostPasswordTokensCommandTest extends ALoginTestCommand {
/** @var IConfig|MockObject */
private $config;
protected function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);
$this->cmd = new ClearLostPasswordTokensCommand(
$this->config
);
}
public function testProcess(): void {
$data = $this->getLoggedInLoginData();
$this->user->expects($this->once())
->method('getUID')
->willReturn($this->username);
$this->config->expects($this->once())
->method('deleteUserValue')
->with(
$this->username,
'core',
'lostpassword'
);
$result = $this->cmd->process($data);
$this->assertTrue($result->isSuccess());
}
}
|