class ChangePasswordControllerTest extends \Test\TestCase {
/** @var string */
private $userId = 'currentUser';
+ /** @var string */
+ private $loginName = 'ua1337';
/** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
private $userManager;
/** @var Session|\PHPUnit_Framework_MockObject_MockObject */
}
public function testChangePersonalPasswordWrongPassword() {
+ $this->userSession->expects($this->once())
+ ->method('getLoginName')
+ ->willReturn($this->loginName);
+
$this->userManager->expects($this->once())
->method('checkPassword')
- ->with($this->userId, 'old')
+ ->with($this->loginName, 'old')
->willReturn(false);
$expects = new JSONResponse([
}
public function testChangePersonalPasswordCommonPassword() {
+ $this->userSession->expects($this->once())
+ ->method('getLoginName')
+ ->willReturn($this->loginName);
+
$user = $this->getMockBuilder(IUser::class)->getMock();
$this->userManager->expects($this->once())
->method('checkPassword')
- ->with($this->userId, 'old')
+ ->with($this->loginName, 'old')
->willReturn($user);
$user->expects($this->once())
}
public function testChangePersonalPasswordNoNewPassword() {
+ $this->userSession->expects($this->once())
+ ->method('getLoginName')
+ ->willReturn($this->loginName);
+
$user = $this->getMockBuilder(IUser::class)->getMock();
$this->userManager->expects($this->once())
->method('checkPassword')
- ->with($this->userId, 'old')
+ ->with($this->loginName, 'old')
->willReturn($user);
$expects = [
}
public function testChangePersonalPasswordCantSetPassword() {
+ $this->userSession->expects($this->once())
+ ->method('getLoginName')
+ ->willReturn($this->loginName);
+
$user = $this->getMockBuilder(IUser::class)->getMock();
$this->userManager->expects($this->once())
->method('checkPassword')
- ->with($this->userId, 'old')
+ ->with($this->loginName, 'old')
->willReturn($user);
$user->expects($this->once())
}
public function testChangePersonalPassword() {
+ $this->userSession->expects($this->once())
+ ->method('getLoginName')
+ ->willReturn($this->loginName);
+
$user = $this->getMockBuilder(IUser::class)->getMock();
$this->userManager->expects($this->once())
->method('checkPassword')
- ->with($this->userId, 'old')
+ ->with($this->loginName, 'old')
->willReturn($user);
$user->expects($this->once())