diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2022-06-21 11:45:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-21 11:45:00 +0200 |
commit | fd8f2aff09c93b81c120a05e0441a1677d8dde7c (patch) | |
tree | 9168addbe74aa1bac9a5b73164f04c607f68c5bb /tests/lib/Encryption/Keys/StorageTest.php | |
parent | 20fc8d8f30012edcd9f1d4e92dd4704bc5b77492 (diff) | |
parent | 6a1510f8ee48494a19dc1239fd2584dc2188e18d (diff) | |
download | nextcloud-server-fd8f2aff09c93b81c120a05e0441a1677d8dde7c.tar.gz nextcloud-server-fd8f2aff09c93b81c120a05e0441a1677d8dde7c.zip |
Merge pull request #32901 from nextcloud/fix/remove-at-matcher-in-lib-tests
Remove at matcher uses in tests/lib
Diffstat (limited to 'tests/lib/Encryption/Keys/StorageTest.php')
-rw-r--r-- | tests/lib/Encryption/Keys/StorageTest.php | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php index 30680646f73..bb7bbbcd7c1 100644 --- a/tests/lib/Encryption/Keys/StorageTest.php +++ b/tests/lib/Encryption/Keys/StorageTest.php @@ -162,21 +162,21 @@ class StorageTest extends TestCase { ->method('isSystemWideMountPoint') ->willReturn(false); - $this->view->expects($this->at(0)) - ->method('file_exists') - ->with($this->equalTo('/user1/files_encryption/keys' . $strippedPartialName . '/encModule/fileKey')) - ->willReturn($originalKeyExists); - $this->crypto->method('decrypt') ->willReturnCallback(function ($data, $pass) { return $data; }); if (!$originalKeyExists) { - $this->view->expects($this->at(1)) + $this->view->expects($this->exactly(2)) ->method('file_exists') - ->with($this->equalTo('/user1/files_encryption/keys' . $path . '/encModule/fileKey')) - ->willReturn(true); + ->withConsecutive( + [$this->equalTo('/user1/files_encryption/keys' . $strippedPartialName . '/encModule/fileKey')], + [$this->equalTo('/user1/files_encryption/keys' . $path . '/encModule/fileKey')], + )->willReturnOnConsecutiveCalls( + $originalKeyExists, + true, + ); $this->view->expects($this->once()) ->method('file_get_contents') @@ -184,6 +184,11 @@ class StorageTest extends TestCase { ->willReturn(json_encode(['key' => base64_encode('key2')])); } else { $this->view->expects($this->once()) + ->method('file_exists') + ->with($this->equalTo('/user1/files_encryption/keys' . $strippedPartialName . '/encModule/fileKey')) + ->willReturn($originalKeyExists); + + $this->view->expects($this->once()) ->method('file_get_contents') ->with($this->equalTo('/user1/files_encryption/keys' . $strippedPartialName . '/encModule/fileKey')) ->willReturn(json_encode(['key' => base64_encode('key')])); @@ -627,10 +632,11 @@ class StorageTest extends TestCase { ->with('user1/files_encryption/backup')->willReturn(!$createBackupDir); if ($createBackupDir) { - $this->view->expects($this->at(1))->method('mkdir') - ->with('user1/files_encryption/backup'); - $this->view->expects($this->at(2))->method('mkdir') - ->with('user1/files_encryption/backup/test.encryptionModule.1234567'); + $this->view->expects($this->exactly(2))->method('mkdir') + ->withConsecutive( + ['user1/files_encryption/backup'], + ['user1/files_encryption/backup/test.encryptionModule.1234567'], + ); } else { $this->view->expects($this->once())->method('mkdir') ->with('user1/files_encryption/backup/test.encryptionModule.1234567'); |