diff options
Diffstat (limited to 'tests/Core/Command/Encryption')
-rw-r--r-- | tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php | 42 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/DecryptAllTest.php | 50 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/DisableTest.php | 7 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/EnableTest.php | 47 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/EncryptAllTest.php | 62 | ||||
-rw-r--r-- | tests/Core/Command/Encryption/SetDefaultModuleTest.php | 19 |
6 files changed, 106 insertions, 121 deletions
diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php index b124a27f9ab..0bc6cbb64cf 100644 --- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php +++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -8,6 +9,7 @@ namespace Tests\Core\Command\Encryption; use OC\Core\Command\Encryption\ChangeKeyStorageRoot; +use OC\Encryption\Keys\Storage; use OC\Encryption\Util; use OC\Files\View; use OCP\IConfig; @@ -44,7 +46,7 @@ class ChangeKeyStorageRootTest extends TestCase { /** @var OutputInterface | \PHPUnit\Framework\MockObject\MockObject */ protected $outputInterface; - /** @var \OCP\UserInterface | \PHPUnit\Framework\MockObject\MockObject */ + /** @var UserInterface|\PHPUnit\Framework\MockObject\MockObject */ protected $userInterface; protected function setUp(): void { @@ -76,9 +78,7 @@ class ChangeKeyStorageRootTest extends TestCase { ); } - /** - * @dataProvider dataTestExecute - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestExecute')] public function testExecute($newRoot, $answer, $successMoveKey): void { $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( @@ -89,7 +89,7 @@ class ChangeKeyStorageRootTest extends TestCase { $this->util, $this->questionHelper ] - )->setMethods(['moveAllKeys'])->getMock(); + )->onlyMethods(['moveAllKeys'])->getMock(); $this->util->expects($this->once())->method('getKeyStorageRoot') ->willReturn(''); @@ -122,7 +122,7 @@ class ChangeKeyStorageRootTest extends TestCase { ); } - public function dataTestExecute() { + public static function dataTestExecute(): array { return [ [null, true, true], [null, true, false], @@ -133,7 +133,7 @@ class ChangeKeyStorageRootTest extends TestCase { } public function testMoveAllKeys(): void { - /** @var \OC\Core\Command\Encryption\ChangeKeyStorageRoot $changeKeyStorageRoot */ + /** @var ChangeKeyStorageRoot $changeKeyStorageRoot */ $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( [ @@ -143,7 +143,7 @@ class ChangeKeyStorageRootTest extends TestCase { $this->util, $this->questionHelper ] - )->setMethods(['prepareNewRoot', 'moveSystemKeys', 'moveUserKeys'])->getMock(); + )->onlyMethods(['prepareNewRoot', 'moveSystemKeys', 'moveUserKeys'])->getMock(); $changeKeyStorageRoot->expects($this->once())->method('prepareNewRoot')->with('newRoot'); $changeKeyStorageRoot->expects($this->once())->method('moveSystemKeys')->with('oldRoot', 'newRoot'); @@ -157,18 +157,18 @@ class ChangeKeyStorageRootTest extends TestCase { ->willReturn(true); $this->view->expects($this->once())->method('file_put_contents') - ->with('newRoot/' . \OC\Encryption\Keys\Storage::KEY_STORAGE_MARKER, + ->with('newRoot/' . Storage::KEY_STORAGE_MARKER, 'Nextcloud will detect this folder as key storage root only if this file exists')->willReturn(true); $this->invokePrivate($this->changeKeyStorageRoot, 'prepareNewRoot', ['newRoot']); } /** - * @dataProvider dataTestPrepareNewRootException * * @param bool $dirExists * @param bool $couldCreateFile */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestPrepareNewRootException')] public function testPrepareNewRootException($dirExists, $couldCreateFile): void { $this->expectException(\Exception::class); @@ -179,7 +179,7 @@ class ChangeKeyStorageRootTest extends TestCase { $this->invokePrivate($this->changeKeyStorageRoot, 'prepareNewRoot', ['newRoot']); } - public function dataTestPrepareNewRootException() { + public static function dataTestPrepareNewRootException(): array { return [ [true, false], [true, null], @@ -188,12 +188,12 @@ class ChangeKeyStorageRootTest extends TestCase { } /** - * @dataProvider dataTestMoveSystemKeys * * @param bool $dirExists * @param bool $targetExists * @param bool $executeRename */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestMoveSystemKeys')] public function testMoveSystemKeys($dirExists, $targetExists, $executeRename): void { $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( @@ -204,7 +204,7 @@ class ChangeKeyStorageRootTest extends TestCase { $this->util, $this->questionHelper ] - )->setMethods(['targetExists'])->getMock(); + )->onlyMethods(['targetExists'])->getMock(); $this->view->expects($this->once())->method('is_dir') ->with('oldRoot/files_encryption')->willReturn($dirExists); @@ -221,7 +221,7 @@ class ChangeKeyStorageRootTest extends TestCase { $this->invokePrivate($changeKeyStorageRoot, 'moveSystemKeys', ['oldRoot', 'newRoot']); } - public function dataTestMoveSystemKeys() { + public static function dataTestMoveSystemKeys(): array { return [ [true, false, true], [false, true, false], @@ -241,7 +241,7 @@ class ChangeKeyStorageRootTest extends TestCase { $this->util, $this->questionHelper ] - )->setMethods(['setupUserFS', 'moveUserEncryptionFolder'])->getMock(); + )->onlyMethods(['setupUserFS', 'moveUserEncryptionFolder'])->getMock(); $this->userManager->expects($this->once())->method('getBackends') ->willReturn([$this->userInterface]); @@ -254,13 +254,13 @@ class ChangeKeyStorageRootTest extends TestCase { } /** - * @dataProvider dataTestMoveUserEncryptionFolder * * @param bool $userExists * @param bool $isDir * @param bool $targetExists * @param bool $shouldRename */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestMoveUserEncryptionFolder')] public function testMoveUserEncryptionFolder($userExists, $isDir, $targetExists, $shouldRename): void { $changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot') ->setConstructorArgs( @@ -271,7 +271,7 @@ class ChangeKeyStorageRootTest extends TestCase { $this->util, $this->questionHelper ] - )->setMethods(['targetExists', 'prepareParentFolder'])->getMock(); + )->onlyMethods(['targetExists', 'prepareParentFolder'])->getMock(); $this->userManager->expects($this->once())->method('userExists') ->willReturn($userExists); @@ -293,7 +293,7 @@ class ChangeKeyStorageRootTest extends TestCase { $this->invokePrivate($changeKeyStorageRoot, 'moveUserEncryptionFolder', ['user1', 'oldRoot', 'newRoot']); } - public function dataTestMoveUserEncryptionFolder() { + public static function dataTestMoveUserEncryptionFolder(): array { return [ [true, true, false, true], [true, false, true, false], @@ -306,9 +306,7 @@ class ChangeKeyStorageRootTest extends TestCase { } - /** - * @dataProvider dataTestPrepareParentFolder - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestPrepareParentFolder')] public function testPrepareParentFolder($path, $pathExists): void { $this->view->expects($this->any())->method('file_exists') ->willReturnCallback( @@ -334,7 +332,7 @@ class ChangeKeyStorageRootTest extends TestCase { ); } - public function dataTestPrepareParentFolder() { + public static function dataTestPrepareParentFolder(): array { return [ ['/user/folder/sub_folder/keystorage', true], ['/user/folder/sub_folder/keystorage', false] diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php index 6ed4cbbea99..41d9e4c713f 100644 --- a/tests/Core/Command/Encryption/DecryptAllTest.php +++ b/tests/Core/Command/Encryption/DecryptAllTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -17,13 +18,13 @@ use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; class DecryptAllTest extends TestCase { - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */ + /** @var \PHPUnit\Framework\MockObject\MockObject|IConfig */ protected $config; /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */ protected $encryptionManager; - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */ + /** @var \PHPUnit\Framework\MockObject\MockObject|IAppManager */ protected $appManager; /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ @@ -73,12 +74,16 @@ class DecryptAllTest extends TestCase { public function testMaintenanceAndTrashbin(): void { // on construct we enable single-user-mode and disable the trash bin // on destruct we disable single-user-mode again and enable the trash bin + $calls = [ + ['maintenance', true], + ['maintenance', false], + ]; $this->config->expects($this->exactly(2)) ->method('setSystemValue') - ->withConsecutive( - ['maintenance', true], - ['maintenance', false], - ); + ->willReturnCallback(function () use (&$calls): void { + $expected = array_shift($calls); + $this->assertEquals($expected, func_get_args()); + }); $this->appManager->expects($this->once()) ->method('disableApp') ->with('files_trashbin'); @@ -105,9 +110,7 @@ class DecryptAllTest extends TestCase { $this->invokePrivate($instance, 'resetMaintenanceAndTrashbin'); } - /** - * @dataProvider dataTestExecute - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestExecute')] public function testExecute($encryptionEnabled, $continue): void { $instance = new DecryptAll( $this->encryptionManager, @@ -127,12 +130,16 @@ class DecryptAllTest extends TestCase { ->willReturn('user1'); if ($encryptionEnabled) { + $calls = [ + ['core', 'encryption_enabled', 'no'], + ['core', 'encryption_enabled', 'yes'], + ]; $this->config->expects($this->exactly(2)) ->method('setAppValue') - ->withConsecutive( - ['core', 'encryption_enabled', 'no'], - ['core', 'encryption_enabled', 'yes'], - ); + ->willReturnCallback(function () use (&$calls): void { + $expected = array_shift($calls); + $this->assertEquals($expected, func_get_args()); + }); $this->questionHelper->expects($this->once()) ->method('ask') ->willReturn($continue); @@ -152,7 +159,7 @@ class DecryptAllTest extends TestCase { $this->invokePrivate($instance, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function dataTestExecute() { + public static function dataTestExecute(): array { return [ [true, true], [true, false], @@ -174,13 +181,16 @@ class DecryptAllTest extends TestCase { ); // make sure that we enable encryption again after a exception was thrown + $calls = [ + ['core', 'encryption_enabled', 'no'], + ['core', 'encryption_enabled', 'yes'], + ]; $this->config->expects($this->exactly(2)) ->method('setAppValue') - ->withConsecutive( - ['core', 'encryption_enabled', 'no'], - ['core', 'encryption_enabled', 'yes'], - ); - + ->willReturnCallback(function () use (&$calls): void { + $expected = array_shift($calls); + $this->assertEquals($expected, func_get_args()); + }); $this->encryptionManager->expects($this->once()) ->method('isEnabled') ->willReturn(true); @@ -197,7 +207,7 @@ class DecryptAllTest extends TestCase { $this->decryptAll->expects($this->once()) ->method('decryptAll') ->with($this->consoleInput, $this->consoleOutput, 'user1') - ->willReturnCallback(function () { + ->willReturnCallback(function (): void { throw new \Exception(); }); diff --git a/tests/Core/Command/Encryption/DisableTest.php b/tests/Core/Command/Encryption/DisableTest.php index 913d03a8850..a89fd636e47 100644 --- a/tests/Core/Command/Encryption/DisableTest.php +++ b/tests/Core/Command/Encryption/DisableTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -33,12 +34,12 @@ class DisableTest extends TestCase { $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); - /** @var \OCP\IConfig $config */ + /** @var IConfig $config */ $this->command = new Disable($config); } - public function dataDisable() { + public static function dataDisable(): array { return [ ['yes', true, 'Encryption disabled'], ['no', false, 'Encryption is already disabled'], @@ -46,12 +47,12 @@ class DisableTest extends TestCase { } /** - * @dataProvider dataDisable * * @param string $oldStatus * @param bool $isUpdating * @param string $expectedString */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataDisable')] public function testDisable($oldStatus, $isUpdating, $expectedString): void { $this->config->expects($this->once()) ->method('getAppValue') diff --git a/tests/Core/Command/Encryption/EnableTest.php b/tests/Core/Command/Encryption/EnableTest.php index 2d463452add..32d1a7576f5 100644 --- a/tests/Core/Command/Encryption/EnableTest.php +++ b/tests/Core/Command/Encryption/EnableTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -45,7 +46,7 @@ class EnableTest extends TestCase { } - public function dataEnable() { + public static function dataEnable(): array { return [ ['no', null, [], true, 'Encryption enabled', 'No encryption module is loaded'], ['yes', null, [], false, 'Encryption is already enabled', 'No encryption module is loaded'], @@ -55,17 +56,8 @@ class EnableTest extends TestCase { ]; } - /** - * @dataProvider dataEnable - * - * @param string $oldStatus - * @param string $defaultModule - * @param array $availableModules - * @param bool $isUpdating - * @param string $expectedString - * @param string $expectedDefaultModuleString - */ - public function testEnable($oldStatus, $defaultModule, $availableModules, $isUpdating, $expectedString, $expectedDefaultModuleString): void { + #[\PHPUnit\Framework\Attributes\DataProvider('dataEnable')] + public function testEnable(string $oldStatus, ?string $defaultModule, array $availableModules, bool $isUpdating, string $expectedString, string $expectedDefaultModuleString): void { if ($isUpdating) { $this->config->expects($this->once()) ->method('setAppValue') @@ -79,27 +71,30 @@ class EnableTest extends TestCase { if (empty($availableModules)) { $this->config->expects($this->once()) ->method('getAppValue') - ->with('core', 'encryption_enabled', $this->anything()) - ->willReturn($oldStatus); + ->willReturnMap([ + ['core', 'encryption_enabled', 'no', $oldStatus], + ]); } else { $this->config->expects($this->exactly(2)) ->method('getAppValue') - ->withConsecutive( - ['core', 'encryption_enabled', $this->anything()], - ['core', 'default_encryption_module', $this->anything()], - )->willReturnOnConsecutiveCalls( - $oldStatus, - $defaultModule, - ); + ->willReturnMap([ + ['core', 'encryption_enabled', 'no', $oldStatus], + ['core', 'default_encryption_module', null, $defaultModule], + ]); } + $calls = [ + [$expectedString, 0], + ['', 0], + [$expectedDefaultModuleString, 0], + ]; $this->consoleOutput->expects($this->exactly(3)) ->method('writeln') - ->withConsecutive( - [$this->stringContains($expectedString)], - [''], - [$this->stringContains($expectedDefaultModuleString)], - ); + ->willReturnCallback(function (string $message, int $level) use (&$calls): void { + $call = array_shift($calls); + $this->assertStringContainsString($call[0], $message); + $this->assertSame($call[1], $level); + }); self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } diff --git a/tests/Core/Command/Encryption/EncryptAllTest.php b/tests/Core/Command/Encryption/EncryptAllTest.php index 6e72e87b973..15cbe83737d 100644 --- a/tests/Core/Command/Encryption/EncryptAllTest.php +++ b/tests/Core/Command/Encryption/EncryptAllTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -12,59 +13,36 @@ use OCP\App\IAppManager; use OCP\Encryption\IEncryptionModule; use OCP\Encryption\IManager; use OCP\IConfig; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; class EncryptAllTest extends TestCase { - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */ - protected $config; - - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */ - protected $encryptionManager; - - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */ - protected $appManager; - - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */ - protected $consoleInput; - - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */ - protected $consoleOutput; - - /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Helper\QuestionHelper */ - protected $questionHelper; - - /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IEncryptionModule */ - protected $encryptionModule; + private IConfig&MockObject $config; + private IManager&MockObject $encryptionManager; + private IAppManager&MockObject $appManager; + private InputInterface&MockObject $consoleInput; + private OutputInterface&MockObject $consoleOutput; + private QuestionHelper&MockObject $questionHelper; + private IEncryptionModule&MockObject $encryptionModule; - /** @var EncryptAll */ - protected $command; + private EncryptAll $command; protected function setUp(): void { parent::setUp(); - $this->config = $this->getMockBuilder(IConfig::class) - ->disableOriginalConstructor() - ->getMock(); - $this->encryptionManager = $this->getMockBuilder(IManager::class) - ->disableOriginalConstructor() - ->getMock(); - $this->appManager = $this->getMockBuilder(IAppManager::class) - ->disableOriginalConstructor() - ->getMock(); - $this->encryptionModule = $this->getMockBuilder(IEncryptionModule::class) - ->disableOriginalConstructor() - ->getMock(); - $this->questionHelper = $this->getMockBuilder(QuestionHelper::class) - ->disableOriginalConstructor() - ->getMock(); - $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock(); + $this->config = $this->createMock(IConfig::class); + $this->encryptionManager = $this->createMock(IManager::class); + $this->appManager = $this->createMock(IAppManager::class); + $this->encryptionModule = $this->createMock(IEncryptionModule::class); + $this->questionHelper = $this->createMock(QuestionHelper::class); + $this->consoleInput = $this->createMock(InputInterface::class); $this->consoleInput->expects($this->any()) ->method('isInteractive') ->willReturn(true); - $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); + $this->consoleOutput = $this->createMock(OutputInterface::class); } public function testEncryptAll(): void { @@ -77,9 +55,7 @@ class EncryptAllTest extends TestCase { $this->invokePrivate($instance, 'resetMaintenanceAndTrashbin'); } - /** - * @dataProvider dataTestExecute - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTestExecute')] public function testExecute($answer, $askResult): void { $command = new EncryptAll($this->encryptionManager, $this->appManager, $this->config, $this->questionHelper); @@ -99,7 +75,7 @@ class EncryptAllTest extends TestCase { $this->invokePrivate($command, 'execute', [$this->consoleInput, $this->consoleOutput]); } - public function dataTestExecute() { + public static function dataTestExecute(): array { return [ ['y', true], ['Y', true], ['n', false], ['N', false], ['', false] ]; diff --git a/tests/Core/Command/Encryption/SetDefaultModuleTest.php b/tests/Core/Command/Encryption/SetDefaultModuleTest.php index 0a2c2a81c28..df38d730db3 100644 --- a/tests/Core/Command/Encryption/SetDefaultModuleTest.php +++ b/tests/Core/Command/Encryption/SetDefaultModuleTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -43,7 +44,7 @@ class SetDefaultModuleTest extends TestCase { } - public function dataSetDefaultModule() { + public static function dataSetDefaultModule(): array { return [ ['ID0', 'ID0', null, null, 'already'], ['ID0', 'ID1', 'ID1', true, 'info'], @@ -52,7 +53,6 @@ class SetDefaultModuleTest extends TestCase { } /** - * @dataProvider dataSetDefaultModule * * @param string $oldModule * @param string $newModule @@ -60,6 +60,7 @@ class SetDefaultModuleTest extends TestCase { * @param bool $updateSuccess * @param string $expectedString */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataSetDefaultModule')] public function testSetDefaultModule($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString): void { $this->consoleInput->expects($this->once()) ->method('getArgument') @@ -90,7 +91,6 @@ class SetDefaultModuleTest extends TestCase { } /** - * @dataProvider dataSetDefaultModule * * @param string $oldModule * @param string $newModule @@ -98,6 +98,7 @@ class SetDefaultModuleTest extends TestCase { * @param bool $updateSuccess * @param string $expectedString */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataSetDefaultModule')] public function testMaintenanceMode($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString): void { $this->consoleInput->expects($this->never()) ->method('getArgument') @@ -113,12 +114,16 @@ class SetDefaultModuleTest extends TestCase { ->with('maintenance', false) ->willReturn(true); + $calls = [ + 'Maintenance mode must be disabled when setting default module,', + 'in order to load the relevant encryption modules correctly.', + ]; $this->consoleOutput->expects($this->exactly(2)) ->method('writeln') - ->withConsecutive( - [$this->stringContains('Maintenance mode must be disabled when setting default module,')], - [$this->stringContains('in order to load the relevant encryption modules correctly.')], - ); + ->willReturnCallback(function ($message) use (&$calls): void { + $expected = array_shift($calls); + $this->assertStringContainsString($expected, $message); + }); self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } |