Skip to content

Commit 3917a54

Browse files
committed
Class "ProgressBar" is declared "final" and cannot be mocked.
Signed-off-by: Joas Schilling <[email protected]>
1 parent bf2be08 commit 3917a54

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

apps/encryption/tests/Crypto/EncryptAllTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,10 @@ function($path) {
335335
$encryptAll->expects($this->at(1))->method('encryptFile')->with('/user1/files/bar');
336336
$encryptAll->expects($this->at(2))->method('encryptFile')->with('/user1/files/foo/subfile');
337337

338-
$progressBar = $this->getMockBuilder(ProgressBar::class)
339-
->disableOriginalConstructor()->getMock();
338+
$this->outputInterface->expects($this->any())
339+
->method('getFormatter')
340+
->willReturn($this->createMock(OutputFormatterInterface::class));
341+
$progressBar = new ProgressBar($this->outputInterface);
340342

341343
$this->invokePrivate($encryptAll, 'encryptUsersFiles', ['user1', $progressBar, '']);
342344

tests/lib/Encryption/DecryptAllTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,11 @@ function($path) {
301301
->method('decryptFile')
302302
->with('/user1/files/foo/subfile');
303303

304-
$progressBar = $this->getMockBuilder(ProgressBar::class)
305-
->disableOriginalConstructor()->getMock();
304+
$output = $this->createMock(OutputInterface::class);
305+
$output->expects($this->any())
306+
->method('getFormatter')
307+
->willReturn($this->createMock(OutputFormatterInterface::class));
308+
$progressBar = new ProgressBar($output);
306309

307310
$this->invokePrivate($instance, 'decryptUsersFiles', ['user1', $progressBar, '']);
308311

0 commit comments

Comments
 (0)