2323use OCP \Security \ISecureRandom ;
2424use OCP \UserInterface ;
2525use PHPUnit \Framework \MockObject \MockObject ;
26+ use Psr \Log \LoggerInterface ;
2627use Symfony \Component \Console \Formatter \OutputFormatterInterface ;
2728use Symfony \Component \Console \Helper \ProgressBar ;
2829use Symfony \Component \Console \Helper \QuestionHelper ;
@@ -46,6 +47,7 @@ class EncryptAllTest extends TestCase {
4647 protected \Symfony \Component \Console \Output \OutputInterface &MockObject $ outputInterface ;
4748 protected UserInterface &MockObject $ userInterface ;
4849 protected ISecureRandom &MockObject $ secureRandom ;
50+ protected LoggerInterface &MockObject $ logger ;
4951
5052 protected EncryptAll $ encryptAll ;
5153
@@ -76,6 +78,7 @@ protected function setUp(): void {
7678 ->disableOriginalConstructor ()->getMock ();
7779 $ this ->userInterface = $ this ->getMockBuilder (UserInterface::class)
7880 ->disableOriginalConstructor ()->getMock ();
81+ $ this ->logger = $ this ->createMock (LoggerInterface::class);
7982
8083 /**
8184 * We need format method to return a string
@@ -106,12 +109,13 @@ protected function setUp(): void {
106109 $ this ->l ,
107110 $ this ->l10nFactory ,
108111 $ this ->questionHelper ,
109- $ this ->secureRandom
112+ $ this ->secureRandom ,
113+ $ this ->logger ,
110114 );
111115 }
112116
113117 public function testEncryptAll (): void {
114- /** @var EncryptAll | \PHPUnit\Framework\ MockObject\MockObject $encryptAll */
118+ /** @var EncryptAll& MockObject $encryptAll */
115119 $ encryptAll = $ this ->getMockBuilder (EncryptAll::class)
116120 ->setConstructorArgs (
117121 [
@@ -125,7 +129,8 @@ public function testEncryptAll(): void {
125129 $ this ->l ,
126130 $ this ->l10nFactory ,
127131 $ this ->questionHelper ,
128- $ this ->secureRandom
132+ $ this ->secureRandom ,
133+ $ this ->logger ,
129134 ]
130135 )
131136 ->onlyMethods (['createKeyPairs ' , 'encryptAllUsersFiles ' , 'outputPasswords ' ])
@@ -140,7 +145,7 @@ public function testEncryptAll(): void {
140145 }
141146
142147 public function testEncryptAllWithMasterKey (): void {
143- /** @var EncryptAll | \PHPUnit\Framework\ MockObject\MockObject $encryptAll */
148+ /** @var EncryptAll& MockObject $encryptAll */
144149 $ encryptAll = $ this ->getMockBuilder (EncryptAll::class)
145150 ->setConstructorArgs (
146151 [
@@ -154,7 +159,8 @@ public function testEncryptAllWithMasterKey(): void {
154159 $ this ->l ,
155160 $ this ->l10nFactory ,
156161 $ this ->questionHelper ,
157- $ this ->secureRandom
162+ $ this ->secureRandom ,
163+ $ this ->logger ,
158164 ]
159165 )
160166 ->onlyMethods (['createKeyPairs ' , 'encryptAllUsersFiles ' , 'outputPasswords ' ])
@@ -170,7 +176,7 @@ public function testEncryptAllWithMasterKey(): void {
170176 }
171177
172178 public function testCreateKeyPairs (): void {
173- /** @var EncryptAll | \PHPUnit\Framework\ MockObject\MockObject $encryptAll */
179+ /** @var EncryptAll& MockObject $encryptAll */
174180 $ encryptAll = $ this ->getMockBuilder (EncryptAll::class)
175181 ->setConstructorArgs (
176182 [
@@ -184,7 +190,8 @@ public function testCreateKeyPairs(): void {
184190 $ this ->l ,
185191 $ this ->l10nFactory ,
186192 $ this ->questionHelper ,
187- $ this ->secureRandom
193+ $ this ->secureRandom ,
194+ $ this ->logger ,
188195 ]
189196 )
190197 ->onlyMethods (['setupUserFS ' , 'generateOneTimePassword ' ])
@@ -234,7 +241,8 @@ public function testEncryptAllUsersFiles(): void {
234241 $ this ->l ,
235242 $ this ->l10nFactory ,
236243 $ this ->questionHelper ,
237- $ this ->secureRandom
244+ $ this ->secureRandom ,
245+ $ this ->logger ,
238246 ]
239247 )
240248 ->onlyMethods (['encryptUsersFiles ' ])
@@ -275,7 +283,8 @@ public function testEncryptUsersFiles(): void {
275283 $ this ->l ,
276284 $ this ->l10nFactory ,
277285 $ this ->questionHelper ,
278- $ this ->secureRandom
286+ $ this ->secureRandom ,
287+ $ this ->logger ,
279288 ]
280289 )
281290 ->onlyMethods (['encryptFile ' , 'setupUserFS ' ])
0 commit comments