diff --git a/src/Command/Self/ListCommand.php b/src/Command/Self/ListCommand.php index 4b429c807..836d41058 100644 --- a/src/Command/Self/ListCommand.php +++ b/src/Command/Self/ListCommand.php @@ -6,14 +6,48 @@ use Acquia\Cli\Command\Acsf\AcsfListCommandBase; use Acquia\Cli\Command\Api\ApiListCommandBase; +use Acquia\Cli\Command\CommandBase; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Descriptor\ApplicationDescription; use Symfony\Component\Console\Helper\DescriptorHelper; +use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; #[AsCommand(name: 'list', description: NULL, aliases: ['self:list'])] -final class ListCommand extends \Symfony\Component\Console\Command\ListCommand { +final class ListCommand extends CommandBase { + + protected function configure(): void { + $this + ->setName('list') + ->setDefinition([ + new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name', NULL, fn () => array_keys((new ApplicationDescription($this->getApplication()))->getNamespaces())), + new InputOption('raw', NULL, InputOption::VALUE_NONE, 'To output raw command list'), + new InputOption('format', NULL, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt', fn () => (new DescriptorHelper())->getFormats()), + new InputOption('short', NULL, InputOption::VALUE_NONE, 'To skip describing commands\' arguments'), + ]) + ->setDescription('List commands') + ->setHelp(<<<'EOF' +The %command.name% command lists all commands: + + %command.full_name% + +You can also display the commands for a specific namespace: + + %command.full_name% test + +You can also output the information in other formats by using the --format option: + + %command.full_name% --format=xml + +It's also possible to get raw list of commands (useful for embedding command runner): + + %command.full_name% --raw +EOF + ); + } protected function execute(InputInterface $input, OutputInterface $output): int { foreach (['api', 'acsf'] as $prefix) { diff --git a/tests/phpunit/src/Application/KernelTest.php b/tests/phpunit/src/Application/KernelTest.php index 367097507..5543b8b53 100644 --- a/tests/phpunit/src/Application/KernelTest.php +++ b/tests/phpunit/src/Application/KernelTest.php @@ -12,7 +12,9 @@ class KernelTest extends ApplicationTestBase { * @group serial */ public function testRun(): void { - $this->setInput(['list']); + $this->setInput([ + 'command' => 'list', + ]); $buffer = $this->runApp(); // A bit dumb that we need to break these up, but the available commands vary based on whether a browser is available or the session is interactive. // Could probably handle that more intelligently... diff --git a/tests/phpunit/src/CommandTestBase.php b/tests/phpunit/src/CommandTestBase.php index 4218ffb2e..374bc1c0c 100644 --- a/tests/phpunit/src/CommandTestBase.php +++ b/tests/phpunit/src/CommandTestBase.php @@ -23,7 +23,6 @@ use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use Psr\Http\Message\StreamInterface; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Terminal; @@ -46,16 +45,11 @@ abstract class CommandTestBase extends TestBase { // Select the application / SSH key / etc. protected static int $INPUT_DEFAULT_CHOICE = 0; - protected Command $command; + protected CommandBase $command; protected string $apiCommandPrefix = 'api'; - /** - * Creates a command object to test. - * - * @return \Symfony\Component\Console\Command\Command A command object with mocked dependencies injected. - */ - abstract protected function createCommand(): Command; + abstract protected function createCommand(): CommandBase; /** * This method is called before each test. @@ -68,7 +62,7 @@ protected function setUp(): void { $this->printTestName(); } - protected function setCommand(Command $command): void { + protected function setCommand(CommandBase $command): void { $this->command = $command; } @@ -218,6 +212,8 @@ public function mockGetEnvironment(): mixed { protected function mockLocalMachineHelper(): LocalMachineHelper|ObjectProphecy { $localMachineHelper = $this->prophet->prophesize(LocalMachineHelper::class); $localMachineHelper->useTty()->willReturn(FALSE); + $this->command->localMachineHelper = $localMachineHelper->reveal(); + return $localMachineHelper; } diff --git a/tests/phpunit/src/Commands/Acsf/AcsfApiCommandTest.php b/tests/phpunit/src/Commands/Acsf/AcsfApiCommandTest.php index a06237123..b81fb818b 100644 --- a/tests/phpunit/src/Commands/Acsf/AcsfApiCommandTest.php +++ b/tests/phpunit/src/Commands/Acsf/AcsfApiCommandTest.php @@ -10,9 +10,9 @@ use Acquia\Cli\CloudApi\ClientService; use Acquia\Cli\Command\Acsf\AcsfApiBaseCommand; use Acquia\Cli\Command\Acsf\AcsfCommandFactory; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\CommandFactoryInterface; use Prophecy\Argument; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Output\OutputInterface; /** @@ -29,7 +29,7 @@ public function setUp(): void { putenv('ACQUIA_CLI_USE_CLOUD_API_SPEC_CACHE=1'); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { $this->createMockCloudConfigFile($this->getAcsfCredentialsFileContents()); $this->cloudCredentials = new AcsfCredentials($this->datastoreCloud); $this->setClientProphecies(AcsfClientService::class); diff --git a/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php b/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php index bfb895ef1..ff532e692 100644 --- a/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php +++ b/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php @@ -6,16 +6,16 @@ use Acquia\Cli\AcsfApi\AcsfCredentials; use Acquia\Cli\Command\Auth\AuthAcsfLoginCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Config\CloudDataConfig; use Acquia\Cli\DataStore\CloudDataStore; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Auth\AuthLoginCommand $command */ class AcsfAuthLoginCommandTest extends AcsfCommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { $this->cloudCredentials = new AcsfCredentials($this->datastoreCloud); return $this->injectCommand(AuthAcsfLoginCommand::class); } diff --git a/tests/phpunit/src/Commands/Acsf/AcsfAuthLogoutCommandTest.php b/tests/phpunit/src/Commands/Acsf/AcsfAuthLogoutCommandTest.php index 80c5bb1a7..90f864abe 100644 --- a/tests/phpunit/src/Commands/Acsf/AcsfAuthLogoutCommandTest.php +++ b/tests/phpunit/src/Commands/Acsf/AcsfAuthLogoutCommandTest.php @@ -6,16 +6,16 @@ use Acquia\Cli\AcsfApi\AcsfCredentials; use Acquia\Cli\Command\Auth\AuthAcsfLogoutCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Config\CloudDataConfig; use Acquia\Cli\DataStore\CloudDataStore; -use Symfony\Component\Console\Command\Command; /** * @property AcsfAuthLogoutCommandTest $command */ class AcsfAuthLogoutCommandTest extends AcsfCommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { $this->cloudCredentials = new AcsfCredentials($this->datastoreCloud); return $this->injectCommand(AuthAcsfLogoutCommand::class); } diff --git a/tests/phpunit/src/Commands/Acsf/AcsfListCommandTest.php b/tests/phpunit/src/Commands/Acsf/AcsfListCommandTest.php index 79f573740..237509dab 100644 --- a/tests/phpunit/src/Commands/Acsf/AcsfListCommandTest.php +++ b/tests/phpunit/src/Commands/Acsf/AcsfListCommandTest.php @@ -6,9 +6,9 @@ use Acquia\Cli\Command\Acsf\AcsfListCommand; use Acquia\Cli\Command\Acsf\AcsfListCommandBase; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Self\ListCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property AcsfListCommandBase $command @@ -23,7 +23,7 @@ public function setUp(): void { $this->application->addCommands($this->getApiCommands()); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(AcsfListCommand::class); } @@ -47,7 +47,7 @@ public function testApiNamespaceListCommand(): void { } public function testListCommand(): void { - $this->command = new ListCommand('list'); + $this->command = $this->injectCommand(ListCommand::class); $this->executeCommand(); $output = $this->getDisplay(); $this->assertStringContainsString('acsf:api', $output); diff --git a/tests/phpunit/src/Commands/Api/ApiCommandTest.php b/tests/phpunit/src/Commands/Api/ApiCommandTest.php index dcbc32729..704cb697a 100644 --- a/tests/phpunit/src/Commands/Api/ApiCommandTest.php +++ b/tests/phpunit/src/Commands/Api/ApiCommandTest.php @@ -5,11 +5,11 @@ namespace Acquia\Cli\Tests\Commands\Api; use Acquia\Cli\Command\Api\ApiBaseCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Self\ClearCacheCommand; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; use AcquiaCloudApi\Exception\ApiErrorException; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Exception\MissingInputException; use Symfony\Component\Filesystem\Path; use Symfony\Component\Yaml\Yaml; @@ -25,7 +25,7 @@ public function setUp(): void { putenv('ACQUIA_CLI_USE_CLOUD_API_SPEC_CACHE=1'); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(ApiBaseCommand::class); } diff --git a/tests/phpunit/src/Commands/Api/ApiListCommandTest.php b/tests/phpunit/src/Commands/Api/ApiListCommandTest.php index 7d6b8a8ba..028aa8f50 100644 --- a/tests/phpunit/src/Commands/Api/ApiListCommandTest.php +++ b/tests/phpunit/src/Commands/Api/ApiListCommandTest.php @@ -6,9 +6,9 @@ use Acquia\Cli\Command\Api\ApiListCommand; use Acquia\Cli\Command\Api\ApiListCommandBase; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Self\ListCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property ApiListCommandBase $command @@ -20,7 +20,7 @@ public function setUp(): void { $this->application->addCommands($this->getApiCommands()); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(ApiListCommand::class); } @@ -43,7 +43,7 @@ public function testApiNamespaceListCommand(): void { } public function testListCommand(): void { - $this->command = new ListCommand(); + $this->command = $this->injectCommand(ListCommand::class); $this->executeCommand(); $output = $this->getDisplay(); $this->assertStringContainsString(' api:accounts', $output); diff --git a/tests/phpunit/src/Commands/App/AppOpenCommandTest.php b/tests/phpunit/src/Commands/App/AppOpenCommandTest.php index b65ac6402..ef31dc475 100644 --- a/tests/phpunit/src/Commands/App/AppOpenCommandTest.php +++ b/tests/phpunit/src/Commands/App/AppOpenCommandTest.php @@ -5,16 +5,16 @@ namespace Acquia\Cli\Tests\Commands\App; use Acquia\Cli\Command\App\AppOpenCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property AppOpenCommand $command */ class AppOpenCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(AppOpenCommand::class); } @@ -23,10 +23,8 @@ public function testAppOpenCommand(): void { $localMachineHelper = $this->mockLocalMachineHelper(); $localMachineHelper->startBrowser('https://cloud.acquia.com/a/applications/' . $applicationUuid)->shouldBeCalled(); $localMachineHelper->isBrowserAvailable()->willReturn(TRUE); - $this->command->localMachineHelper = $localMachineHelper->reveal(); - $this->createMockAcliConfigFile($applicationUuid); - $this->mockApplicationRequest(); - $this->executeCommand(); + $this->mockRequest('getApplicationByUuid', $applicationUuid); + $this->executeCommand(['applicationUuid' => $applicationUuid]); $this->prophet->checkPredictions(); } @@ -34,7 +32,7 @@ public function testAppOpenNoBrowser(): void { $applicationUuid = 'a47ac10b-58cc-4372-a567-0e02b2c3d470'; $localMachineHelper = $this->mockLocalMachineHelper(); $localMachineHelper->isBrowserAvailable()->willReturn(FALSE); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->mockApplicationRequest(); $this->createMockAcliConfigFile($applicationUuid); $this->expectException(AcquiaCliException::class); diff --git a/tests/phpunit/src/Commands/App/AppVcsInfoTest.php b/tests/phpunit/src/Commands/App/AppVcsInfoTest.php index 79460ae1d..29c693365 100644 --- a/tests/phpunit/src/Commands/App/AppVcsInfoTest.php +++ b/tests/phpunit/src/Commands/App/AppVcsInfoTest.php @@ -5,16 +5,16 @@ namespace Acquia\Cli\Tests\Commands\App; use Acquia\Cli\Command\App\AppVcsInfo; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\App\AppVcsInfo $command */ class AppVcsInfoTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(AppVcsInfo::class); } diff --git a/tests/phpunit/src/Commands/App/LinkCommandTest.php b/tests/phpunit/src/Commands/App/LinkCommandTest.php index cc0324570..de99b95c2 100644 --- a/tests/phpunit/src/Commands/App/LinkCommandTest.php +++ b/tests/phpunit/src/Commands/App/LinkCommandTest.php @@ -5,16 +5,16 @@ namespace Acquia\Cli\Tests\Commands\App; use Acquia\Cli\Command\App\LinkCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\App\LinkCommand $command */ class LinkCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(LinkCommand::class); } diff --git a/tests/phpunit/src/Commands/App/LogTailCommandTest.php b/tests/phpunit/src/Commands/App/LogTailCommandTest.php index 37e4c3221..fdb088de3 100644 --- a/tests/phpunit/src/Commands/App/LogTailCommandTest.php +++ b/tests/phpunit/src/Commands/App/LogTailCommandTest.php @@ -5,15 +5,15 @@ namespace Acquia\Cli\Tests\Commands\App; use Acquia\Cli\Command\App\LogTailCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\App\LogTailCommand $command */ class LogTailCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(LogTailCommand::class); } diff --git a/tests/phpunit/src/Commands/App/NewCommandTest.php b/tests/phpunit/src/Commands/App/NewCommandTest.php index 4c4b399fe..fd04dc276 100644 --- a/tests/phpunit/src/Commands/App/NewCommandTest.php +++ b/tests/phpunit/src/Commands/App/NewCommandTest.php @@ -5,9 +5,9 @@ namespace Acquia\Cli\Tests\Commands\App; use Acquia\Cli\Command\App\NewCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Tests\CommandTestBase; use Prophecy\Prophecy\ObjectProphecy; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Path; use Symfony\Component\Process\Process; @@ -23,7 +23,7 @@ public function setUp(): void { $this->setupFsFixture(); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(NewCommand::class); } @@ -70,7 +70,6 @@ public function testNewDrupalCommand(array $package, string $directory = 'drupal $this->mockExecuteGitAdd($localMachineHelper, $this->newProjectDir, $process); $this->mockExecuteGitCommit($localMachineHelper, $this->newProjectDir, $process); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $inputs = [ // Choose a starting project $project, @@ -111,7 +110,6 @@ public function testNewNextJSAppCommand(array $package, string $directory = 'nex $this->mockExecuteGitAdd($localMachineHelper, $this->newProjectDir, $process); $this->mockExecuteGitCommit($localMachineHelper, $this->newProjectDir, $process); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $inputs = [ // Choose a starting project $project, diff --git a/tests/phpunit/src/Commands/App/NewFromDrupal7CommandTest.php b/tests/phpunit/src/Commands/App/NewFromDrupal7CommandTest.php index 033dc2c4e..16bfa2bec 100644 --- a/tests/phpunit/src/Commands/App/NewFromDrupal7CommandTest.php +++ b/tests/phpunit/src/Commands/App/NewFromDrupal7CommandTest.php @@ -5,9 +5,9 @@ namespace Acquia\Cli\Tests\Commands\App; use Acquia\Cli\Command\App\NewFromDrupal7Command; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Tests\CommandTestBase; use Prophecy\Prophecy\ObjectProphecy; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Process\Process; /** @@ -22,7 +22,7 @@ public function setUp(): void { $this->setupFsFixture(); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(NewFromDrupal7Command::class); } @@ -102,7 +102,6 @@ public function testNewFromDrupal7Command(string $extensions_json, string $recom $this->mockExecuteGitAdd($localMachineHelper, $race_condition_proof_tmpdir, $process); $this->mockExecuteGitCommit($localMachineHelper, $race_condition_proof_tmpdir, $process); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->executeCommand([ '--directory' => $race_condition_proof_tmpdir, '--recommendations' => $recommendations_json, diff --git a/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php b/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php index 5b732eda7..10dcdd34b 100644 --- a/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php +++ b/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php @@ -5,6 +5,7 @@ namespace Acquia\Cli\Tests\Commands\App; use Acquia\Cli\Command\App\TaskWaitCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; use Symfony\Component\Console\Command\Command; @@ -14,7 +15,7 @@ */ class TaskWaitCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(TaskWaitCommand::class); } diff --git a/tests/phpunit/src/Commands/App/UnlinkCommandTest.php b/tests/phpunit/src/Commands/App/UnlinkCommandTest.php index 6a90e77a0..a36100fa6 100644 --- a/tests/phpunit/src/Commands/App/UnlinkCommandTest.php +++ b/tests/phpunit/src/Commands/App/UnlinkCommandTest.php @@ -5,16 +5,16 @@ namespace Acquia\Cli\Tests\Commands\App; use Acquia\Cli\Command\App\UnlinkCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\App\UnlinkCommand $command */ class UnlinkCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(UnlinkCommand::class); } diff --git a/tests/phpunit/src/Commands/Archive/ArchiveExporterCommandTest.php b/tests/phpunit/src/Commands/Archive/ArchiveExporterCommandTest.php index 83fc2a7b1..7850292ae 100644 --- a/tests/phpunit/src/Commands/Archive/ArchiveExporterCommandTest.php +++ b/tests/phpunit/src/Commands/Archive/ArchiveExporterCommandTest.php @@ -5,10 +5,10 @@ namespace Acquia\Cli\Tests\Commands\Archive; use Acquia\Cli\Command\Archive\ArchiveExportCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Tests\Commands\Pull\PullCommandTestBase; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Path; use Symfony\Component\Finder\Finder; @@ -18,7 +18,7 @@ */ class ArchiveExporterCommandTest extends PullCommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(ArchiveExportCommand::class); } @@ -43,8 +43,6 @@ public function testArchiveExport(): void { $finder = $this->mockFinder(); $localMachineHelper->getFinder()->willReturn($finder->reveal()); - $this->command->localMachineHelper = $localMachineHelper->reveal(); - $inputs = [ // ... Do you want to continue? (yes/no) [yes] 'y', diff --git a/tests/phpunit/src/Commands/Auth/AuthLoginCommandTest.php b/tests/phpunit/src/Commands/Auth/AuthLoginCommandTest.php index 1bc57d406..aadabdf26 100644 --- a/tests/phpunit/src/Commands/Auth/AuthLoginCommandTest.php +++ b/tests/phpunit/src/Commands/Auth/AuthLoginCommandTest.php @@ -5,11 +5,11 @@ namespace Acquia\Cli\Tests\Commands\Auth; use Acquia\Cli\Command\Auth\AuthLoginCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Config\CloudDataConfig; use Acquia\Cli\DataStore\CloudDataStore; use Acquia\Cli\Tests\CommandTestBase; use Generator; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Validator\Exception\ValidatorException; /** @@ -17,7 +17,7 @@ */ class AuthLoginCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(AuthLoginCommand::class); } diff --git a/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php b/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php index 9a0aec271..5f03bb4ec 100644 --- a/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php +++ b/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php @@ -5,17 +5,17 @@ namespace Acquia\Cli\Tests\Commands\Auth; use Acquia\Cli\Command\Auth\AuthLogoutCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Config\CloudDataConfig; use Acquia\Cli\DataStore\CloudDataStore; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property AuthLogoutCommandTest $command */ class AuthLogoutCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(AuthLogoutCommand::class); } diff --git a/tests/phpunit/src/Commands/ClearCacheCommandTest.php b/tests/phpunit/src/Commands/ClearCacheCommandTest.php index fea78e967..43144deb8 100644 --- a/tests/phpunit/src/Commands/ClearCacheCommandTest.php +++ b/tests/phpunit/src/Commands/ClearCacheCommandTest.php @@ -8,14 +8,13 @@ use Acquia\Cli\Command\Ide\IdeListCommand; use Acquia\Cli\Command\Self\ClearCacheCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\App\UnlinkCommand $command */ class ClearCacheCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(ClearCacheCommand::class); } diff --git a/tests/phpunit/src/Commands/CodeStudio/CodeStudioPhpVersionCommandTest.php b/tests/phpunit/src/Commands/CodeStudio/CodeStudioPhpVersionCommandTest.php index fadeb237c..8115790d0 100644 --- a/tests/phpunit/src/Commands/CodeStudio/CodeStudioPhpVersionCommandTest.php +++ b/tests/phpunit/src/Commands/CodeStudio/CodeStudioPhpVersionCommandTest.php @@ -5,11 +5,11 @@ namespace Acquia\Cli\Tests\Commands\CodeStudio; use Acquia\Cli\Command\CodeStudio\CodeStudioPhpVersionCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Tests\CommandTestBase; use Gitlab\Client; use Gitlab\Exception\RuntimeException; use Prophecy\Argument; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Validator\Exception\ValidatorException; /** @@ -22,7 +22,7 @@ class CodeStudioPhpVersionCommandTest extends CommandTestBase { private int $gitLabProjectId = 33; public static string $applicationUuid = 'a47ac10b-58cc-4372-a567-0e02b2c3d470'; - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(CodeStudioPhpVersionCommand::class); } diff --git a/tests/phpunit/src/Commands/CodeStudio/CodeStudioPipelinesMigrateCommandTest.php b/tests/phpunit/src/Commands/CodeStudio/CodeStudioPipelinesMigrateCommandTest.php index 87b446c83..121528255 100644 --- a/tests/phpunit/src/Commands/CodeStudio/CodeStudioPipelinesMigrateCommandTest.php +++ b/tests/phpunit/src/Commands/CodeStudio/CodeStudioPipelinesMigrateCommandTest.php @@ -6,12 +6,12 @@ use Acquia\Cli\Command\CodeStudio\CodeStudioCiCdVariables; use Acquia\Cli\Command\CodeStudio\CodeStudioPipelinesMigrateCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Tests\Commands\Ide\IdeRequiredTestTrait; use Acquia\Cli\Tests\CommandTestBase; use Acquia\Cli\Tests\TestBase; use Gitlab\Client; use Prophecy\Argument; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Path; use Symfony\Component\Yaml\Yaml; @@ -41,7 +41,7 @@ public function tearDown(): void { TestBase::unsetEnvVars(['GITLAB_HOST' => 'code.cloudservices.acquia.io']); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(CodeStudioPipelinesMigrateCommand::class); } @@ -96,7 +96,7 @@ public function testCommand(mixed $mockedGitlabProjects, mixed $inputs, mixed $a $gitlabClient->projects()->willReturn($projects); $localMachineHelper->getFilesystem()->willReturn(new Filesystem())->shouldBeCalled(); $this->command->setGitLabClient($gitlabClient->reveal()); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->mockRequest('getApplications'); // Set properties and execute. $this->executeCommand($args, $inputs); diff --git a/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php b/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php index dfc987653..8018891ab 100644 --- a/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php +++ b/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php @@ -5,6 +5,7 @@ namespace Acquia\Cli\Tests\Commands\CodeStudio; use Acquia\Cli\Command\CodeStudio\CodeStudioWizardCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\Commands\Ide\IdeRequiredTestTrait; use Acquia\Cli\Tests\Commands\WizardTestBase; @@ -17,7 +18,6 @@ use Gitlab\Client; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Filesystem; /** @@ -45,7 +45,7 @@ public function tearDown(): void { TestBase::unsetEnvVars(['GITLAB_HOST' => 'code.cloudservices.acquia.io']); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(CodeStudioWizardCommand::class); } @@ -256,7 +256,6 @@ public function testCommand(array $mockedGitlabProjects, array $inputs, array $a /** @var Filesystem|ObjectProphecy $fileSystem */ $fileSystem = $this->prophet->prophesize(Filesystem::class); - $this->command->localMachineHelper = $localMachineHelper->reveal(); // Set properties and execute. $this->executeCommand($args, $inputs); @@ -271,7 +270,7 @@ public function testInvalidGitLabCredentials(): void { $this->mockExecuteGlabExists($localMachineHelper); $gitlabClient = $this->mockGitLabAuthenticate($localMachineHelper, $this->gitLabHost, $this->gitLabToken); $this->command->setGitLabClient($gitlabClient->reveal()); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('Unable to authenticate with Code Studio'); $this->executeCommand([ @@ -285,7 +284,7 @@ public function testMissingGitLabCredentials(): void { $this->mockExecuteGlabExists($localMachineHelper); $this->mockGitlabGetHost($localMachineHelper, $this->gitLabHost); $this->mockGitlabGetToken($localMachineHelper, $this->gitLabToken, $this->gitLabHost, FALSE); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('Could not determine GitLab token'); $this->executeCommand([ diff --git a/tests/phpunit/src/Commands/CommandBaseTest.php b/tests/phpunit/src/Commands/CommandBaseTest.php index 05da81fa8..8d06b8491 100644 --- a/tests/phpunit/src/Commands/CommandBaseTest.php +++ b/tests/phpunit/src/Commands/CommandBaseTest.php @@ -9,7 +9,6 @@ use Acquia\Cli\Command\Ide\IdeListCommand; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Validator\Exception\ValidatorException; /** @@ -20,7 +19,7 @@ class CommandBaseTest extends CommandTestBase { /** * @return \Acquia\Cli\Command\App\LinkCommand */ - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(LinkCommand::class); } diff --git a/tests/phpunit/src/Commands/DocsCommandTest.php b/tests/phpunit/src/Commands/DocsCommandTest.php index 023387dbf..b8e2f365f 100644 --- a/tests/phpunit/src/Commands/DocsCommandTest.php +++ b/tests/phpunit/src/Commands/DocsCommandTest.php @@ -4,17 +4,17 @@ namespace Acquia\Cli\Tests\Commands; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\DocsCommand; use Acquia\Cli\Tests\CommandTestBase; use Prophecy\Argument; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\DocsCommand $command */ class DocsCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(DocsCommand::class); } @@ -24,7 +24,7 @@ protected function createCommand(): Command { public function testDocsCommand(mixed $input, mixed $expectedOutput): void { $localMachineHelper = $this->mockLocalMachineHelper(); $localMachineHelper->startBrowser(Argument::any())->shouldBeCalled(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->executeCommand([], [$input]); $output = $this->getDisplay(); $this->assertStringContainsString('Select the Acquia Product [Acquia CLI]:', $output); diff --git a/tests/phpunit/src/Commands/Email/ConfigurePlatformEmailCommandTest.php b/tests/phpunit/src/Commands/Email/ConfigurePlatformEmailCommandTest.php index bd0f278bf..0974f8c36 100644 --- a/tests/phpunit/src/Commands/Email/ConfigurePlatformEmailCommandTest.php +++ b/tests/phpunit/src/Commands/Email/ConfigurePlatformEmailCommandTest.php @@ -4,13 +4,13 @@ namespace Acquia\Cli\Tests\Commands\Email; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Email\ConfigurePlatformEmailCommand; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Helpers\LocalMachineHelper; use Acquia\Cli\Tests\CommandTestBase; use AcquiaCloudApi\Exception\ApiErrorException; use Prophecy\Prophecy\ObjectProphecy; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Filesystem; /** @@ -72,7 +72,7 @@ class ConfigurePlatformEmailCommandTest extends CommandTestBase { "-\n type: CNAME\n name: abcdefgh1ijkl2mnopq34rstuvwxyz._domainkey.example.com\n value: abcdefgh1ijkl2mnopq34rstuvwxyz.dkim.amazonses.com\n" . "-\n type: CNAME\n name: abcdefgh1ijkl2mnopq34rstuvwxyz._domainkey.example.com\n value: abcdefgh1ijkl2mnopq34rstuvwxyz.dkim.amazonses.com\n"; - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(ConfigurePlatformEmailCommand::class); } @@ -288,7 +288,6 @@ public function testConfigurePlatformEmail(mixed $baseDomain, mixed $fileDumpFor $this->clientProphecy->request('post', "/environments/{$environmentsResponse->_embedded->items[0]->id}/email/actions/enable")->willReturn($enableResponse); } - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->executeCommand([], $inputs); $output = $this->getDisplay(); $this->prophet->checkPredictions(); @@ -369,7 +368,6 @@ public function testConfigurePlatformEmailWithMultipleAppsAndEnvs(): void { $this->clientProphecy->request('post', "/environments/{$environmentResponseApp2->_embedded->items[0]->id}/email/actions/enable")->willReturn($enableResponse); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->executeCommand([], $inputs); $output = $this->getDisplay(); $this->prophet->checkPredictions(); @@ -423,7 +421,6 @@ public function testConfigurePlatformEmailNoApps(): void { $mockFileSystem->dumpFile('dns-records.zone', self::ZONE_TEST_OUTPUT)->shouldBeCalled(); $applicationsResponse = $this->mockApplicationsRequest(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('You do not have access to any applications'); $this->executeCommand([], $inputs); @@ -568,7 +565,6 @@ public function testConfigurePlatformEmailJsonOutput(): void { $enableResponse = $this->getMockResponseFromSpec('/environments/{environmentId}/email/actions/enable', 'post', '200'); $this->clientProphecy->request('post', "/environments/{$environmentsResponse->_embedded->items[0]->id}/email/actions/enable")->willReturn($enableResponse); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->executeCommand([], $inputs); $output = $this->getDisplay(); $this->prophet->checkPredictions(); diff --git a/tests/phpunit/src/Commands/Email/EmailInfoForSubscriptionCommandTest.php b/tests/phpunit/src/Commands/Email/EmailInfoForSubscriptionCommandTest.php index 63b99d043..f266bf3c3 100644 --- a/tests/phpunit/src/Commands/Email/EmailInfoForSubscriptionCommandTest.php +++ b/tests/phpunit/src/Commands/Email/EmailInfoForSubscriptionCommandTest.php @@ -4,17 +4,17 @@ namespace Acquia\Cli\Tests\Commands\Email; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Email\EmailInfoForSubscriptionCommand; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Email\EmailInfoForSubscriptionCommand $command */ class EmailInfoForSubscriptionCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(EmailInfoForSubscriptionCommand::class); } diff --git a/tests/phpunit/src/Commands/Env/EnvCertCreateCommandTest.php b/tests/phpunit/src/Commands/Env/EnvCertCreateCommandTest.php index 231f95f49..8315e864c 100644 --- a/tests/phpunit/src/Commands/Env/EnvCertCreateCommandTest.php +++ b/tests/phpunit/src/Commands/Env/EnvCertCreateCommandTest.php @@ -4,13 +4,13 @@ namespace Acquia\Cli\Tests\Commands\Env; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Env\EnvCertCreateCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; class EnvCertCreateCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(EnvCertCreateCommand::class); } @@ -27,7 +27,7 @@ public function testCreateCert(): void { $csrId = 123; $localMachineHelper->readFile($certName)->willReturn($certContents)->shouldBeCalled(); $localMachineHelper->readFile($keyName)->willReturn($keyContents)->shouldBeCalled(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $sslResponse = $this->getMockResponseFromSpec('/environments/{environmentId}/ssl/certificates', 'post', '202'); $options = [ diff --git a/tests/phpunit/src/Commands/Env/EnvCopyCronCommandTest.php b/tests/phpunit/src/Commands/Env/EnvCopyCronCommandTest.php index cbe1b5344..fbea13de7 100644 --- a/tests/phpunit/src/Commands/Env/EnvCopyCronCommandTest.php +++ b/tests/phpunit/src/Commands/Env/EnvCopyCronCommandTest.php @@ -4,18 +4,18 @@ namespace Acquia\Cli\Tests\Commands\Env; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Env\EnvCopyCronCommand; use Acquia\Cli\Tests\CommandTestBase; use Exception; use Prophecy\Argument; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Env\EnvCopyCronCommand $command */ class EnvCopyCronCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(EnvCopyCronCommand::class); } diff --git a/tests/phpunit/src/Commands/Env/EnvCreateCommandTest.php b/tests/phpunit/src/Commands/Env/EnvCreateCommandTest.php index beffc8200..b7e556e4f 100644 --- a/tests/phpunit/src/Commands/Env/EnvCreateCommandTest.php +++ b/tests/phpunit/src/Commands/Env/EnvCreateCommandTest.php @@ -4,11 +4,11 @@ namespace Acquia\Cli\Tests\Commands\Env; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Env\EnvCreateCommand; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; use Prophecy\Argument; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Env\EnvCreateCommand $command @@ -65,7 +65,7 @@ private function getApplication(): string { return $applicationsResponse->{'_embedded'}->items[0]->uuid; } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(EnvCreateCommand::class); } diff --git a/tests/phpunit/src/Commands/Env/EnvDeleteCommandTest.php b/tests/phpunit/src/Commands/Env/EnvDeleteCommandTest.php index e32e076d3..ab06015eb 100644 --- a/tests/phpunit/src/Commands/Env/EnvDeleteCommandTest.php +++ b/tests/phpunit/src/Commands/Env/EnvDeleteCommandTest.php @@ -4,17 +4,17 @@ namespace Acquia\Cli\Tests\Commands\Env; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Env\EnvDeleteCommand; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Env\EnvDeleteCommand $command */ class EnvDeleteCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(EnvDeleteCommand::class); } diff --git a/tests/phpunit/src/Commands/Env/EnvMirrorCommandTest.php b/tests/phpunit/src/Commands/Env/EnvMirrorCommandTest.php index 92cfadbd2..25950e98a 100644 --- a/tests/phpunit/src/Commands/Env/EnvMirrorCommandTest.php +++ b/tests/phpunit/src/Commands/Env/EnvMirrorCommandTest.php @@ -4,17 +4,17 @@ namespace Acquia\Cli\Tests\Commands\Env; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Env\EnvMirrorCommand; use Acquia\Cli\Tests\CommandTestBase; use Prophecy\Argument; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Env\EnvMirrorCommand $command */ class EnvMirrorCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(EnvMirrorCommand::class); } diff --git a/tests/phpunit/src/Commands/Ide/IdeCreateCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeCreateCommandTest.php index 5770717e1..f244ad416 100644 --- a/tests/phpunit/src/Commands/Ide/IdeCreateCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeCreateCommandTest.php @@ -4,11 +4,11 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeCreateCommand; use Acquia\Cli\Tests\CommandTestBase; use GuzzleHttp\Client; use GuzzleHttp\Psr7\Response; -use Symfony\Component\Console\Command\Command; /** * @property IdeCreateCommand $command @@ -61,7 +61,7 @@ public function testCreate(): void { /** * @return \Acquia\Cli\Command\Ide\IdeCreateCommand */ - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeCreateCommand::class); } diff --git a/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php index c28053ed1..0632364ce 100644 --- a/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php @@ -4,11 +4,11 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeDeleteCommand; use Acquia\Cli\Command\Ssh\SshKeyDeleteCommand; use Acquia\Cli\Tests\CommandTestBase; use AcquiaCloudApi\Response\IdeResponse; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Output\OutputInterface; /** @@ -27,7 +27,7 @@ public function setUp(OutputInterface $output = NULL): void { ]); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeDeleteCommand::class); } diff --git a/tests/phpunit/src/Commands/Ide/IdeInfoCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeInfoCommandTest.php index 56cc7b49a..91cea5af2 100644 --- a/tests/phpunit/src/Commands/Ide/IdeInfoCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeInfoCommandTest.php @@ -4,16 +4,16 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeInfoCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Ide\IdeListCommand $command */ class IdeInfoCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeInfoCommand::class); } diff --git a/tests/phpunit/src/Commands/Ide/IdeListCommandMineTest.php b/tests/phpunit/src/Commands/Ide/IdeListCommandMineTest.php index 976b65801..cb70b2673 100644 --- a/tests/phpunit/src/Commands/Ide/IdeListCommandMineTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeListCommandMineTest.php @@ -4,16 +4,16 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeListMineCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Ide\IdeListMineCommand $command */ class IdeListCommandMineTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeListMineCommand::class); } diff --git a/tests/phpunit/src/Commands/Ide/IdeListCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeListCommandTest.php index a9bc20409..afa560e53 100644 --- a/tests/phpunit/src/Commands/Ide/IdeListCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeListCommandTest.php @@ -4,16 +4,16 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeListCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Ide\IdeListCommand $command */ class IdeListCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeListCommand::class); } diff --git a/tests/phpunit/src/Commands/Ide/IdeOpenCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeOpenCommandTest.php index 53db058b3..f2532a169 100644 --- a/tests/phpunit/src/Commands/Ide/IdeOpenCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeOpenCommandTest.php @@ -4,16 +4,16 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeOpenCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property IdeOpenCommand $command */ class IdeOpenCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeOpenCommand::class); } @@ -24,7 +24,6 @@ public function testIdeOpenCommand(): void { $localMachineHelper = $this->mockLocalMachineHelper(); $localMachineHelper->isBrowserAvailable()->willReturn(TRUE); $localMachineHelper->startBrowser('https://9a83c081-ef78-4dbd-8852-11cc3eb248f7.ides.acquia.com')->willReturn(TRUE); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? diff --git a/tests/phpunit/src/Commands/Ide/IdePhpVersionCommandTest.php b/tests/phpunit/src/Commands/Ide/IdePhpVersionCommandTest.php index d8fbd5996..79316b719 100644 --- a/tests/phpunit/src/Commands/Ide/IdePhpVersionCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdePhpVersionCommandTest.php @@ -4,12 +4,12 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdePhpVersionCommand; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Helpers\LocalMachineHelper; use Acquia\Cli\Tests\CommandTestBase; use Prophecy\Prophecy\ObjectProphecy; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Process\Process; use Symfony\Component\Validator\Exception\ValidatorException; @@ -21,7 +21,7 @@ class IdePhpVersionCommandTest extends CommandTestBase { use IdeRequiredTestTrait; - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdePhpVersionCommand::class); } @@ -49,7 +49,6 @@ public function testIdePhpVersionCommand(string $version): void { $phpVersionFilePath = $this->fs->tempnam(sys_get_temp_dir(), 'acli_php_version_file_'); $mockFileSystem->dumpFile($phpVersionFilePath, $version)->shouldBeCalled(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->command->setPhpVersionFilePath($phpVersionFilePath); $this->command->setIdePhpFilePathPrefix($phpFilepathPrefix); $this->executeCommand([ diff --git a/tests/phpunit/src/Commands/Ide/IdeServiceRestartCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeServiceRestartCommandTest.php index 2c4ad85e5..641ba5f41 100644 --- a/tests/phpunit/src/Commands/Ide/IdeServiceRestartCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeServiceRestartCommandTest.php @@ -4,9 +4,9 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeServiceRestartCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Validator\Exception\ValidatorException; /** @@ -16,14 +16,14 @@ class IdeServiceRestartCommandTest extends CommandTestBase { use IdeRequiredTestTrait; - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeServiceRestartCommand::class); } public function testIdeServiceRestartCommand(): void { $localMachineHelper = $this->mockLocalMachineHelper(); $this->mockRestartPhp($localMachineHelper); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->executeCommand(['service' => 'php'], []); // Assert. @@ -35,7 +35,7 @@ public function testIdeServiceRestartCommand(): void { public function testIdeServiceRestartCommandInvalid(): void { $localMachineHelper = $this->mockLocalMachineHelper(); $this->mockRestartPhp($localMachineHelper); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->expectException(ValidatorException::class); $this->expectExceptionMessage('Specify a valid service name'); $this->executeCommand(['service' => 'rambulator'], []); diff --git a/tests/phpunit/src/Commands/Ide/IdeServiceStartCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeServiceStartCommandTest.php index e9f4bd3bb..7b7fd26d5 100644 --- a/tests/phpunit/src/Commands/Ide/IdeServiceStartCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeServiceStartCommandTest.php @@ -4,9 +4,9 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeServiceStartCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Validator\Exception\ValidatorException; /** @@ -16,14 +16,14 @@ class IdeServiceStartCommandTest extends CommandTestBase { use IdeRequiredTestTrait; - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeServiceStartCommand::class); } public function testIdeServiceStartCommand(): void { $localMachineHelper = $this->mockLocalMachineHelper(); $this->mockStartPhp($localMachineHelper); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->executeCommand(['service' => 'php'], []); // Assert. @@ -35,7 +35,7 @@ public function testIdeServiceStartCommand(): void { public function testIdeServiceStartCommandInvalid(): void { $localMachineHelper = $this->mockLocalMachineHelper(); $this->mockStartPhp($localMachineHelper); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->expectException(ValidatorException::class); $this->expectExceptionMessage('Specify a valid service name'); $this->executeCommand(['service' => 'rambulator'], []); diff --git a/tests/phpunit/src/Commands/Ide/IdeServiceStopCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeServiceStopCommandTest.php index 9b2c1debe..a0af5d510 100644 --- a/tests/phpunit/src/Commands/Ide/IdeServiceStopCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeServiceStopCommandTest.php @@ -4,9 +4,9 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeServiceStopCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Validator\Exception\ValidatorException; /** @@ -16,14 +16,14 @@ class IdeServiceStopCommandTest extends CommandTestBase { use IdeRequiredTestTrait; - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeServiceStopCommand::class); } public function testIdeServiceStopCommand(): void { $localMachineHelper = $this->mockLocalMachineHelper(); $this->mockStopPhp($localMachineHelper); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->executeCommand(['service' => 'php'], []); // Assert. @@ -35,7 +35,7 @@ public function testIdeServiceStopCommand(): void { public function testIdeServiceStopCommandInvalid(): void { $localMachineHelper = $this->mockLocalMachineHelper(); $this->mockStopPhp($localMachineHelper); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->expectException(ValidatorException::class); $this->expectExceptionMessage('Specify a valid service name'); $this->executeCommand(['service' => 'rambulator'], []); diff --git a/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php index 1dcb41d05..035b5e680 100644 --- a/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php @@ -4,10 +4,10 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeShareCommand; use Acquia\Cli\Tests\CommandTestBase; use AcquiaCloudApi\Response\IdeResponse; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Output\OutputInterface; /** @@ -36,7 +36,7 @@ public function setUp(OutputInterface $output = NULL): void { IdeHelper::setCloudIdeEnvVars(); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeShareCommand::class); } diff --git a/tests/phpunit/src/Commands/Ide/IdeXdebugToggleCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeXdebugToggleCommandTest.php index e2b12af25..b7e000997 100644 --- a/tests/phpunit/src/Commands/Ide/IdeXdebugToggleCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeXdebugToggleCommandTest.php @@ -4,9 +4,9 @@ namespace Acquia\Cli\Tests\Commands\Ide; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeXdebugToggleCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Process\Process; /** @@ -35,10 +35,10 @@ public function setUpXdebug(string $phpVersion): void { ], NULL, NULL, FALSE) ->willReturn($process->reveal()) ->shouldBeCalled(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeXdebugToggleCommand::class); } diff --git a/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardCreateSshKeyCommandTest.php b/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardCreateSshKeyCommandTest.php index 4275e55dd..8eca18579 100644 --- a/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardCreateSshKeyCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardCreateSshKeyCommandTest.php @@ -4,10 +4,10 @@ namespace Acquia\Cli\Tests\Commands\Ide\Wizard; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\Wizard\IdeWizardCreateSshKeyCommand; use Acquia\Cli\Tests\Commands\Ide\IdeHelper; use AcquiaCloudApi\Response\IdeResponse; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Ide\Wizard\IdeWizardCreateSshKeyCommand $command @@ -30,7 +30,7 @@ public function setUp(): void { /** * @return \Acquia\Cli\Command\Ide\Wizard\IdeWizardCreateSshKeyCommand */ - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeWizardCreateSshKeyCommand::class); } diff --git a/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardDeleteSshKeyCommandTest.php b/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardDeleteSshKeyCommandTest.php index ba3a06e8f..50ec65d2a 100644 --- a/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardDeleteSshKeyCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardDeleteSshKeyCommandTest.php @@ -4,10 +4,10 @@ namespace Acquia\Cli\Tests\Commands\Ide\Wizard; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\Wizard\IdeWizardDeleteSshKeyCommand; use Acquia\Cli\Tests\Commands\Ide\IdeHelper; use AcquiaCloudApi\Response\IdeResponse; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Ide\Wizard\IdeWizardCreateSshKeyCommand $command @@ -38,7 +38,7 @@ public function testDelete(): void { /** * @return \Acquia\Cli\Command\Ide\Wizard\IdeWizardCreateSshKeyCommand */ - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(IdeWizardDeleteSshKeyCommand::class); } diff --git a/tests/phpunit/src/Commands/InferApplicationTest.php b/tests/phpunit/src/Commands/InferApplicationTest.php index 7a5ceb219..8ba4f6a63 100644 --- a/tests/phpunit/src/Commands/InferApplicationTest.php +++ b/tests/phpunit/src/Commands/InferApplicationTest.php @@ -5,9 +5,9 @@ namespace Acquia\Cli\Tests\Commands; use Acquia\Cli\Command\App\LinkCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property LinkCommand $command @@ -17,7 +17,7 @@ class InferApplicationTest extends CommandTestBase { /** * @return \Acquia\Cli\Command\App\LinkCommand */ - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(LinkCommand::class); } diff --git a/tests/phpunit/src/Commands/Pull/PullCodeCommandTest.php b/tests/phpunit/src/Commands/Pull/PullCodeCommandTest.php index 32a30a040..f2ae46782 100644 --- a/tests/phpunit/src/Commands/Pull/PullCodeCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullCodeCommandTest.php @@ -4,12 +4,12 @@ namespace Acquia\Cli\Tests\Commands\Pull; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdePhpVersionCommand; use Acquia\Cli\Command\Pull\PullCodeCommand; use Acquia\Cli\Tests\Commands\Ide\IdeHelper; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Path; use Symfony\Component\Finder\Finder; @@ -18,7 +18,7 @@ */ class PullCodeCommandTest extends PullCommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(PullCodeCommand::class); } @@ -38,8 +38,6 @@ public function testCloneRepo(): void { $this->mockExecuteGitCheckout($localMachineHelper, $environment->vcs->path, $dir, $process); $localMachineHelper->getFinder()->willReturn(new Finder()); - $this->command->localMachineHelper = $localMachineHelper->reveal(); - $inputs = [ // Would you like to clone a project into the current directory? 'y', @@ -65,7 +63,6 @@ public function testPullCode(): void { $localMachineHelper->checkRequiredBinariesExist(["git"])->shouldBeCalled(); $finder = $this->mockFinder(); $localMachineHelper->getFinder()->willReturn($finder->reveal()); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $process = $this->mockProcess(); $this->mockExecuteGitFetchAndCheckout($localMachineHelper, $process, $this->projectDir, $environment->vcs->path); @@ -92,7 +89,6 @@ public function testWithScripts(): void { $localMachineHelper->checkRequiredBinariesExist(["git"])->shouldBeCalled(); $finder = $this->mockFinder(); $localMachineHelper->getFinder()->willReturn($finder->reveal()); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $process = $this->mockProcess(); $this->mockExecuteGitFetchAndCheckout($localMachineHelper, $process, $this->projectDir, $environment->vcs->path); @@ -122,7 +118,6 @@ public function testNoComposerJson(): void { $localMachineHelper->checkRequiredBinariesExist(["git"])->shouldBeCalled(); $finder = $this->mockFinder(); $localMachineHelper->getFinder()->willReturn($finder->reveal()); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $process = $this->mockProcess(); $this->mockExecuteGitFetchAndCheckout($localMachineHelper, $process, $this->projectDir, $environment->vcs->path); @@ -149,7 +144,6 @@ public function testNoComposer(): void { $localMachineHelper->checkRequiredBinariesExist(["git"])->shouldBeCalled(); $finder = $this->mockFinder(); $localMachineHelper->getFinder()->willReturn($finder->reveal()); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $process = $this->mockProcess(); $this->mockExecuteGitFetchAndCheckout($localMachineHelper, $process, $this->projectDir, $environments[self::$INPUT_DEFAULT_CHOICE]->vcs->path); @@ -182,7 +176,6 @@ public function testWithVendorDir(): void { $localMachineHelper->checkRequiredBinariesExist(["git"])->shouldBeCalled(); $finder = $this->mockFinder(); $localMachineHelper->getFinder()->willReturn($finder->reveal()); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $process = $this->mockProcess(); $this->mockExecuteGitFetchAndCheckout($localMachineHelper, $process, $this->projectDir, $environments[self::$INPUT_DEFAULT_CHOICE]->vcs->path); @@ -228,7 +221,6 @@ public function testMatchPhpVersion(string $phpVersion): void { ->shouldBeCalled(); $finder = $this->mockFinder(); $localMachineHelper->getFinder()->willReturn($finder->reveal()); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $process = $this->mockProcess(); $this->mockExecuteGitFetchAndCheckout($localMachineHelper, $process, $dir, 'master'); diff --git a/tests/phpunit/src/Commands/Pull/PullCommandTest.php b/tests/phpunit/src/Commands/Pull/PullCommandTest.php index de1bd79c4..901859b03 100644 --- a/tests/phpunit/src/Commands/Pull/PullCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullCommandTest.php @@ -4,9 +4,9 @@ namespace Acquia\Cli\Tests\Commands\Pull; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Pull\PullCommand; use Acquia\Cli\Exception\AcquiaCliException; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Pull\PullCommand $command @@ -18,7 +18,7 @@ public function setUp(): void { $this->setupFsFixture(); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(PullCommand::class); } diff --git a/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php b/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php index fbb36ac39..8bcaf6a02 100644 --- a/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php @@ -4,6 +4,7 @@ namespace Acquia\Cli\Tests\Commands\Pull; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Pull\PullCommandBase; use Acquia\Cli\Command\Pull\PullDatabaseCommand; use Acquia\Cli\Exception\AcquiaCliException; @@ -16,7 +17,6 @@ use Prophecy\Prophecy\ObjectProphecy; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Path; @@ -57,7 +57,7 @@ public function mockGetBackup(mixed $environment): void { $this->mockDownloadBackup($databases[0], $environment, $backups[0]); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(PullDatabaseCommand::class); } @@ -294,12 +294,6 @@ private function mockListSites(SshHelper|ObjectProphecy $sshHelper): void { ->willReturn($process->reveal())->shouldBeCalled(); } - protected function mockLocalMachineHelper(): LocalMachineHelper|ObjectProphecy { - $localMachineHelper = parent::mockLocalMachineHelper(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); - return $localMachineHelper; - } - protected function mockExecuteMySqlConnect( ObjectProphecy $localMachineHelper, bool $success diff --git a/tests/phpunit/src/Commands/Pull/PullFilesCommandTest.php b/tests/phpunit/src/Commands/Pull/PullFilesCommandTest.php index b4d89d177..64406773a 100644 --- a/tests/phpunit/src/Commands/Pull/PullFilesCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullFilesCommandTest.php @@ -11,11 +11,10 @@ use Acquia\Cli\Tests\Commands\Ide\IdeHelper; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; -use Symfony\Component\Console\Command\Command; class PullFilesCommandTest extends PullCommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(PullFilesCommand::class); } @@ -30,7 +29,6 @@ public function testRefreshAcsfFiles(): void { $this->mockGetFilesystem($localMachineHelper); $this->mockExecuteRsync($localMachineHelper, $selectedEnvironment, '/mnt/files/profserv2.dev/sites/g/files/jxr5000596dev/files/', $this->projectDir . '/docroot/sites/jxr5000596dev/files'); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->command->sshHelper = $sshHelper->reveal(); $inputs = [ @@ -68,7 +66,6 @@ public function testRefreshCloudFiles(): void { $sitegroup = CommandBase::getSiteGroupFromSshUrl($selectedEnvironment->ssh_url); $this->mockExecuteRsync($localMachineHelper, $selectedEnvironment, '/mnt/files/' . $sitegroup . '.' . $selectedEnvironment->name . '/sites/bar/files/', $this->projectDir . '/docroot/sites/bar/files'); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->command->sshHelper = $sshHelper->reveal(); $inputs = [ @@ -98,7 +95,7 @@ public function testInvalidCwd(): void { IdeHelper::setCloudIdeEnvVars(); $localMachineHelper = $this->mockLocalMachineHelper(); $this->mockDrupalSettingsRefresh($localMachineHelper); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('Run this command from the '); $this->executeCommand(); diff --git a/tests/phpunit/src/Commands/Pull/PullScriptsCommandTest.php b/tests/phpunit/src/Commands/Pull/PullScriptsCommandTest.php index 7b49be855..dbd343b8c 100644 --- a/tests/phpunit/src/Commands/Pull/PullScriptsCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullScriptsCommandTest.php @@ -4,8 +4,8 @@ namespace Acquia\Cli\Tests\Commands\Pull; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Pull\PullScriptsCommand; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Path; /** @@ -13,7 +13,7 @@ */ class PullScriptsCommandTest extends PullCommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(PullScriptsCommand::class); } @@ -22,8 +22,6 @@ public function testRefreshScripts(): void { $localMachineHelper = $this->mockLocalMachineHelper(); $process = $this->mockProcess(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); - // Composer. $this->mockExecuteComposerExists($localMachineHelper); $this->mockExecuteComposerInstall($localMachineHelper, $process); diff --git a/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php b/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php index b1ed2df39..9a2bcafed 100644 --- a/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php +++ b/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php @@ -4,11 +4,11 @@ namespace Acquia\Cli\Tests\Commands\Push; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Push\PushArtifactCommand; use Acquia\Cli\Tests\Commands\Pull\PullCommandTestBase; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Path; use Symfony\Component\Process\Process; @@ -18,7 +18,7 @@ */ class PushArtifactCommandTest extends PullCommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(PushArtifactCommand::class); } @@ -220,7 +220,6 @@ protected function setUpPushArtifact(ObjectProphecy $localMachineHelper, string $localMachineHelper->getFinder()->willReturn($finder->reveal()); $fs = $this->prophet->prophesize(Filesystem::class); $localMachineHelper->getFilesystem()->willReturn($fs)->shouldBeCalled(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->mockExecuteGitStatus(FALSE, $localMachineHelper, $this->projectDir); $commitHash = 'abc123'; diff --git a/tests/phpunit/src/Commands/Push/PushCodeCommandTest.php b/tests/phpunit/src/Commands/Push/PushCodeCommandTest.php index 7febe625a..b6723cf18 100644 --- a/tests/phpunit/src/Commands/Push/PushCodeCommandTest.php +++ b/tests/phpunit/src/Commands/Push/PushCodeCommandTest.php @@ -4,16 +4,16 @@ namespace Acquia\Cli\Tests\Commands\Push; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Push\PushCodeCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Push\PushCodeCommand $command */ class PushCodeCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(PushCodeCommand::class); } diff --git a/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php b/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php index e404fd61e..ce0a1872d 100644 --- a/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php +++ b/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php @@ -4,19 +4,19 @@ namespace Acquia\Cli\Tests\Commands\Push; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Push\PushDatabaseCommand; use Acquia\Cli\Tests\CommandTestBase; use AcquiaCloudApi\Response\EnvironmentResponse; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Push\PushDatabaseCommand $command */ class PushDatabaseCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(PushDatabaseCommand::class); } @@ -44,7 +44,6 @@ public function testPushDatabase(): void { $this->mockUploadDatabaseDump($localMachineHelper, $process); $this->mockImportDatabaseDumpOnRemote($sshHelper, $selectedEnvironment, $process); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->command->sshHelper = $sshHelper->reveal(); $inputs = [ diff --git a/tests/phpunit/src/Commands/Push/PushFilesCommandTest.php b/tests/phpunit/src/Commands/Push/PushFilesCommandTest.php index 9d6d7bc87..ee0debf83 100644 --- a/tests/phpunit/src/Commands/Push/PushFilesCommandTest.php +++ b/tests/phpunit/src/Commands/Push/PushFilesCommandTest.php @@ -9,11 +9,10 @@ use Acquia\Cli\Tests\CommandTestBase; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; -use Symfony\Component\Console\Command\Command; class PushFilesCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(PushFilesCommand::class); } @@ -27,7 +26,6 @@ public function testPushFilesAcsf(): void { $process = $this->mockProcess(); $this->mockExecuteAcsfRsync($localMachineHelper, $process, reset($multisiteConfig['sites'])['name']); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->command->sshHelper = $sshHelper->reveal(); $inputs = [ @@ -66,7 +64,6 @@ public function testPushFilesCloud(): void { $process = $this->mockProcess(); $this->mockExecuteCloudRsync($localMachineHelper, $process, $selectedEnvironment); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->command->sshHelper = $sshHelper->reveal(); $inputs = [ @@ -103,7 +100,6 @@ public function testPushFilesNoOverwrite(): void { $this->mockGetCloudSites($sshHelper, $selectedEnvironment); $localMachineHelper = $this->mockLocalMachineHelper(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->command->sshHelper = $sshHelper->reveal(); $inputs = [ diff --git a/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php b/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php index 104898cf6..3532e4dd4 100644 --- a/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php +++ b/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php @@ -4,12 +4,12 @@ namespace Acquia\Cli\Tests\Commands\Remote; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Remote\AliasesDownloadCommand; use Acquia\Cli\Tests\CommandTestBase; use GuzzleHttp\Psr7\Utils; use Phar; use PharData; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Path; /** @@ -17,7 +17,7 @@ */ class AliasesDownloadCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(AliasesDownloadCommand::class); } diff --git a/tests/phpunit/src/Commands/Remote/AliasesListCommandTest.php b/tests/phpunit/src/Commands/Remote/AliasesListCommandTest.php index efc72fecb..cb8618d78 100644 --- a/tests/phpunit/src/Commands/Remote/AliasesListCommandTest.php +++ b/tests/phpunit/src/Commands/Remote/AliasesListCommandTest.php @@ -4,16 +4,16 @@ namespace Acquia\Cli\Tests\Commands\Remote; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Remote\AliasListCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property AliasListCommand $command */ class AliasesListCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(AliasListCommand::class); } diff --git a/tests/phpunit/src/Commands/Remote/DrushCommandTest.php b/tests/phpunit/src/Commands/Remote/DrushCommandTest.php index b5451c7eb..9c7a2c642 100644 --- a/tests/phpunit/src/Commands/Remote/DrushCommandTest.php +++ b/tests/phpunit/src/Commands/Remote/DrushCommandTest.php @@ -4,18 +4,18 @@ namespace Acquia\Cli\Tests\Commands\Remote; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Remote\DrushCommand; use Acquia\Cli\Command\Self\ClearCacheCommand; use Acquia\Cli\Helpers\SshHelper; use Prophecy\Argument; -use Symfony\Component\Console\Command\Command; /** * @property DrushCommand $command */ class DrushCommandTest extends SshCommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(DrushCommand::class); } @@ -66,7 +66,7 @@ public function testRemoteDrushCommand(array $args): void { ->execute($sshCommand, Argument::type('callable'), NULL, TRUE, NULL) ->willReturn($process->reveal()) ->shouldBeCalled(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->command->sshHelper = new SshHelper($this->output, $localMachineHelper->reveal(), $this->logger); $this->executeCommand($args); diff --git a/tests/phpunit/src/Commands/Remote/SshCommandTest.php b/tests/phpunit/src/Commands/Remote/SshCommandTest.php index bd26a42de..5f3e32843 100644 --- a/tests/phpunit/src/Commands/Remote/SshCommandTest.php +++ b/tests/phpunit/src/Commands/Remote/SshCommandTest.php @@ -4,18 +4,18 @@ namespace Acquia\Cli\Tests\Commands\Remote; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Remote\SshCommand; use Acquia\Cli\Command\Self\ClearCacheCommand; use Acquia\Cli\Helpers\SshHelper; use Prophecy\Argument; -use Symfony\Component\Console\Command\Command; /** * @property SshCommand $command */ class SshCommandTest extends SshCommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(SshCommand::class); } @@ -40,7 +40,7 @@ public function testRemoteAliasesDownloadCommand(): void { ->execute($sshCommand, Argument::type('callable'), NULL, TRUE, NULL) ->willReturn($process->reveal()) ->shouldBeCalled(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->command->sshHelper = new SshHelper($this->output, $localMachineHelper->reveal(), $this->logger); $args = [ diff --git a/tests/phpunit/src/Commands/Self/MakeDocsCommandTest.php b/tests/phpunit/src/Commands/Self/MakeDocsCommandTest.php index 4bb4c05a1..803637b0d 100644 --- a/tests/phpunit/src/Commands/Self/MakeDocsCommandTest.php +++ b/tests/phpunit/src/Commands/Self/MakeDocsCommandTest.php @@ -4,16 +4,16 @@ namespace Acquia\Cli\Tests\Commands\Self; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Self\MakeDocsCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Self\MakeDocsCommand $command */ class MakeDocsCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(MakeDocsCommand::class); } diff --git a/tests/phpunit/src/Commands/Ssh/SshKeyCreateCommandTest.php b/tests/phpunit/src/Commands/Ssh/SshKeyCreateCommandTest.php index 6550cdc35..bc7e9975d 100644 --- a/tests/phpunit/src/Commands/Ssh/SshKeyCreateCommandTest.php +++ b/tests/phpunit/src/Commands/Ssh/SshKeyCreateCommandTest.php @@ -4,9 +4,9 @@ namespace Acquia\Cli\Tests\Commands\Ssh; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ssh\SshKeyCreateCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Path; @@ -17,7 +17,7 @@ class SshKeyCreateCommandTest extends CommandTestBase { protected string $filename = 'id_rsa_acli_test'; - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(SshKeyCreateCommand::class); } @@ -77,7 +77,7 @@ public function testCreate(mixed $sshAddSuccess, mixed $args, mixed $inputs): vo $this->mockGenerateSshKey($localMachineHelper); $localMachineHelper->getFilesystem()->willReturn($fileSystem->reveal())->shouldBeCalled(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + $this->executeCommand($args, $inputs); } diff --git a/tests/phpunit/src/Commands/Ssh/SshKeyCreateUploadCommandTest.php b/tests/phpunit/src/Commands/Ssh/SshKeyCreateUploadCommandTest.php index 08c780a55..c2430e129 100644 --- a/tests/phpunit/src/Commands/Ssh/SshKeyCreateUploadCommandTest.php +++ b/tests/phpunit/src/Commands/Ssh/SshKeyCreateUploadCommandTest.php @@ -4,11 +4,11 @@ namespace Acquia\Cli\Tests\Commands\Ssh; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ssh\SshKeyCreateCommand; use Acquia\Cli\Command\Ssh\SshKeyCreateUploadCommand; use Acquia\Cli\Command\Ssh\SshKeyUploadCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Filesystem; /** @@ -26,7 +26,7 @@ public function setUp(mixed $output = NULL): void { ]); } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(SshKeyCreateUploadCommand::class); } @@ -51,7 +51,6 @@ public function testCreateUpload(): void { $this->mockGetLocalSshKey($localMachineHelper, $fileSystem, $mockRequestArgs['public_key']); $localMachineHelper->getFilesystem()->willReturn($fileSystem->reveal())->shouldBeCalled(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); /** @var SshKeyCreateCommand $sshKeyCreateCommand */ $sshKeyCreateCommand = $this->application->find(SshKeyCreateCommand::getDefaultName()); diff --git a/tests/phpunit/src/Commands/Ssh/SshKeyDeleteCommandTest.php b/tests/phpunit/src/Commands/Ssh/SshKeyDeleteCommandTest.php index 5712d9f78..3f95818ac 100644 --- a/tests/phpunit/src/Commands/Ssh/SshKeyDeleteCommandTest.php +++ b/tests/phpunit/src/Commands/Ssh/SshKeyDeleteCommandTest.php @@ -4,16 +4,16 @@ namespace Acquia\Cli\Tests\Commands\Ssh; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ssh\SshKeyDeleteCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property SshKeyDeleteCommand $command */ class SshKeyDeleteCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(SshKeyDeleteCommand::class); } diff --git a/tests/phpunit/src/Commands/Ssh/SshKeyInfoCommandTest.php b/tests/phpunit/src/Commands/Ssh/SshKeyInfoCommandTest.php index a637f43ed..95c4937cf 100644 --- a/tests/phpunit/src/Commands/Ssh/SshKeyInfoCommandTest.php +++ b/tests/phpunit/src/Commands/Ssh/SshKeyInfoCommandTest.php @@ -4,13 +4,13 @@ namespace Acquia\Cli\Tests\Commands\Ssh; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ssh\SshKeyInfoCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; class SshKeyInfoCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(SshKeyInfoCommand::class); } diff --git a/tests/phpunit/src/Commands/Ssh/SshKeyListCommandTest.php b/tests/phpunit/src/Commands/Ssh/SshKeyListCommandTest.php index 3d93615d1..3dd5e8cb9 100644 --- a/tests/phpunit/src/Commands/Ssh/SshKeyListCommandTest.php +++ b/tests/phpunit/src/Commands/Ssh/SshKeyListCommandTest.php @@ -4,16 +4,16 @@ namespace Acquia\Cli\Tests\Commands\Ssh; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ssh\SshKeyListCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property SshKeyListCommand $command */ class SshKeyListCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(SshKeyListCommand::class); } diff --git a/tests/phpunit/src/Commands/Ssh/SshKeyUploadCommandTest.php b/tests/phpunit/src/Commands/Ssh/SshKeyUploadCommandTest.php index 47f9696ba..ad9ba4412 100644 --- a/tests/phpunit/src/Commands/Ssh/SshKeyUploadCommandTest.php +++ b/tests/phpunit/src/Commands/Ssh/SshKeyUploadCommandTest.php @@ -4,17 +4,17 @@ namespace Acquia\Cli\Tests\Commands\Ssh; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ssh\SshKeyUploadCommand; use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; use Prophecy\Argument; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Path; class SshKeyUploadCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(SshKeyUploadCommand::class); } @@ -87,8 +87,6 @@ public function testUpload(array $args, array $inputs, bool $perms): void { $localMachineHelper->getLocalFilepath(Argument::containingString('id_rsa'))->willReturn('id_rsa.pub'); $localMachineHelper->readFile(Argument::type('string'))->willReturn($sshKeysRequestBody['public_key']); - $this->command->localMachineHelper = $localMachineHelper->reveal(); - if ($perms) { $environmentsResponse = $this->mockEnvironmentsRequest($applicationsResponse); $sshHelper = $this->mockPollCloudViaSsh($environmentsResponse); diff --git a/tests/phpunit/src/Commands/TelemetryCommandTest.php b/tests/phpunit/src/Commands/TelemetryCommandTest.php index bfcd45dfc..f1dac1739 100644 --- a/tests/phpunit/src/Commands/TelemetryCommandTest.php +++ b/tests/phpunit/src/Commands/TelemetryCommandTest.php @@ -5,10 +5,10 @@ namespace Acquia\Cli\Tests\Commands; use Acquia\Cli\Command\App\LinkCommand; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Self\TelemetryCommand; use Acquia\Cli\Helpers\DataStoreContract; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; use Symfony\Component\Filesystem\Path; /** @@ -26,7 +26,7 @@ public function setUp(): void { /**b */ - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(TelemetryCommand::class); } diff --git a/tests/phpunit/src/Commands/TelemetryDisableCommandTest.php b/tests/phpunit/src/Commands/TelemetryDisableCommandTest.php index 0f0cc9db0..25647d72d 100644 --- a/tests/phpunit/src/Commands/TelemetryDisableCommandTest.php +++ b/tests/phpunit/src/Commands/TelemetryDisableCommandTest.php @@ -4,16 +4,16 @@ namespace Acquia\Cli\Tests\Commands; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Self\TelemetryDisableCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Self\TelemetryDisableCommand $command */ class TelemetryDisableCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(TelemetryDisableCommand::class); } diff --git a/tests/phpunit/src/Commands/TelemetryEnableCommandTest.php b/tests/phpunit/src/Commands/TelemetryEnableCommandTest.php index ede1aa650..5cfc79953 100644 --- a/tests/phpunit/src/Commands/TelemetryEnableCommandTest.php +++ b/tests/phpunit/src/Commands/TelemetryEnableCommandTest.php @@ -4,9 +4,9 @@ namespace Acquia\Cli\Tests\Commands; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Self\TelemetryEnableCommand; use Acquia\Cli\Tests\CommandTestBase; -use Symfony\Component\Console\Command\Command; /** * @property \Acquia\Cli\Command\Self\TelemetryEnableCommand $command @@ -15,7 +15,7 @@ class TelemetryEnableCommandTest extends CommandTestBase { /**b */ - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(TelemetryEnableCommand::class); } diff --git a/tests/phpunit/src/Commands/UpdateCommandTest.php b/tests/phpunit/src/Commands/UpdateCommandTest.php index fe42219ec..11c4d3da9 100644 --- a/tests/phpunit/src/Commands/UpdateCommandTest.php +++ b/tests/phpunit/src/Commands/UpdateCommandTest.php @@ -4,15 +4,15 @@ namespace Acquia\Cli\Tests\Commands; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\HelloWorldCommand; use Acquia\Cli\Tests\CommandTestBase; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; -use Symfony\Component\Console\Command\Command; class UpdateCommandTest extends CommandTestBase { - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(HelloWorldCommand::class); } diff --git a/tests/phpunit/src/Commands/WizardTestBase.php b/tests/phpunit/src/Commands/WizardTestBase.php index 5876b0fe5..35671396d 100644 --- a/tests/phpunit/src/Commands/WizardTestBase.php +++ b/tests/phpunit/src/Commands/WizardTestBase.php @@ -74,7 +74,7 @@ protected function runTestCreate(): void { $this->mockAddSshKeyToAgent($localMachineHelper, $fileSystem); $this->mockSshAgentList($localMachineHelper); $localMachineHelper->getFilesystem()->willReturn($fileSystem->reveal())->shouldBeCalled(); - $this->command->localMachineHelper = $localMachineHelper->reveal(); + /** @var SshKeyCreateCommand $sshKeyCreateCommand */ $sshKeyCreateCommand = $this->application->find(SshKeyCreateCommand::getDefaultName()); $sshKeyCreateCommand->localMachineHelper = $this->command->localMachineHelper; @@ -145,7 +145,6 @@ protected function runTestSshKeyAlreadyUploaded(): void { ->shouldBeCalled(); $this->mockSshAgentList($localMachineHelper); - $this->command->localMachineHelper = $localMachineHelper->reveal(); $this->application->find(SshKeyCreateCommand::getDefaultName())->localMachineHelper = $this->command->localMachineHelper; $this->application->find(SshKeyUploadCommand::getDefaultName())->localMachineHelper = $this->command->localMachineHelper; $this->application->find(SshKeyDeleteCommand::getDefaultName())->localMachineHelper = $this->command->localMachineHelper; diff --git a/tests/phpunit/src/Misc/EnvDbCredsTest.php b/tests/phpunit/src/Misc/EnvDbCredsTest.php index 6ad9ca80d..fb02fd52d 100644 --- a/tests/phpunit/src/Misc/EnvDbCredsTest.php +++ b/tests/phpunit/src/Misc/EnvDbCredsTest.php @@ -4,10 +4,10 @@ namespace Acquia\Cli\Tests\Misc; +use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Self\ClearCacheCommand; use Acquia\Cli\Tests\CommandTestBase; use Acquia\Cli\Tests\TestBase; -use Symfony\Component\Console\Command\Command; class EnvDbCredsTest extends CommandTestBase { @@ -45,7 +45,7 @@ protected function getEnvVars(): array { ]; } - protected function createCommand(): Command { + protected function createCommand(): CommandBase { return $this->injectCommand(ClearCacheCommand::class); }