Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add re-login information after successful action #21

Merged
merged 1 commit into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/Command/RecreateMasterKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$this->keyManager->validateMasterKey();
$this->encryptAllUsers($input, $output);
$output->writeln("\nEncryption completed successfully\n");
$output->writeln("\n<info>Note: All users are required to relogin.</info>\n");
} else {
$output->writeln("The process is abandoned");
}
Expand Down
13 changes: 10 additions & 3 deletions tests/unit/Command/RecreateMasterKeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,24 @@ function ($path) {
->with('user1')
->willReturn(true);

global $outputText;
$outputText = '';
$reloginText = '';

$this->output->expects($this->at(16))
->method('writeln')
->willReturnCallback(function ($value) {
global $outputText;
->willReturnCallback(function ($value) use (&$outputText) {
$outputText .= $value . "\n";
});

$this->output->expects($this->at(17))
->method('writeln')
->willReturnCallback(function ($value) use (&$reloginText) {
$reloginText = $value;
});

$this->invokePrivate($this->recreateMasterKey, 'execute', [$this->input, $this->output]);
$this->assertSame("Encryption completed successfully", \trim($outputText, "\n"));
$this->assertEquals("\n<info>Note: All users are required to relogin.</info>\n", $reloginText);
$outputText="";
} else {
$this->recreateMasterKey = $this->getMockBuilder('OCA\Encryption\Command\RecreateMasterKey')
Expand Down