diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2015-09-21 13:13:38 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2015-09-21 13:19:35 +0200 |
commit | d2e90b6050d1c26cb365c81e987ccc1577ae56d0 (patch) | |
tree | 5ea92a89315ef9f3e0d45fe8deccaf2e9147b8c1 /tests/lib/encryption | |
parent | 6006a03ef1361f8805c323627fb6d8e9c37be9cd (diff) | |
download | nextcloud-server-d2e90b6050d1c26cb365c81e987ccc1577ae56d0.tar.gz nextcloud-server-d2e90b6050d1c26cb365c81e987ccc1577ae56d0.zip |
improved error message if user doesn't exists
Diffstat (limited to 'tests/lib/encryption')
-rw-r--r-- | tests/lib/encryption/decryptalltest.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/lib/encryption/decryptalltest.php b/tests/lib/encryption/decryptalltest.php index eb3bc721f86..c2a0711c0a0 100644 --- a/tests/lib/encryption/decryptalltest.php +++ b/tests/lib/encryption/decryptalltest.php @@ -80,11 +80,13 @@ class DecryptAllTest extends TestCase { /** * @dataProvider dataTrueFalse + * @param bool $prepareResult */ public function testDecryptAll($prepareResult) { $user = 'user1'; + $this->userManager->expects($this->once())->method('userExists')->willReturn(true); /** @var DecryptAll | \PHPUnit_Framework_MockObject_MockObject | $instance */ $instance = $this->getMockBuilder('OC\Encryption\DecryptAll') ->setConstructorArgs( @@ -121,6 +123,19 @@ class DecryptAllTest extends TestCase { } /** + * test decrypt all call with a user who doesn't exists + */ + public function testDecryptAllWrongUser() { + $this->userManager->expects($this->once())->method('userExists')->willReturn(false); + $this->outputInterface->expects($this->once())->method('writeln') + ->with('User "user1" does not exist. Please check the username and try again'); + + $this->assertFalse( + $this->instance->decryptAll($this->inputInterface, $this->outputInterface, 'user1') + ); + } + + /** * @dataProvider dataTrueFalse */ public function testPrepareEncryptionModules($success) { |