| @@ 142-153 (lines=12) @@ | ||
| 139 | $this->assertTrue($this->instance->recoveryKeyExists()); |
|
| 140 | } |
|
| 141 | ||
| 142 | public function testCheckRecoveryKeyPassword() { |
|
| 143 | $this->keyStorageMock->expects($this->any()) |
|
| 144 | ->method('getSystemUserKey') |
|
| 145 | ->with($this->equalTo($this->systemKeyId . '.privateKey')) |
|
| 146 | ->willReturn('recoveryKey'); |
|
| 147 | $this->cryptMock->expects($this->any()) |
|
| 148 | ->method('decryptPrivateKey') |
|
| 149 | ->with($this->equalTo('recoveryKey'), $this->equalTo('pass')) |
|
| 150 | ->willReturn('decryptedRecoveryKey'); |
|
| 151 | ||
| 152 | $this->assertTrue($this->instance->checkRecoveryPassword('pass')); |
|
| 153 | } |
|
| 154 | ||
| 155 | public function testSetPublicKey() { |
|
| 156 | $this->keyStorageMock->expects($this->any()) |
|
| @@ 86-102 (lines=17) @@ | ||
| 83 | $this->assertFalse($this->instance->enableAdminRecovery('password')); |
|
| 84 | } |
|
| 85 | ||
| 86 | public function testChangeRecoveryKeyPassword() { |
|
| 87 | $this->assertFalse($this->instance->changeRecoveryKeyPassword('password', |
|
| 88 | 'passwordOld')); |
|
| 89 | ||
| 90 | $this->keyManagerMock->expects($this->once()) |
|
| 91 | ->method('getSystemPrivateKey'); |
|
| 92 | ||
| 93 | $this->cryptMock->expects($this->once()) |
|
| 94 | ->method('decryptPrivateKey'); |
|
| 95 | ||
| 96 | $this->cryptMock->expects($this->once()) |
|
| 97 | ->method('encryptPrivateKey') |
|
| 98 | ->willReturn(true); |
|
| 99 | ||
| 100 | $this->assertTrue($this->instance->changeRecoveryKeyPassword('password', |
|
| 101 | 'passwordOld')); |
|
| 102 | } |
|
| 103 | ||
| 104 | public function testDisableAdminRecovery() { |
|
| 105 | ||