diff --git a/lib/Command/RecreateMasterKey.php b/lib/Command/RecreateMasterKey.php index b9890895..c499433c 100644 --- a/lib/Command/RecreateMasterKey.php +++ b/lib/Command/RecreateMasterKey.php @@ -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("\nNote: All users are required to relogin.\n"); } else { $output->writeln("The process is abandoned"); } diff --git a/tests/unit/Command/RecreateMasterKeyTest.php b/tests/unit/Command/RecreateMasterKeyTest.php index ead060b3..5bdce689 100644 --- a/tests/unit/Command/RecreateMasterKeyTest.php +++ b/tests/unit/Command/RecreateMasterKeyTest.php @@ -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("\nNote: All users are required to relogin.\n", $reloginText); $outputText=""; } else { $this->recreateMasterKey = $this->getMockBuilder('OCA\Encryption\Command\RecreateMasterKey')