From 3551105b2f11ac310080fa6d90732d35f8cd7818 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 14 Nov 2024 13:53:22 -0800 Subject: [PATCH] fix tests --- src/Command/App/LogTailCommand.php | 2 +- src/Command/Email/ConfigurePlatformEmailCommand.php | 2 +- src/Command/Remote/DrushCommand.php | 2 +- .../src/Commands/Acsf/AcsfAuthLoginCommandTest.php | 11 +++++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Command/App/LogTailCommand.php b/src/Command/App/LogTailCommand.php index eb00a1337..feaf60209 100644 --- a/src/Command/App/LogTailCommand.php +++ b/src/Command/App/LogTailCommand.php @@ -54,7 +54,7 @@ protected function configure(): void protected function execute(InputInterface $input, OutputInterface $output): int { - $environment = $this->determineEnvironment($input, $output, true); + $environment = $this->determineEnvironment($input, $output); $acquiaCloudClient = $this->cloudApiClientService->getClient(); $logs = $this->promptChooseLogs(); $logTypes = array_map(static function (mixed $log) { diff --git a/src/Command/Email/ConfigurePlatformEmailCommand.php b/src/Command/Email/ConfigurePlatformEmailCommand.php index 60696032f..85556aa59 100644 --- a/src/Command/Email/ConfigurePlatformEmailCommand.php +++ b/src/Command/Email/ConfigurePlatformEmailCommand.php @@ -225,7 +225,7 @@ private function addDomainToSubscriptionApplications(Client $client, Subscriptio /** * Validates the URL entered as the base domain name. */ - public static function validateUrl(?string $url): string + protected static function validateUrl(?string $url): string { $constraintsList = [new NotBlank()]; $urlParts = parse_url($url); diff --git a/src/Command/Remote/DrushCommand.php b/src/Command/Remote/DrushCommand.php index 2bc1f906c..1e58398d4 100644 --- a/src/Command/Remote/DrushCommand.php +++ b/src/Command/Remote/DrushCommand.php @@ -36,7 +36,7 @@ protected function configure(): void */ protected function execute(InputInterface $input, OutputInterface $output): ?int { - $environment = $this->determineEnvironment($input, $output, true); + $environment = $this->determineEnvironment($input, $output); $alias = self::getEnvironmentAlias($environment); $acliArguments = $input->getArguments(); $drushArguments = (array) $acliArguments['drush_command']; diff --git a/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php b/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php index f34948c90..616b5f0bd 100644 --- a/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php +++ b/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php @@ -9,6 +9,7 @@ use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Config\CloudDataConfig; use Acquia\Cli\DataStore\CloudDataStore; +use Symfony\Component\Console\Exception\MissingInputException; use Symfony\Component\Validator\Exception\ValidatorException; /** @@ -151,6 +152,16 @@ public function testAcsfAuthLoginInvalid(array $args, string $message): void $this->executeCommand($args); } + public function testAcsfAuthLoginInvalidInput(): void + { + $this->removeMockCloudConfigFile(); + $this->createMockCloudConfigFile(AcsfCommandTestBase::getAcsfCredentialsFileContents()); + $this->createDataStores(); + $this->command = $this->createCommand(); + $this->expectException(MissingInputException::class); + $this->executeCommand([], ['n', 'Enter a new factory URL', 'example.com']); + } + protected function assertKeySavedCorrectly(): void { $credsFile = $this->cloudConfigFilepath;