From 4bfe4f46e40cfb970e38dddbf12f638fbdb0795e Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 11 Jul 2024 11:56:14 -0700 Subject: [PATCH] Fix array indentation --- .editorconfig | 5 +- phpcs.xml.dist | 5 +- src/AcsfApi/AcsfConnector.php | 10 +- src/CloudApi/ClientService.php | 2 +- src/CloudApi/ConnectorFactory.php | 10 +- src/Command/Acsf/AcsfListCommandBase.php | 4 +- src/Command/Api/ApiBaseCommand.php | 20 +- src/Command/Api/ApiCommandHelper.php | 38 +- src/Command/Api/ApiListCommandBase.php | 4 +- src/Command/App/AppVcsInfo.php | 6 +- .../App/From/Composer/ProjectBuilder.php | 22 +- src/Command/App/From/Configuration.php | 2 +- .../AbandonmentRecommendation.php | 34 +- .../Recommendation/DefinedRecommendation.php | 68 +- .../From/SourceSite/Drupal7SiteInspector.php | 10 +- src/Command/App/NewCommand.php | 46 +- src/Command/App/NewFromDrupal7Command.php | 38 +- src/Command/Auth/AuthAcsfLoginCommand.php | 14 +- src/Command/Auth/AuthLoginCommand.php | 10 +- .../CodeStudio/CodeStudioCiCdVariables.php | 168 ++--- .../CodeStudio/CodeStudioCommandTrait.php | 84 +-- .../CodeStudioPipelinesMigrateCommand.php | 112 +-- .../CodeStudio/CodeStudioWizardCommand.php | 78 +-- src/Command/CommandBase.php | 110 +-- src/Command/DocsCommand.php | 144 ++-- .../Email/ConfigurePlatformEmailCommand.php | 18 +- .../Email/EmailInfoForSubscriptionCommand.php | 52 +- src/Command/Env/EnvCopyCronCommand.php | 18 +- src/Command/Env/EnvCreateCommand.php | 4 +- src/Command/Env/EnvDeleteCommand.php | 2 +- src/Command/Env/EnvMirrorCommand.php | 12 +- src/Command/Ide/IdeCommandBase.php | 18 +- src/Command/Ide/IdeCreateCommand.php | 2 +- src/Command/Ide/IdeListCommand.php | 8 +- src/Command/Ide/IdeListMineCommand.php | 14 +- src/Command/Ide/IdeServiceRestartCommand.php | 20 +- src/Command/Ide/IdeServiceStartCommand.php | 20 +- src/Command/Ide/IdeServiceStopCommand.php | 20 +- src/Command/Ide/IdeShareCommand.php | 4 +- .../Wizard/IdeWizardCreateSshKeyCommand.php | 4 +- src/Command/Pull/PullCommandBase.php | 94 +-- src/Command/Push/PushArtifactCommand.php | 88 +-- src/Command/Push/PushDatabaseCommand.php | 10 +- src/Command/Remote/AliasesDownloadCommand.php | 4 +- src/Command/Remote/DrushCommand.php | 6 +- src/Command/Remote/SshCommand.php | 2 +- src/Command/Self/ListCommand.php | 14 +- src/Command/Self/MakeDocsCommand.php | 12 +- src/Command/Ssh/SshKeyCommandBase.php | 32 +- src/Command/Ssh/SshKeyInfoCommand.php | 10 +- src/Command/Ssh/SshKeyListCommand.php | 18 +- src/Command/WizardCommandBase.php | 4 +- src/Exception/AcquiaCliException.php | 4 +- src/Helpers/LocalMachineHelper.php | 6 +- src/Helpers/SshCommandTrait.php | 4 +- src/Helpers/SshHelper.php | 18 +- src/Helpers/TelemetryHelper.php | 64 +- src/Kernel.php | 20 +- src/Output/Spinner/Spinner.php | 120 ++-- tests/phpunit/src/AcsfApi/AcsfServiceTest.php | 32 +- .../ComposerScriptsListenerTest.php | 38 +- .../Application/ExceptionApplicationTest.php | 4 +- .../src/Application/HelpApplicationTest.php | 8 +- tests/phpunit/src/Application/KernelTest.php | 2 +- .../src/CloudApi/AccessTokenConnectorTest.php | 44 +- .../src/CloudApi/AcsfClientServiceTest.php | 16 +- .../src/CloudApi/ClientServiceTest.php | 32 +- tests/phpunit/src/CommandTestBase.php | 178 ++--- .../src/Commands/Acsf/AcsfApiCommandTest.php | 20 +- .../Acsf/AcsfAuthLoginCommandTest.php | 102 +-- .../Acsf/AcsfAuthLogoutCommandTest.php | 32 +- .../src/Commands/Acsf/AcsfCommandTestBase.php | 28 +- .../src/Commands/Api/ApiCommandTest.php | 76 +- .../src/Commands/App/AppVcsInfoTest.php | 14 +- .../From/AbandonmentRecommendationTest.php | 12 +- .../Commands/App/From/ConfigurationTest.php | 4 +- .../App/From/DefinedRecommendationTest.php | 242 +++---- .../Commands/App/From/ProjectBuilderTest.php | 46 +- .../Commands/App/From/RecommendationsTest.php | 68 +- .../src/Commands/App/LinkCommandTest.php | 4 +- .../src/Commands/App/LogTailCommandTest.php | 24 +- .../src/Commands/App/NewCommandTest.php | 58 +- .../App/NewFromDrupal7CommandTest.php | 46 +- .../src/Commands/App/TaskWaitCommandTest.php | 48 +- .../Archive/ArchiveExporterCommandTest.php | 4 +- .../Commands/Auth/AuthLoginCommandTest.php | 28 +- .../Commands/Auth/AuthLogoutCommandTest.php | 16 +- .../src/Commands/ClearCacheCommandTest.php | 2 +- .../CodeStudioPhpVersionCommandTest.php | 76 +- .../CodeStudioPipelinesMigrateCommandTest.php | 110 +-- .../CodeStudioWizardCommandTest.php | 658 +++++++++--------- .../phpunit/src/Commands/CommandBaseTest.php | 16 +- .../phpunit/src/Commands/DocsCommandTest.php | 144 ++-- .../ConfigurePlatformEmailCommandTest.php | 346 ++++----- .../EmailInfoForSubscriptionCommandTest.php | 14 +- .../Commands/Env/EnvCertCreateCommandTest.php | 66 +- .../Commands/Env/EnvCopyCronCommandTest.php | 22 +- .../src/Commands/Env/EnvCreateCommandTest.php | 24 +- .../src/Commands/Env/EnvDeleteCommandTest.php | 18 +- .../src/Commands/Env/EnvMirrorCommandTest.php | 26 +- .../src/Commands/Ide/IdeCreateCommandTest.php | 8 +- .../src/Commands/Ide/IdeDeleteCommandTest.php | 24 +- tests/phpunit/src/Commands/Ide/IdeHelper.php | 8 +- .../src/Commands/Ide/IdeInfoCommandTest.php | 8 +- .../Commands/Ide/IdeListCommandMineTest.php | 6 +- .../src/Commands/Ide/IdeListCommandTest.php | 12 +- .../src/Commands/Ide/IdeOpenCommandTest.php | 8 +- .../Commands/Ide/IdePhpVersionCommandTest.php | 26 +- .../Ide/IdeXdebugToggleCommandTest.php | 12 +- .../src/Commands/InferApplicationTest.php | 12 +- .../src/Commands/Pull/PullCodeCommandTest.php | 40 +- .../src/Commands/Pull/PullCommandTest.php | 14 +- .../src/Commands/Pull/PullCommandTestBase.php | 112 +-- .../Commands/Pull/PullDatabaseCommandTest.php | 56 +- .../Commands/Pull/PullFilesCommandTest.php | 20 +- .../Commands/Pull/PullScriptsCommandTest.php | 10 +- .../Commands/Push/PushArtifactCommandTest.php | 86 +-- .../Commands/Push/PushDatabaseCommandTest.php | 56 +- .../Commands/Push/PushFilesCommandTest.php | 56 +- .../Remote/AliasesDownloadCommandTest.php | 8 +- .../Remote/AliasesListCommandTest.php | 6 +- .../src/Commands/Remote/DrushCommandTest.php | 42 +- .../src/Commands/Remote/SshCommandTest.php | 16 +- .../Commands/Ssh/SshKeyCreateCommandTest.php | 66 +- .../Ssh/SshKeyCreateUploadCommandTest.php | 18 +- .../Commands/Ssh/SshKeyDeleteCommandTest.php | 4 +- .../Commands/Ssh/SshKeyInfoCommandTest.php | 2 +- .../Commands/Ssh/SshKeyUploadCommandTest.php | 82 +-- .../src/Commands/TelemetryCommandTest.php | 8 +- tests/phpunit/src/Commands/WizardTestBase.php | 28 +- tests/phpunit/src/Misc/EnvDbCredsTest.php | 8 +- .../src/Misc/ExceptionListenerTest.php | 120 ++-- .../src/Misc/LocalMachineHelperTest.php | 16 +- .../phpunit/src/Misc/TelemetryHelperTest.php | 16 +- tests/phpunit/src/TestBase.php | 62 +- 135 files changed, 2807 insertions(+), 2807 deletions(-) diff --git a/.editorconfig b/.editorconfig index 5044247d2..51d29a157 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,10 +4,7 @@ root = true [*] charset = utf-8 indent_style = space -indent_size = 2 +indent_size = 4 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true - -[composer.{json,lock}] -indent_size = 4 diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 389eea79e..11def6e88 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -26,7 +26,10 @@ - + + + + diff --git a/src/AcsfApi/AcsfConnector.php b/src/AcsfApi/AcsfConnector.php index 24dc8778e..69b1d3af2 100644 --- a/src/AcsfApi/AcsfConnector.php +++ b/src/AcsfApi/AcsfConnector.php @@ -20,11 +20,11 @@ public function __construct(array $config, string $baseUri = null, string $urlAc parent::__construct($config, $baseUri, $urlAccessToken); $this->client = new GuzzleClient([ - 'auth' => [ - $config['key'], - $config['secret'], - ], - 'base_uri' => $this->getBaseUri(), + 'auth' => [ + $config['key'], + $config['secret'], + ], + 'base_uri' => $this->getBaseUri(), ]); } diff --git a/src/CloudApi/ClientService.php b/src/CloudApi/ClientService.php index 95acecea6..5021deaca 100644 --- a/src/CloudApi/ClientService.php +++ b/src/CloudApi/ClientService.php @@ -53,7 +53,7 @@ protected function configureClient(Client $client): void { $userAgent = sprintf("acli/%s", $this->application->getVersion()); $customHeaders = [ - 'User-Agent' => [$userAgent], + 'User-Agent' => [$userAgent], ]; if ($uuid = getenv("REMOTEIDE_UUID")) { $customHeaders['X-Cloud-IDE-UUID'] = $uuid; diff --git a/src/CloudApi/ConnectorFactory.php b/src/CloudApi/ConnectorFactory.php index f8fd82488..5e1c99e73 100644 --- a/src/CloudApi/ConnectorFactory.php +++ b/src/CloudApi/ConnectorFactory.php @@ -33,9 +33,9 @@ public function createConnector(): Connector|AccessTokenConnector if (!$accessToken->hasExpired()) { // @todo Add debug log entry indicating that access token is being used. return new AccessTokenConnector([ - 'access_token' => $accessToken, - 'key' => null, - 'secret' => null, + 'access_token' => $accessToken, + 'key' => null, + 'secret' => null, ], $this->baseUri, $this->accountsUri); } } @@ -47,8 +47,8 @@ public function createConnector(): Connector|AccessTokenConnector private function createAccessToken(): AccessToken { return new AccessToken([ - 'access_token' => $this->config['accessToken'], - 'expires' => $this->config['accessTokenExpiry'], + 'access_token' => $this->config['accessToken'], + 'expires' => $this->config['accessTokenExpiry'], ]); } } diff --git a/src/Command/Acsf/AcsfListCommandBase.php b/src/Command/Acsf/AcsfListCommandBase.php index 3778dce33..f26bca61e 100644 --- a/src/Command/Acsf/AcsfListCommandBase.php +++ b/src/Command/Acsf/AcsfListCommandBase.php @@ -37,8 +37,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $command = $this->getApplication()->find('list'); $arguments = [ - 'command' => 'list', - 'namespace' => 'acsf', + 'command' => 'list', + 'namespace' => 'acsf', ]; $listInput = new ArrayInput($arguments); diff --git a/src/Command/Api/ApiBaseCommand.php b/src/Command/Api/ApiBaseCommand.php index 6149daf93..f6c05e099 100644 --- a/src/Command/Api/ApiBaseCommand.php +++ b/src/Command/Api/ApiBaseCommand.php @@ -62,8 +62,8 @@ protected function interact(InputInterface $input, OutputInterface $output): voi foreach ($this->getDefinition()->getArguments() as $argument) { if ($argument->isRequired() && !$input->getArgument($argument->getName())) { $this->io->note([ - "{$argument->getName()} is a required argument.", - $argument->getDescription(), + "{$argument->getName()} is a required argument.", + $argument->getDescription(), ]); // Choice question. if ( @@ -103,7 +103,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int // API calls returning octet streams (e.g., db backups). It's safe to use // here because the API command should always return JSON. $acquiaCloudClient->addOption('headers', [ - 'Accept' => 'application/hal+json, version=2', + 'Accept' => 'application/hal+json, version=2', ]); try { @@ -265,7 +265,7 @@ private function createCallableValidator(InputArgument $argument, array $params) if (array_key_exists($argument->getName(), $params)) { $paramSpec = $params[$argument->getName()]; $constraints = [ - new NotBlank(), + new NotBlank(), ]; if ($type = $this->getParamType($paramSpec)) { if (in_array($type, ['int', 'integer'])) { @@ -316,8 +316,8 @@ protected function createRegexConstraint(array $schema, array $constraints): arr } } elseif (array_key_exists('pattern', $schema)) { $constraints[] = new Regex([ - 'message' => 'It must match the pattern ' . $schema['pattern'], - 'pattern' => '/' . $schema['pattern'] . '/', + 'message' => 'It must match the pattern ' . $schema['pattern'], + 'pattern' => '/' . $schema['pattern'] . '/', ]); } return $constraints; @@ -372,10 +372,10 @@ private function addPostParamToClient(string $paramName, ?array $paramSpec, mixe } if ($paramSpec && array_key_exists('format', $paramSpec) && $paramSpec["format"] === 'binary') { $acquiaCloudClient->addOption('multipart', [ - [ - 'contents' => Utils::tryFopen($paramValue, 'r'), - 'name' => $paramName, - ], + [ + 'contents' => Utils::tryFopen($paramValue, 'r'), + 'name' => $paramName, + ], ]); } else { $acquiaCloudClient->addOption('json', [$paramName => $paramValue]); diff --git a/src/Command/Api/ApiCommandHelper.php b/src/Command/Api/ApiCommandHelper.php index 867a3d84a..2be9124e7 100644 --- a/src/Command/Api/ApiCommandHelper.php +++ b/src/Command/Api/ApiCommandHelper.php @@ -84,8 +84,8 @@ private function addApiCommandParameters(array $schema, array $acquiaCloudSpec, // Parameters to be used in the request body. if (array_key_exists('requestBody', $schema)) { [ - $bodyInputDefinition, - $requestBodyParamUsageSuffix, + $bodyInputDefinition, + $requestBodyParamUsageSuffix, ] = $this->addApiCommandParametersForRequestBody($schema, $acquiaCloudSpec); $requestBodySchema = $this->getRequestBodyFromParameterSchema($schema, $acquiaCloudSpec); /** @var \Symfony\Component\Console\Input\InputOption|InputArgument $parameterDefinition */ @@ -310,8 +310,8 @@ private function getCloudApiSpec(string $specFilePath): array $spec = json_decode(file_get_contents($specFilePath), true); $cache->warmUp([ - $cacheKey => $spec, - $cacheKey . '.checksum' => $checksum, + $cacheKey => $spec, + $cacheKey . '.checksum' => $checksum, ]); return $spec; @@ -367,17 +367,17 @@ protected function getSkippedApiCommands(): array return [ // Skip accounts:drush-aliases since we have remote:aliases:download instead and it actually returns // application/gzip content. - 'accounts:drush-aliases', + 'accounts:drush-aliases', // Skip any command that has a duplicative corresponding ACLI command. - 'ide:create', - 'log:tail', - 'ssh-key:create', - 'ssh-key:create-upload', - 'ssh-key:delete', - 'ssh-key:list', - 'ssh-key:upload', + 'ide:create', + 'log:tail', + 'ssh-key:create', + 'ssh-key:create-upload', + 'ssh-key:delete', + 'ssh-key:list', + 'ssh-key:upload', // Skip buggy or unsupported endpoints. - 'environments:stack-metrics-data-metric', + 'environments:stack-metrics-data-metric', ]; } @@ -440,9 +440,9 @@ protected static function getParameterRenameMap(): array // Format should be ['original => new']. return [ // @see api:environments:cron-create - 'command' => 'cron_command', + 'command' => 'cron_command', // @see api:environments:update. - 'version' => 'lang_version', + 'version' => 'lang_version', ]; } @@ -498,10 +498,10 @@ private function getRequestBodyContent(array $requestBody): array { $content = $requestBody['content']; $knownContentTypes = [ - 'application/hal+json', - 'application/json', - 'application/x-www-form-urlencoded', - 'multipart/form-data', + 'application/hal+json', + 'application/json', + 'application/x-www-form-urlencoded', + 'multipart/form-data', ]; foreach ($knownContentTypes as $contentType) { if (array_key_exists($contentType, $content)) { diff --git a/src/Command/Api/ApiListCommandBase.php b/src/Command/Api/ApiListCommandBase.php index 9234d1496..426895845 100644 --- a/src/Command/Api/ApiListCommandBase.php +++ b/src/Command/Api/ApiListCommandBase.php @@ -36,8 +36,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $command = $this->getApplication()->find('list'); $arguments = [ - 'command' => 'list', - 'namespace' => 'api', + 'command' => 'list', + 'namespace' => 'api', ]; $listInput = new ArrayInput($arguments); diff --git a/src/Command/App/AppVcsInfo.php b/src/Command/App/AppVcsInfo.php index 85250d224..0d7c868fb 100644 --- a/src/Command/App/AppVcsInfo.php +++ b/src/Command/App/AppVcsInfo.php @@ -82,11 +82,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int $table->setHeaderTitle('Status of Branches and Tags of the Application'); foreach ($allVcs as $vscPath => $env) { $table->addRow([ - $vscPath, + $vscPath, // If VCS and env name is not same, it means it is deployed. - $vscPath !== $env ? 'Yes' : 'No', + $vscPath !== $env ? 'Yes' : 'No', // If VCS and env name is same, it means it is deployed. - $vscPath !== $env ? $env : 'None', + $vscPath !== $env ? $env : 'None', ]); } diff --git a/src/Command/App/From/Composer/ProjectBuilder.php b/src/Command/App/From/Composer/ProjectBuilder.php index 71a17b6a9..2aface12f 100644 --- a/src/Command/App/From/Composer/ProjectBuilder.php +++ b/src/Command/App/From/Composer/ProjectBuilder.php @@ -127,9 +127,9 @@ public function buildProject(): array $source_modules = array_values(array_map(function (ExtensionInterface $module) { // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys return [ - 'name' => $module->getName(), - 'humanName' => $module->getHumanName(), - 'version' => $module->getVersion(), + 'name' => $module->getName(), + 'humanName' => $module->getHumanName(), + 'version' => $module->getVersion(), ]; // phpcs:enable }, $this->siteInspector->getExtensions(SiteInspectorInterface::FLAG_EXTENSION_MODULE | SiteInspectorInterface::FLAG_EXTENSION_ENABLED))); @@ -141,14 +141,14 @@ public function buildProject(): array // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys return [ - 'installModules' => $modules_to_install, - 'filePaths' => [ - 'public' => $this->siteInspector->getPublicFilePath(), - 'private' => $this->siteInspector->getPrivateFilePath(), - ], - 'sourceModules' => $source_modules, - 'recommendations' => $recommendations, - 'rootPackageDefinition' => $composer_json, + 'installModules' => $modules_to_install, + 'filePaths' => [ + 'public' => $this->siteInspector->getPublicFilePath(), + 'private' => $this->siteInspector->getPrivateFilePath(), + ], + 'sourceModules' => $source_modules, + 'recommendations' => $recommendations, + 'rootPackageDefinition' => $composer_json, ]; // phpcs:enable } diff --git a/src/Command/App/From/Configuration.php b/src/Command/App/From/Configuration.php index bacf660d0..30116a4e8 100644 --- a/src/Command/App/From/Configuration.php +++ b/src/Command/App/From/Configuration.php @@ -30,7 +30,7 @@ final class Configuration protected function __construct(array $config) { $this->array = static::schema([ - 'rootPackageDefinition' => 'is_array', + 'rootPackageDefinition' => 'is_array', ])($config); } diff --git a/src/Command/App/From/Recommendation/AbandonmentRecommendation.php b/src/Command/App/From/Recommendation/AbandonmentRecommendation.php index 2b90af450..c90a1709a 100644 --- a/src/Command/App/From/Recommendation/AbandonmentRecommendation.php +++ b/src/Command/App/From/Recommendation/AbandonmentRecommendation.php @@ -66,12 +66,12 @@ public static function createFromDefinition(mixed $definition): RecommendationIn { // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys $validator = static::schema([ - 'package' => 'is_null', - 'note' => 'is_string', - 'replaces' => static::schema([ - 'name' => 'is_string', - ]), - 'vetted' => 'is_bool', + 'package' => 'is_null', + 'note' => 'is_string', + 'replaces' => static::schema([ + 'name' => 'is_string', + ]), + 'vetted' => 'is_bool', ]); // phpcs:enable try { @@ -145,20 +145,20 @@ public function normalize(): array { // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys $normalized = [ - 'type' => 'abandonmentRecommendation', - 'id' => "abandon:{$this->definition['replaces']['name']}", - 'attributes' => [ - 'note' => $this->definition['note'], - ], + 'type' => 'abandonmentRecommendation', + 'id' => "abandon:{$this->definition['replaces']['name']}", + 'attributes' => [ + 'note' => $this->definition['note'], + ], ]; $recommended_for = [ - 'data' => array_map(function (ExtensionInterface $extension) { - return [ - 'type' => $extension->isModule() ? 'module' : 'theme', - 'id' => $extension->getName(), - ]; - }, $this->appliedTo), + 'data' => array_map(function (ExtensionInterface $extension) { + return [ + 'type' => $extension->isModule() ? 'module' : 'theme', + 'id' => $extension->getName(), + ]; + }, $this->appliedTo), ]; // phpcs:enable if (!empty($recommended_for['data'])) { diff --git a/src/Command/App/From/Recommendation/DefinedRecommendation.php b/src/Command/App/From/Recommendation/DefinedRecommendation.php index fc06cfa4d..1524be745 100644 --- a/src/Command/App/From/Recommendation/DefinedRecommendation.php +++ b/src/Command/App/From/Recommendation/DefinedRecommendation.php @@ -119,11 +119,11 @@ public static function createFromDefinition(mixed $definition): RecommendationIn { // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys $defaults = [ - 'universal' => false, - 'patches' => [], - 'install' => [], - 'vetted' => false, - 'note' => static::NOTE_PLACEHOLDER_STRING, + 'universal' => false, + 'patches' => [], + 'install' => [], + 'vetted' => false, + 'note' => static::NOTE_PLACEHOLDER_STRING, ]; $validate_if_universal_is_false = Closure::fromCallable(function ($context) { return $context['universal'] === false; @@ -134,16 +134,16 @@ public static function createFromDefinition(mixed $definition): RecommendationIn } $validator = static::schema([ - 'universal' => 'is_bool', - 'install' => static::listOf('is_string'), - 'package' => 'is_string', - 'constraint' => 'is_string', - 'note' => 'is_string', - 'replaces' => static::conditionalSchema([ - 'name' => 'is_string', - ], $validate_if_universal_is_false), - 'patches' => static::dictionaryOf('is_string'), - 'vetted' => 'is_bool', + 'universal' => 'is_bool', + 'install' => static::listOf('is_string'), + 'package' => 'is_string', + 'constraint' => 'is_string', + 'note' => 'is_string', + 'replaces' => static::conditionalSchema([ + 'name' => 'is_string', + ], $validate_if_universal_is_false), + 'patches' => static::dictionaryOf('is_string'), + 'vetted' => 'is_bool', ], $defaults); // phpcs:enable try { @@ -226,16 +226,16 @@ public function normalize(): array { // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys $normalized = [ - 'type' => 'packageRecommendation', - 'id' => "{$this->packageName}:{$this->versionConstraint}", - 'attributes' => [ - 'requirePackage' => [ - 'name' => $this->packageName, - 'versionConstraint' => $this->versionConstraint, - ], - 'installModules' => $this->install, - 'vetted' => $this->vetted, - ], + 'type' => 'packageRecommendation', + 'id' => "{$this->packageName}:{$this->versionConstraint}", + 'attributes' => [ + 'requirePackage' => [ + 'name' => $this->packageName, + 'versionConstraint' => $this->versionConstraint, + ], + 'installModules' => $this->install, + 'vetted' => $this->vetted, + ], ]; if (!empty($this->note) && $this->note !== static::NOTE_PLACEHOLDER_STRING) { @@ -243,12 +243,12 @@ public function normalize(): array } $recommended_for = [ - 'data' => array_map(function (ExtensionInterface $extension) { - return [ - 'type' => $extension->isModule() ? 'module' : 'theme', - 'id' => $extension->getName(), - ]; - }, $this->appliedTo), + 'data' => array_map(function (ExtensionInterface $extension) { + return [ + 'type' => $extension->isModule() ? 'module' : 'theme', + 'id' => $extension->getName(), + ]; + }, $this->appliedTo), ]; // phpcs:enable if (!empty($recommended_for['data'])) { @@ -257,9 +257,9 @@ public function normalize(): array $links = array_reduce(array_keys($this->patches), function (array $links, string $patch_description) { $links['patch-file--' . md5($patch_description)] = [ - 'href' => $this->patches[$patch_description], - 'rel' => 'https://github.com/acquia/acquia_migrate#link-rel-patch-file', - 'title' => $patch_description, + 'href' => $this->patches[$patch_description], + 'rel' => 'https://github.com/acquia/acquia_migrate#link-rel-patch-file', + 'title' => $patch_description, ]; return $links; }, []); diff --git a/src/Command/App/From/SourceSite/Drupal7SiteInspector.php b/src/Command/App/From/SourceSite/Drupal7SiteInspector.php index 78c51b85e..1a1e72c80 100644 --- a/src/Command/App/From/SourceSite/Drupal7SiteInspector.php +++ b/src/Command/App/From/SourceSite/Drupal7SiteInspector.php @@ -53,11 +53,11 @@ protected function readExtensions(): array $modules = array_values(array_map(function (string $name) use ($enabled) { // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys return (object) [ - 'name' => $name, - 'status' => true, - 'type' => 'module', - 'humanName' => $enabled[$name]->info['name'], - 'version' => $enabled[$name]->info['version'], + 'name' => $name, + 'status' => true, + 'type' => 'module', + 'humanName' => $enabled[$name]->info['name'], + 'version' => $enabled[$name]->info['version'], ]; // phpcs:enable }, array_keys($enabled))); diff --git a/src/Command/App/NewCommand.php b/src/Command/App/NewCommand.php index df2efb75b..9f53f723a 100644 --- a/src/Command/App/NewCommand.php +++ b/src/Command/App/NewCommand.php @@ -28,8 +28,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->output->writeln('Acquia recommends most customers use acquia/drupal-recommended-project to setup a Drupal project, which includes useful utilities such as Acquia Connector.'); $this->output->writeln('acquia/next-acms is a starter template for building a headless site powered by Acquia CMS and Next.js.'); $distros = [ - 'acquia_drupal_recommended' => 'acquia/drupal-recommended-project', - 'acquia_next_acms' => 'acquia/next-acms', + 'acquia_drupal_recommended' => 'acquia/drupal-recommended-project', + 'acquia_next_acms' => 'acquia/next-acms', ]; $project = $this->io->choice('Choose a starting project', array_values($distros), $distros['acquia_drupal_recommended']); $project = array_search($project, $distros, true); @@ -66,11 +66,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int private function createNextJsProject(string $dir): void { $process = $this->localMachineHelper->execute([ - 'npx', - 'create-next-app', - '-e', - 'https://github.com/acquia/next-acms/tree/main/starters/basic-starter', - $dir, + 'npx', + 'create-next-app', + '-e', + 'https://github.com/acquia/next-acms/tree/main/starters/basic-starter', + $dir, ]); if (!$process->isSuccessful()) { throw new AcquiaCliException("Unable to create new next-acms project."); @@ -80,11 +80,11 @@ private function createNextJsProject(string $dir): void private function createDrupalProject(string $project, string $dir): void { $process = $this->localMachineHelper->execute([ - 'composer', - 'create-project', - $project, - $dir, - '--no-interaction', + 'composer', + 'create-project', + $project, + $dir, + '--no-interaction', ]); if (!$process->isSuccessful()) { throw new AcquiaCliException("Unable to create new project."); @@ -99,23 +99,23 @@ private function initializeGitRepository(string $dir): void } $this->localMachineHelper->checkRequiredBinariesExist(['git']); $this->localMachineHelper->execute([ - 'git', - 'init', - '--initial-branch=main', + 'git', + 'init', + '--initial-branch=main', ], null, $dir); $this->localMachineHelper->execute([ - 'git', - 'add', - '-A', + 'git', + 'add', + '-A', ], null, $dir); $this->localMachineHelper->execute([ - 'git', - 'commit', - '--message', - 'Initial commit.', - '--quiet', + 'git', + 'commit', + '--message', + 'Initial commit.', + '--quiet', ], null, $dir); // @todo Check that this was successful! } diff --git a/src/Command/App/NewFromDrupal7Command.php b/src/Command/App/NewFromDrupal7Command.php index cf1dba8e3..41669d226 100644 --- a/src/Command/App/NewFromDrupal7Command.php +++ b/src/Command/App/NewFromDrupal7Command.php @@ -24,9 +24,9 @@ #[AsCommand(name: 'app:new:from:drupal7', description: 'Generate a new Drupal 9+ project from a Drupal 7 application using the default Acquia Migrate Accelerate recommendations.', aliases: [ // Currently only "from Drupal 7", more to potentially follow. - 'from:d7', + 'from:d7', // A nod to its roots. - 'ama', + 'ama', ])] final class NewFromDrupal7Command extends CommandBase { @@ -200,11 +200,11 @@ function (mixed $path): string { $output->writeln('⏳ Installing. This may take a few minutes.'); $this->localMachineHelper->checkRequiredBinariesExist(['composer']); $process = $this->localMachineHelper->execute([ - 'composer', - 'install', - '--working-dir', - $dir, - '--no-interaction', + 'composer', + 'install', + '--working-dir', + $dir, + '--no-interaction', ]); if (!$process->isSuccessful()) { throw new AcquiaCliException("Unable to create new project."); @@ -224,24 +224,24 @@ private function initializeGitRepository(string $dir): void } $this->localMachineHelper->checkRequiredBinariesExist(['git']); $this->localMachineHelper->execute([ - 'git', - 'init', - '--initial-branch=main', - '--quiet', + 'git', + 'init', + '--initial-branch=main', + '--quiet', ], null, $dir); $this->localMachineHelper->execute([ - 'git', - 'add', - '-A', + 'git', + 'add', + '-A', ], null, $dir); $this->localMachineHelper->execute([ - 'git', - 'commit', - '--message', - "Generated by Acquia CLI's app:new:from:drupal7.", - '--quiet', + 'git', + 'commit', + '--message', + "Generated by Acquia CLI's app:new:from:drupal7.", + '--quiet', ], null, $dir); // @todo Check that this was successful! } diff --git a/src/Command/Auth/AuthAcsfLoginCommand.php b/src/Command/Auth/AuthAcsfLoginCommand.php index 8e424efe2..bedc80732 100644 --- a/src/Command/Auth/AuthAcsfLoginCommand.php +++ b/src/Command/Auth/AuthAcsfLoginCommand.php @@ -33,14 +33,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int $factoryChoices[$url]['url'] = $url; } $factoryChoices['add_new'] = [ - 'url' => 'Enter a new factory URL', + 'url' => 'Enter a new factory URL', ]; $factory = $this->promptChooseFromObjectsOrArrays($factoryChoices, 'url', 'url', 'Choose a Factory to login to'); if ($factory['url'] === 'Enter a new factory URL') { $factoryUrl = $this->io->ask('Enter the full URL of the factory'); $factory = [ - 'url' => $factoryUrl, - 'users' => [], + 'url' => $factoryUrl, + 'users' => [], ]; } else { $factoryUrl = $factory['url']; @@ -48,7 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $users = $factory['users']; $users['add_new'] = [ - 'username' => 'Enter a new user', + 'username' => 'Enter a new user', ]; $selectedUser = $this->promptChooseFromObjectsOrArrays($users, 'username', 'username', 'Choose which user to login as'); if ($selectedUser['username'] !== 'Enter a new user') { @@ -56,7 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $factories[$factoryUrl]['active_user'] = $selectedUser['username']; $this->datastoreCloud->set('acsf_factories', $factories); $output->writeln([ - "Acquia CLI is now logged in to {$factory['url']} as {$selectedUser['username']}", + "Acquia CLI is now logged in to {$factory['url']} as {$selectedUser['username']}", ]); return Command::SUCCESS; } @@ -77,8 +77,8 @@ private function writeAcsfCredentialsToDisk(?string $factoryUrl, string $usernam { $keys = $this->datastoreCloud->get('acsf_factories'); $keys[$factoryUrl]['users'][$username] = [ - 'key' => $key, - 'username' => $username, + 'key' => $key, + 'username' => $username, ]; $keys[$factoryUrl]['url'] = $factoryUrl; $keys[$factoryUrl]['active_user'] = $username; diff --git a/src/Command/Auth/AuthLoginCommand.php b/src/Command/Auth/AuthLoginCommand.php index ba8274741..4645c934d 100644 --- a/src/Command/Auth/AuthLoginCommand.php +++ b/src/Command/Auth/AuthLoginCommand.php @@ -40,8 +40,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $keys[$uuid]['uuid'] = $uuid; } $keys['create_new'] = [ - 'label' => 'Enter a new API key', - 'uuid' => 'create_new', + 'label' => 'Enter a new API key', + 'uuid' => 'create_new', ]; $selectedKey = $this->promptChooseFromObjectsOrArrays($keys, 'uuid', 'label', 'Activate a Cloud Platform API key'); if ($selectedKey['uuid'] !== 'create_new') { @@ -68,9 +68,9 @@ private function writeApiCredentialsToDisk(string $apiKey, string $apiSecret): v $accountInfo = $account->get(); $keys = $this->datastoreCloud->get('keys'); $keys[$apiKey] = [ - 'label' => $accountInfo->mail, - 'secret' => $apiSecret, - 'uuid' => $apiKey, + 'label' => $accountInfo->mail, + 'secret' => $apiSecret, + 'uuid' => $apiKey, ]; $this->datastoreCloud->set('keys', $keys); $this->datastoreCloud->set('acli_key', $apiKey); diff --git a/src/Command/CodeStudio/CodeStudioCiCdVariables.php b/src/Command/CodeStudio/CodeStudioCiCdVariables.php index d6f01d174..c57734a56 100644 --- a/src/Command/CodeStudio/CodeStudioCiCdVariables.php +++ b/src/Command/CodeStudio/CodeStudioCiCdVariables.php @@ -21,48 +21,48 @@ public static function getList(): array public static function getDefaultsForNode(?string $cloudApplicationUuid = null, ?string $cloudKey = null, ?string $cloudSecret = null, ?string $projectAccessTokenName = null, ?string $projectAccessToken = null, ?string $nodeVersion = null): array { return [ - [ - 'key' => 'ACQUIA_APPLICATION_UUID', - 'masked' => true, - 'protected' => false, - 'value' => $cloudApplicationUuid, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_CLOUD_API_TOKEN_KEY', - 'masked' => true, - 'protected' => false, - 'value' => $cloudKey, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_CLOUD_API_TOKEN_SECRET', - 'masked' => true, - 'protected' => false, - 'value' => $cloudSecret, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_GLAB_TOKEN_NAME', - 'masked' => true, - 'protected' => false, - 'value' => $projectAccessTokenName, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_GLAB_TOKEN_SECRET', - 'masked' => true, - 'protected' => false, - 'value' => $projectAccessToken, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'NODE_VERSION', - 'masked' => false, - 'protected' => false, - 'value' => $nodeVersion, - 'variable_type' => 'env_var', - ], + [ + 'key' => 'ACQUIA_APPLICATION_UUID', + 'masked' => true, + 'protected' => false, + 'value' => $cloudApplicationUuid, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_CLOUD_API_TOKEN_KEY', + 'masked' => true, + 'protected' => false, + 'value' => $cloudKey, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_CLOUD_API_TOKEN_SECRET', + 'masked' => true, + 'protected' => false, + 'value' => $cloudSecret, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_GLAB_TOKEN_NAME', + 'masked' => true, + 'protected' => false, + 'value' => $projectAccessTokenName, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_GLAB_TOKEN_SECRET', + 'masked' => true, + 'protected' => false, + 'value' => $projectAccessToken, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'NODE_VERSION', + 'masked' => false, + 'protected' => false, + 'value' => $nodeVersion, + 'variable_type' => 'env_var', + ], ]; } @@ -72,48 +72,48 @@ public static function getDefaultsForNode(?string $cloudApplicationUuid = null, public static function getDefaultsForPhp(?string $cloudApplicationUuid = null, ?string $cloudKey = null, ?string $cloudSecret = null, ?string $projectAccessTokenName = null, ?string $projectAccessToken = null, ?string $phpVersion = null): array { return [ - [ - 'key' => 'ACQUIA_APPLICATION_UUID', - 'masked' => true, - 'protected' => false, - 'value' => $cloudApplicationUuid, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_CLOUD_API_TOKEN_KEY', - 'masked' => true, - 'protected' => false, - 'value' => $cloudKey, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_CLOUD_API_TOKEN_SECRET', - 'masked' => true, - 'protected' => false, - 'value' => $cloudSecret, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_GLAB_TOKEN_NAME', - 'masked' => true, - 'protected' => false, - 'value' => $projectAccessTokenName, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_GLAB_TOKEN_SECRET', - 'masked' => true, - 'protected' => false, - 'value' => $projectAccessToken, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'PHP_VERSION', - 'masked' => false, - 'protected' => false, - 'value' => $phpVersion, - 'variable_type' => 'env_var', - ], + [ + 'key' => 'ACQUIA_APPLICATION_UUID', + 'masked' => true, + 'protected' => false, + 'value' => $cloudApplicationUuid, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_CLOUD_API_TOKEN_KEY', + 'masked' => true, + 'protected' => false, + 'value' => $cloudKey, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_CLOUD_API_TOKEN_SECRET', + 'masked' => true, + 'protected' => false, + 'value' => $cloudSecret, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_GLAB_TOKEN_NAME', + 'masked' => true, + 'protected' => false, + 'value' => $projectAccessTokenName, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_GLAB_TOKEN_SECRET', + 'masked' => true, + 'protected' => false, + 'value' => $projectAccessToken, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'PHP_VERSION', + 'masked' => false, + 'protected' => false, + 'value' => $phpVersion, + 'variable_type' => 'env_var', + ], ]; } } diff --git a/src/Command/CodeStudio/CodeStudioCommandTrait.php b/src/Command/CodeStudio/CodeStudioCommandTrait.php index fb7dfe7d9..44a81691d 100644 --- a/src/Command/CodeStudio/CodeStudioCommandTrait.php +++ b/src/Command/CodeStudio/CodeStudioCommandTrait.php @@ -41,24 +41,24 @@ private function getGitLabToken(string $gitlabHost): string throw new AcquiaCliException("Install glab to continue: https://gitlab.com/gitlab-org/cli#installation"); } $process = $this->localMachineHelper->execute([ - 'glab', - 'config', - 'get', - 'token', - '--host=' . $gitlabHost, + 'glab', + 'config', + 'get', + 'token', + '--host=' . $gitlabHost, ], null, null, false); if ($process->isSuccessful() && trim($process->getOutput())) { return trim($process->getOutput()); } $this->io->writeln([ - "", - "You must first authenticate with Code Studio by creating a personal access token:", - "* Visit https://$gitlabHost/-/profile/personal_access_tokens", - "* Create a token and grant it both api and write repository scopes", - "* Copy the token to your clipboard", - "* Run glab auth login --hostname=$gitlabHost and paste the token when prompted", - "* Try this command again.", + "", + "You must first authenticate with Code Studio by creating a personal access token:", + "* Visit https://$gitlabHost/-/profile/personal_access_tokens", + "* Create a token and grant it both api and write repository scopes", + "* Copy the token to your clipboard", + "* Run glab auth login --hostname=$gitlabHost and paste the token when prompted", + "* Try this command again.", ]); throw new AcquiaCliException("Could not determine GitLab token"); @@ -80,10 +80,10 @@ private function getGitLabHost(): string throw new AcquiaCliException("Install glab to continue: https://gitlab.com/gitlab-org/cli#installation"); } $process = $this->localMachineHelper->execute([ - 'glab', - 'config', - 'get', - 'host', + 'glab', + 'config', + 'get', + 'host', ], null, null, false); if (!$process->isSuccessful()) { throw new AcquiaCliException("Could not determine GitLab host: {error_message}", ['error_message' => $process->getErrorOutput()]); @@ -120,17 +120,17 @@ private function writeApiTokenMessage(InputInterface $input): void if (!$input->getOption('key') || !$input->getOption('secret')) { $tokenUrl = 'https://cloud.acquia.com/a/profile/tokens'; $this->io->writeln([ - "", - "This will configure AutoDevOps for a Code Studio project using credentials", - "(an API Token and SSH Key) belonging to your current Acquia Cloud Platform user account.", - "Before continuing, make sure that you're logged into the right Acquia Cloud Platform user account.", - "", - "Typically this command should only be run once per application", - "but if your Cloud Platform account is deleted in the future, the Code Studio project will", - "need to be re-configured using a different user account.", - "", - "To begin, visit this URL and create a new API Token for Code Studio to use:", - "$tokenUrl", + "", + "This will configure AutoDevOps for a Code Studio project using credentials", + "(an API Token and SSH Key) belonging to your current Acquia Cloud Platform user account.", + "Before continuing, make sure that you're logged into the right Acquia Cloud Platform user account.", + "", + "Typically this command should only be run once per application", + "but if your Cloud Platform account is deleted in the future, the Code Studio project will", + "need to be re-configured using a different user account.", + "", + "To begin, visit this URL and create a new API Token for Code Studio to use:", + "$tokenUrl", ]); } } @@ -152,11 +152,11 @@ private function authenticateWithGitLab(): void $this->gitLabAccount = $this->gitLabClient->users()->me(); } catch (RuntimeException $exception) { $this->io->error([ - "Unable to authenticate with Code Studio", - "Did you set a valid token with the api and write_repository scopes?", - "Try running `glab auth login` to re-authenticate.", - "Alternatively, pass the --gitlab-token option.", - "Then try again.", + "Unable to authenticate with Code Studio", + "Did you set a valid token with the api and write_repository scopes?", + "Try running `glab auth login` to re-authenticate.", + "Alternatively, pass the --gitlab-token option.", + "Then try again.", ]); throw new AcquiaCliException("Unable to authenticate with Code Studio"); } @@ -188,9 +188,9 @@ private function determineGitLabProject(ApplicationResponse $cloudApplication): } // Prompt to create project. $this->io->writeln([ - "", - "Could not find any existing Code Studio project for Acquia Cloud Platform application {$cloudApplication->name}.", - "Searched for UUID {$cloudApplication->uuid} in project descriptions.", + "", + "Could not find any existing Code Studio project for Acquia Cloud Platform application {$cloudApplication->name}.", + "Searched for UUID {$cloudApplication->uuid} in project descriptions.", ]); $createProject = $this->io->confirm('Would you like to create a new Code Studio project? If you select "no" you may choose from a full list of existing projects.'); if ($createProject) { @@ -211,8 +211,8 @@ private function determineGitLabProject(ApplicationResponse $cloudApplication): private function createGitLabProject(ApplicationResponse $cloudApplication): array { $userGroups = $this->gitLabClient->groups()->all([ - 'all_available' => true, - 'min_access_level' => 40, + 'all_available' => true, + 'min_access_level' => 40, ]); $parameters = $this->getGitLabProjectDefaults(); if ($userGroups) { @@ -246,11 +246,11 @@ private function setGitLabProjectDescription(mixed $cloudApplicationUuid): void private function getGitLabProjectDefaults(): array { return [ - 'container_registry_access_level' => 'disabled', - 'default_branch' => 'main', - 'description' => $this->gitLabProjectDescription, - 'initialize_with_readme' => true, - 'topics' => 'Acquia Cloud Application', + 'container_registry_access_level' => 'disabled', + 'default_branch' => 'main', + 'description' => $this->gitLabProjectDescription, + 'initialize_with_readme' => true, + 'topics' => 'Acquia Cloud Application', ]; } diff --git a/src/Command/CodeStudio/CodeStudioPipelinesMigrateCommand.php b/src/Command/CodeStudio/CodeStudioPipelinesMigrateCommand.php index 46994b7c1..1dcf3aed5 100644 --- a/src/Command/CodeStudio/CodeStudioPipelinesMigrateCommand.php +++ b/src/Command/CodeStudio/CodeStudioPipelinesMigrateCommand.php @@ -66,11 +66,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->removeEmptyScript($gitlabCiFileContents); $this->createGitLabCiFile($gitlabCiFileContents, $acquiaPipelinesFileName); $this->io->success([ - "", - "Migration completed successfully.", - "Created .gitlab-ci.yml and removed acquia-pipeline.yml file.", - "In order to run Pipeline, push .gitlab-ci.yaml to Main branch of Code Studio project.", - "Check your pipeline is running in Code Studio for your project.", + "", + "Migration completed successfully.", + "Created .gitlab-ci.yml and removed acquia-pipeline.yml file.", + "In order to run Pipeline, push .gitlab-ci.yaml to Main branch of Code Studio project.", + "Check your pipeline is running in Code Studio for your project.", ]); return Command::SUCCESS; @@ -111,8 +111,8 @@ private function getAcquiaPipelinesFileContents(array $project): array if (file_exists($pipelinesFilepath)) { $fileContents = file_get_contents($pipelinesFilepath); return [ - 'filename' => $pipelinesFilename, - 'file_contents' => Yaml::parse($fileContents, Yaml::PARSE_OBJECT), + 'filename' => $pipelinesFilename, + 'file_contents' => Yaml::parse($fileContents, Yaml::PARSE_OBJECT), ]; } } @@ -129,7 +129,7 @@ private function getAcquiaPipelinesFileContents(array $project): array private function getGitLabCiFileTemplate(): array { return [ - 'include' => ['project' => 'acquia/standard-template', 'file' => '/gitlab-ci/Auto-DevOps.acquia.gitlab-ci.yml'], + 'include' => ['project' => 'acquia/standard-template', 'file' => '/gitlab-ci/Auto-DevOps.acquia.gitlab-ci.yml'], ]; } @@ -144,11 +144,11 @@ private function migrateVariablesSection(mixed $acquiaPipelinesFileContents, mix $variablesParse = Yaml::parse($removeGlobal); $gitlabCiFileContents = array_merge($gitlabCiFileContents, $variablesParse); $this->io->success([ - "Migrated `variables` section of acquia-pipelines.yml to .gitlab-ci.yml", + "Migrated `variables` section of acquia-pipelines.yml to .gitlab-ci.yml", ]); } else { $this->io->info([ - "Checked acquia-pipeline.yml file for `variables` section", + "Checked acquia-pipeline.yml file for `variables` section", ]); } } @@ -171,48 +171,48 @@ private function migrateEventsSection(array $acquiaPipelinesFileContents, array { // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys $eventsMap = [ - 'build' => [ - 'skip' => [ - 'composer install' => [ - 'message' => 'Code Studio AutoDevOps will run `composer install` by default. Skipping migration of this command in your acquia-pipelines.yml file:', - 'prompt' => false, - ], - '${BLT_DIR}' => [ - 'message' => 'Code Studio AutoDevOps will run BLT commands for you by default. Do you want to migrate the following command?', - 'prompt' => true, - ], - ], - 'default_stage' => 'Test Drupal', - 'stage' => [ - 'setup' => 'Build Drupal', - 'npm run build' => 'Build Drupal', - 'validate' => 'Test Drupal', - 'tests' => 'Test Drupal', - 'test' => 'Test Drupal', - 'npm test' => 'Test Drupal', - 'artifact' => 'Deploy Drupal', - 'deploy' => 'Deploy Drupal', - ], - 'needs' => [ - 'Build Code', - 'Manage Secrets', - ], - ], - 'post-deploy' => [ - 'skip' => [ - 'launch_ode' => [ - 'message' => 'Code Studio AutoDevOps will run Launch a new Continuous Delivery Environment (CDE) automatically for new merge requests. Skipping migration of this command in your acquia-pipelines.yml file:', - 'prompt' => false, - ], - ], - 'default_stage' => 'Deploy Drupal', - 'stage' => [ - 'launch_ode' => 'Deploy Drupal', - ], - 'needs' => [ - 'Create artifact from branch', - ], - ], + 'build' => [ + 'skip' => [ + 'composer install' => [ + 'message' => 'Code Studio AutoDevOps will run `composer install` by default. Skipping migration of this command in your acquia-pipelines.yml file:', + 'prompt' => false, + ], + '${BLT_DIR}' => [ + 'message' => 'Code Studio AutoDevOps will run BLT commands for you by default. Do you want to migrate the following command?', + 'prompt' => true, + ], + ], + 'default_stage' => 'Test Drupal', + 'stage' => [ + 'setup' => 'Build Drupal', + 'npm run build' => 'Build Drupal', + 'validate' => 'Test Drupal', + 'tests' => 'Test Drupal', + 'test' => 'Test Drupal', + 'npm test' => 'Test Drupal', + 'artifact' => 'Deploy Drupal', + 'deploy' => 'Deploy Drupal', + ], + 'needs' => [ + 'Build Code', + 'Manage Secrets', + ], + ], + 'post-deploy' => [ + 'skip' => [ + 'launch_ode' => [ + 'message' => 'Code Studio AutoDevOps will run Launch a new Continuous Delivery Environment (CDE) automatically for new merge requests. Skipping migration of this command in your acquia-pipelines.yml file:', + 'prompt' => false, + ], + ], + 'default_stage' => 'Deploy Drupal', + 'stage' => [ + 'launch_ode' => 'Deploy Drupal', + ], + 'needs' => [ + 'Create artifact from branch', + ], + ], ]; // phpcs:enable @@ -241,8 +241,8 @@ private function migrateEventsSection(array $acquiaPipelinesFileContents, array } } else { $this->io->note([ - $messageConfig['message'], - $command, + $messageConfig['message'], + $command, ]); } break; @@ -272,11 +272,11 @@ private function migrateEventsSection(array $acquiaPipelinesFileContents, array } $gitlabCiFileContents = array_merge($gitlabCiFileContents, $codeStudioJobs); $this->io->success([ - "Completed migration of the $eventName step in your acquia-pipelines.yml file", + "Completed migration of the $eventName step in your acquia-pipelines.yml file", ]); } else { $this->io->writeln([ - "acquia-pipeline.yml file does not contain $eventName step to migrate", + "acquia-pipeline.yml file does not contain $eventName step to migrate", ]); } } diff --git a/src/Command/CodeStudio/CodeStudioWizardCommand.php b/src/Command/CodeStudio/CodeStudioWizardCommand.php index 1e1c4ded8..500d7225b 100644 --- a/src/Command/CodeStudio/CodeStudioWizardCommand.php +++ b/src/Command/CodeStudio/CodeStudioWizardCommand.php @@ -52,9 +52,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int switch ($projectSelected) { case "Drupal_project": $phpVersions = [ - 'PHP_version_8.1' => "8.1", - 'PHP_version_8.2' => "8.2", - 'PHP_version_8.3' => "8.3", + 'PHP_version_8.1' => "8.1", + 'PHP_version_8.2' => "8.2", + 'PHP_version_8.3' => "8.3", ]; $project = $this->io->choice('Select a PHP version', array_values($phpVersions), "8.1"); $project = array_search($project, $phpVersions, true); @@ -62,8 +62,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int break; case "Node_project": $nodeVersions = [ - 'NODE_version_18.17.1' => "18.17.1", - 'NODE_version_20.5.1' => "20.5.1", + 'NODE_version_18.17.1' => "18.17.1", + 'NODE_version_20.5.1' => "20.5.1", ]; $project = $this->io->choice('Select a NODE version', array_values($nodeVersions), "18.17.1"); $project = array_search($project, $nodeVersions, true); @@ -82,17 +82,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int $appUuid, $account, [ - "deploy to non-prod", + "deploy to non-prod", // Add SSH key to git repository. - "add ssh key to git", + "add ssh key to git", // Add SSH key to non-production environments. - "add ssh key to non-prod", + "add ssh key to non-prod", // Add a CD environment. - "add an environment", + "add an environment", // Delete a CD environment. - "delete an environment", + "delete an environment", // Manage environment variables on a non-production environment. - "administer environment variables on non-prod", + "administer environment variables on non-prod", ] ); $this->setGitLabProjectDescription($appUuid); @@ -102,12 +102,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $project = $this->determineGitLabProject($cloudApplication); $this->io->writeln([ - "", - "This command will configure the Code Studio project {$project['path_with_namespace']} for automatic deployment to the", - "Acquia Cloud Platform application {$cloudApplication->name} ($appUuid)", - "using credentials (API Token and SSH Key) belonging to {$account->mail}.", - "", - "If the {$account->mail} Cloud account is deleted in the future, this Code Studio project will need to be re-configured.", + "", + "This command will configure the Code Studio project {$project['path_with_namespace']} for automatic deployment to the", + "Acquia Cloud Platform application {$cloudApplication->name} ($appUuid)", + "using credentials (API Token and SSH Key) belonging to {$account->mail}.", + "", + "If the {$account->mail} Cloud account is deleted in the future, this Code Studio project will need to be re-configured.", ]); $answer = $this->io->confirm('Do you want to continue?'); if (!$answer) { @@ -124,7 +124,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int break; case "Node_project": $parameters = [ - 'ci_config_path' => 'gitlab-ci/Auto-DevOps.acquia.gitlab-ci.yml@acquia/node-template', + 'ci_config_path' => 'gitlab-ci/Auto-DevOps.acquia.gitlab-ci.yml@acquia/node-template', ]; $client = $this->getGitLabClient(); $client->projects()->update($project['id'], $parameters); @@ -133,14 +133,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $this->io->success([ - "Successfully configured the Code Studio project!", - "This project will now use Acquia's Drupal optimized AutoDevOps to build, test, and deploy your code automatically to Acquia Cloud Platform via CI/CD pipelines.", - "You can visit it here:", - $project['web_url'], - "", - "Next, you should use git to push code to your Code Studio project. E.g.,", - " git remote add codestudio {$project['http_url_to_repo']}", - " git push codestudio", + "Successfully configured the Code Studio project!", + "This project will now use Acquia's Drupal optimized AutoDevOps to build, test, and deploy your code automatically to Acquia Cloud Platform via CI/CD pipelines.", + "You can visit it here:", + $project['web_url'], + "", + "Next, you should use git to push code to your Code Studio project. E.g.,", + " git remote add codestudio {$project['http_url_to_repo']}", + " git push codestudio", ]); $this->io->note(["If the {$account->mail} Cloud account is deleted in the future, this Code Studio project will need to be re-configured."]); @@ -181,8 +181,8 @@ private function getGitLabProjectAccessTokenByName(array $project, string $name) private function getListOfProjectType(): ?array { $array = [ - 'Drupal_project', - 'Node_project', + 'Drupal_project', + 'Node_project', ]; return $array; } @@ -200,10 +200,10 @@ private function createProjectAccessToken(array $project, string $projectAccessT $this->checklist->addItem("Creating access token named $projectAccessTokenName"); $projectAccessToken = $this->gitLabClient->projects() ->createProjectAccessToken($project['id'], [ - 'expires_at' => new DateTime('+365 days'), - 'name' => $projectAccessTokenName, - 'scopes' => ['api', 'write_repository'], - ]); + 'expires_at' => new DateTime('+365 days'), + 'name' => $projectAccessTokenName, + 'scopes' => ['api', 'write_repository'], + ]); $this->checklist->completePreviousItem(); return $projectAccessToken['token']; } @@ -267,17 +267,17 @@ private function createScheduledPipeline(array $project): void $this->checklist->addItem("Creating scheduled pipeline $scheduledPipelineDescription"); $pipeline = $this->gitLabClient->schedules()->create($project['id'], [ // Every Thursday at midnight. - 'cron' => '0 0 * * 4', - 'description' => $scheduledPipelineDescription, - 'ref' => $project['default_branch'], + 'cron' => '0 0 * * 4', + 'description' => $scheduledPipelineDescription, + 'ref' => $project['default_branch'], ]); $this->gitLabClient->schedules()->addVariable($project['id'], $pipeline['id'], [ - 'key' => 'ACQUIA_JOBS_DEPRECATED_UPDATE', - 'value' => 'true', + 'key' => 'ACQUIA_JOBS_DEPRECATED_UPDATE', + 'value' => 'true', ]); $this->gitLabClient->schedules()->addVariable($project['id'], $pipeline['id'], [ - 'key' => 'ACQUIA_JOBS_COMPOSER_UPDATE', - 'value' => 'true', + 'key' => 'ACQUIA_JOBS_COMPOSER_UPDATE', + 'value' => 'true', ]); } else { $this->checklist->addItem("Scheduled pipeline named $scheduledPipelineDescription already exists"); diff --git a/src/Command/CommandBase.php b/src/Command/CommandBase.php index 51b7b219d..0231b8746 100644 --- a/src/Command/CommandBase.php +++ b/src/Command/CommandBase.php @@ -134,8 +134,8 @@ public function appendHelp(string $helpText): void protected static function getUuidRegexConstraint(): Regex { return new Regex([ - 'message' => 'This is not a valid UUID.', - 'pattern' => '/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i', + 'message' => 'This is not a valid UUID.', + 'pattern' => '/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i', ]); } @@ -266,13 +266,13 @@ public function run(InputInterface $input, OutputInterface $output): int return $exitCode; } $eventProperties = [ - 'app_version' => $this->getApplication()->getVersion(), - 'arguments' => $input->getArguments(), - 'exit_code' => $exitCode, - 'options' => $input->getOptions(), - 'os_name' => OsInfo::os(), - 'os_version' => OsInfo::version(), - 'platform' => OsInfo::family(), + 'app_version' => $this->getApplication()->getVersion(), + 'arguments' => $input->getArguments(), + 'exit_code' => $exitCode, + 'options' => $input->getOptions(), + 'os_name' => OsInfo::os(), + 'os_version' => OsInfo::version(), + 'platform' => OsInfo::family(), ]; Amplitude::getInstance()->queueEvent('Ran command', $eventProperties); @@ -392,8 +392,8 @@ protected function promptChooseLogs(): object|array|null { $logs = array_map(static function (mixed $logType, mixed $logLabel): array { return [ - 'label' => $logLabel, - 'type' => $logType, + 'label' => $logLabel, + 'type' => $logType, ]; }, array_keys(LogstreamManager::AVAILABLE_TYPES), LogstreamManager::AVAILABLE_TYPES); return $this->promptChooseFromObjectsOrArrays( @@ -473,17 +473,17 @@ protected function rsyncFiles(string $sourceDir, string $destinationDir, ?callab { $this->localMachineHelper->checkRequiredBinariesExist(['rsync']); $command = [ - 'rsync', + 'rsync', // -a archive mode; same as -rlptgoD. // -z compress file data during the transfer. // -v increase verbosity. // -P show progress during transfer. // -h output numbers in a human-readable format. // -e specify the remote shell to use. - '-avPhze', - 'ssh -o StrictHostKeyChecking=no', - $sourceDir . '/', - $destinationDir, + '-avPhze', + 'ssh -o StrictHostKeyChecking=no', + $sourceDir . '/', + $destinationDir, ]; $process = $this->localMachineHelper->execute($command, $outputCallback, null, ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL)); if (!$process->isSuccessful()) { @@ -656,9 +656,9 @@ protected function getLocalGitCommitHash(): string { $this->localMachineHelper->checkRequiredBinariesExist(['git']); $process = $this->localMachineHelper->execute([ - 'git', - 'rev-parse', - 'HEAD', + 'git', + 'rev-parse', + 'HEAD', ], null, $this->dir, false); if (!$process->isSuccessful()) { @@ -941,10 +941,10 @@ protected function getCloudApplicationUuidFromBltYaml(): ?string public static function validateUuid(string $uuid): string { $violations = Validation::createValidator()->validate($uuid, [ - new Length([ - 'value' => 36, - ]), - self::getUuidRegexConstraint(), + new Length([ + 'value' => 36, + ]), + self::getUuidRegexConstraint(), ]); if (count($violations)) { throw new ValidatorException($violations->get(0)->getMessage()); @@ -1039,9 +1039,9 @@ protected function getCloudEnvironment(string $environmentId): EnvironmentRespon public static function validateEnvironmentAlias(string $alias): string { $violations = Validation::createValidator()->validate($alias, [ - new Length(['min' => 5]), - new NotBlank(), - new Regex(['pattern' => '/.+\..+/', 'message' => 'You must enter either an environment ID or alias. Environment aliases must match the pattern [app-name].[env]']), + new Length(['min' => 5]), + new NotBlank(), + new Regex(['pattern' => '/.+\..+/', 'message' => 'You must enter either an environment ID or alias. Environment aliases must match the pattern [app-name].[env]']), ]); if (count($violations)) { throw new ValidatorException($violations->get(0)->getMessage()); @@ -1488,8 +1488,8 @@ protected function reAuthenticate(string $apiKey, string $apiSecret, ?string $ba // this is being run as a sub-command. // @see https://github.com/acquia/cli/issues/403 $this->cloudApiClientService->setConnector(new Connector([ - 'key' => $apiKey, - 'secret' => $apiSecret, + 'key' => $apiKey, + 'secret' => $apiSecret, ], $baseUri, $accountsUri)); } @@ -1563,11 +1563,11 @@ protected function runDrushCacheClear(Closure $outputCallback, Checklist $checkl $checklist->addItem('Clearing Drupal caches via Drush'); // @todo Add support for Drush 8. $process = $this->localMachineHelper->execute([ - 'drush', - 'cache:rebuild', - '--yes', - '--no-interaction', - '--verbose', + 'drush', + 'cache:rebuild', + '--yes', + '--no-interaction', + '--verbose', ], $outputCallback, $this->dir, false); if (!$process->isSuccessful()) { throw new AcquiaCliException('Unable to rebuild Drupal caches via Drush. {message}', ['message' => $process->getErrorOutput()]); @@ -1583,11 +1583,11 @@ protected function runDrushSqlSanitize(Closure $outputCallback, Checklist $check if ($this->getDrushDatabaseConnectionStatus()) { $checklist->addItem('Sanitizing database via Drush'); $process = $this->localMachineHelper->execute([ - 'drush', - 'sql:sanitize', - '--yes', - '--no-interaction', - '--verbose', + 'drush', + 'sql:sanitize', + '--yes', + '--no-interaction', + '--verbose', ], $outputCallback, $this->dir, false); if (!$process->isSuccessful()) { throw new AcquiaCliException('Unable to sanitize Drupal database via Drush. {message}', ['message' => $process->getErrorOutput()]); @@ -1603,9 +1603,9 @@ protected function runDrushSqlSanitize(Closure $outputCallback, Checklist $check private function composerInstall(?callable $outputCallback): void { $process = $this->localMachineHelper->execute([ - 'composer', - 'install', - '--no-interaction', + 'composer', + 'install', + '--no-interaction', ], $outputCallback, $this->dir, false); if (!$process->isSuccessful()) { throw new AcquiaCliException( @@ -1622,11 +1622,11 @@ protected function getDrushDatabaseConnectionStatus(Closure $outputCallback = nu } if ($this->localMachineHelper->commandExists('drush')) { $process = $this->localMachineHelper->execute([ - 'drush', - 'status', - '--fields=db-status,drush-version', - '--format=json', - '--no-interaction', + 'drush', + 'status', + '--fields=db-status,drush-version', + '--format=json', + '--no-interaction', ], $outputCallback, $this->dir, false); if ($process->isSuccessful()) { $drushStatusReturnOutput = json_decode($process->getOutput(), true); @@ -1690,9 +1690,9 @@ protected function determineApiKey(): string private function validateApiKey(mixed $key): string { $violations = Validation::createValidator()->validate($key, [ - new Length(['min' => 10]), - new NotBlank(), - new Regex(['pattern' => '/^\S*$/', 'message' => 'The value may not contain spaces']), + new Length(['min' => 10]), + new NotBlank(), + new Regex(['pattern' => '/^\S*$/', 'message' => 'The value may not contain spaces']), ]); if (count($violations)) { throw new ValidatorException($violations->get(0)->getMessage()); @@ -1925,8 +1925,8 @@ protected function validateRequiredCloudPermissions(Client $acquiaCloudClient, ? foreach ($requiredPermissions as $name) { if (!array_key_exists($name, $keyedPermissions)) { throw new AcquiaCliException("The Acquia Cloud Platform account {account} does not have the required '{name}' permission. Add the permissions to this user or use an API Token belonging to a different Acquia Cloud Platform user.", [ - 'account' => $account->mail, - 'name' => $name, + 'account' => $account->mail, + 'name' => $name, ]); } } @@ -1935,10 +1935,10 @@ protected function validateRequiredCloudPermissions(Client $acquiaCloudClient, ? protected function validatePhpVersion(string $version): string { $violations = Validation::createValidator()->validate($version, [ - new Length(['min' => 3]), - new NotBlank(), - new Regex(['pattern' => '/^\S*$/', 'message' => 'The value may not contain spaces']), - new Regex(['pattern' => '/[0-9]{1}\.[0-9]{1}/', 'message' => 'The value must be in the format "x.y"']), + new Length(['min' => 3]), + new NotBlank(), + new Regex(['pattern' => '/^\S*$/', 'message' => 'The value may not contain spaces']), + new Regex(['pattern' => '/[0-9]{1}\.[0-9]{1}/', 'message' => 'The value must be in the format "x.y"']), ]); if (count($violations)) { throw new ValidatorException($violations->get(0)->getMessage()); diff --git a/src/Command/DocsCommand.php b/src/Command/DocsCommand.php index 4512bafac..d4167c4da 100644 --- a/src/Command/DocsCommand.php +++ b/src/Command/DocsCommand.php @@ -24,78 +24,78 @@ protected function configure(): void protected function execute(InputInterface $input, OutputInterface $output): int { $acquiaProducts = [ - 'Acquia CLI' => [ - 'alias' => ['cli', 'acli'], - 'url' => 'acquia-cli', - ], - 'Acquia CMS' => [ - 'alias' => ['acquia_cms', 'acms'], - 'url' => 'acquia-cms', - ], - 'Acquia DAM Classic' => [ - 'alias' => ['dam', 'acquia_dam', 'dam_classic', 'acquiadam', 'damclassic'], - 'url' => 'dam', - ], - 'Acquia Migrate Accelerate' => [ - 'alias' => ['acquia-migrate-accelerate', 'ama'], - 'url' => 'acquia-migrate-accelerate', - ], - 'BLT' => [ - 'alias' => ['blt'], - 'url' => 'blt', - ], - 'Campaign Factory' => [ - 'alias' => ['campaign-factory', 'campaign_factory', 'campaignfactory'], - 'url' => 'campaign-factory', - ], - 'Campaign Studio' => [ - 'alias' => ['campaign-studio', 'campaignstudio'], - 'url' => 'campaign-studio', - ], - 'Cloud IDE' => [ - 'alias' => ['ide', 'cloud_ide', 'cloud-ide'], - 'url' => 'ide', - ], - 'Cloud Platform' => [ - 'alias' => ['cloud-platform', 'acquiacloud', 'acquia_cloud', 'acquia-cloud', 'cloud'], - 'url' => 'cloud-platform', - ], - 'Code Studio' => [ - 'alias' => ['code_studio', 'codestudio', 'cs'], - 'url' => 'code-studio', - ], - 'Content Hub' => [ - 'alias' => ['contenthub', 'ch'], - 'url' => 'contenthub', - ], - 'Customer Data Platform' => [ - 'alias' => ['customer-data-platform', 'cdp'], - 'url' => 'customer-data-platform', - ], - 'Edge' => [ - 'alias' => ['edge', 'cloudedge'], - 'url' => 'edge', - ], - 'Personalization' => [ - 'alias' => ['personalization'], - 'url' => 'personalization', - ], - 'Search' => [ - 'alias' => ['search', 'acquia-search'], - 'url' => 'acquia-search', - ], - 'Shield' => [ - 'alias' => ['shield'], - 'url' => 'shield', - ], - 'Site Factory' => [ - 'alias' => ['site-factory', 'acsf'], - 'url' => 'site-factory', - ], - 'Site Studio' => [ - 'alias' => ['site-studio', 'cohesion'], - 'url' => 'site-studio', - ], + 'Acquia CLI' => [ + 'alias' => ['cli', 'acli'], + 'url' => 'acquia-cli', + ], + 'Acquia CMS' => [ + 'alias' => ['acquia_cms', 'acms'], + 'url' => 'acquia-cms', + ], + 'Acquia DAM Classic' => [ + 'alias' => ['dam', 'acquia_dam', 'dam_classic', 'acquiadam', 'damclassic'], + 'url' => 'dam', + ], + 'Acquia Migrate Accelerate' => [ + 'alias' => ['acquia-migrate-accelerate', 'ama'], + 'url' => 'acquia-migrate-accelerate', + ], + 'BLT' => [ + 'alias' => ['blt'], + 'url' => 'blt', + ], + 'Campaign Factory' => [ + 'alias' => ['campaign-factory', 'campaign_factory', 'campaignfactory'], + 'url' => 'campaign-factory', + ], + 'Campaign Studio' => [ + 'alias' => ['campaign-studio', 'campaignstudio'], + 'url' => 'campaign-studio', + ], + 'Cloud IDE' => [ + 'alias' => ['ide', 'cloud_ide', 'cloud-ide'], + 'url' => 'ide', + ], + 'Cloud Platform' => [ + 'alias' => ['cloud-platform', 'acquiacloud', 'acquia_cloud', 'acquia-cloud', 'cloud'], + 'url' => 'cloud-platform', + ], + 'Code Studio' => [ + 'alias' => ['code_studio', 'codestudio', 'cs'], + 'url' => 'code-studio', + ], + 'Content Hub' => [ + 'alias' => ['contenthub', 'ch'], + 'url' => 'contenthub', + ], + 'Customer Data Platform' => [ + 'alias' => ['customer-data-platform', 'cdp'], + 'url' => 'customer-data-platform', + ], + 'Edge' => [ + 'alias' => ['edge', 'cloudedge'], + 'url' => 'edge', + ], + 'Personalization' => [ + 'alias' => ['personalization'], + 'url' => 'personalization', + ], + 'Search' => [ + 'alias' => ['search', 'acquia-search'], + 'url' => 'acquia-search', + ], + 'Shield' => [ + 'alias' => ['shield'], + 'url' => 'shield', + ], + 'Site Factory' => [ + 'alias' => ['site-factory', 'acsf'], + 'url' => 'site-factory', + ], + 'Site Studio' => [ + 'alias' => ['site-studio', 'cohesion'], + 'url' => 'site-studio', + ], ]; // If user has provided any acquia product in command. diff --git a/src/Command/Email/ConfigurePlatformEmailCommand.php b/src/Command/Email/ConfigurePlatformEmailCommand.php index 7f7a7e44e..368c60707 100644 --- a/src/Command/Email/ConfigurePlatformEmailCommand.php +++ b/src/Command/Email/ConfigurePlatformEmailCommand.php @@ -55,18 +55,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int $client = $this->cloudApiClientService->getClient(); $subscription = $this->determineCloudSubscription(); $client->request('post', "/subscriptions/$subscription->uuid/domains", [ - 'form_params' => [ - 'domain' => $baseDomain, - ], + 'form_params' => [ + 'domain' => $baseDomain, + ], ]); $domainUuid = $this->fetchDomainUuid($client, $subscription, $baseDomain); $this->io->success([ - "Great! You've registered the domain $baseDomain to subscription $subscription->name.", - "We will create a file with the DNS records for your newly registered domain", - "Provide these records to your DNS provider", - "After you've done this, continue to domain verification.", + "Great! You've registered the domain $baseDomain to subscription $subscription->name.", + "We will create a file with the DNS records for your newly registered domain", + "Provide these records to your DNS provider", + "After you've done this, continue to domain verification.", ]); $fileFormat = $this->io->choice('Would you like your DNS records in BIND Zone File, JSON, or YAML format?', ['BIND Zone File', 'YAML', 'JSON'], 'BIND Zone File'); $this->createDnsText($client, $subscription, $baseDomain, $domainUuid, $fileFormat); @@ -330,8 +330,8 @@ private function checkIfDomainVerified( private function determineDomain(): string { $domain = $this->io->ask("What's the domain name you'd like to register?", '', Closure::fromCallable([ - $this, - 'validateUrl', + $this, + 'validateUrl', ])); $domainParts = parse_url($domain); diff --git a/src/Command/Email/EmailInfoForSubscriptionCommand.php b/src/Command/Email/EmailInfoForSubscriptionCommand.php index f4b6fcd3e..9f01e51c6 100644 --- a/src/Command/Email/EmailInfoForSubscriptionCommand.php +++ b/src/Command/Email/EmailInfoForSubscriptionCommand.php @@ -110,37 +110,37 @@ private function writeDomainsToTables(OutputInterface $output, SubscriptionRespo } $allDomainsTable->addRow([ - $domain->domain_name, - $domain->uuid, - $this->showHumanReadableStatus($domain->health->code) . ' - ' . $domain->health->code, + $domain->domain_name, + $domain->uuid, + $this->showHumanReadableStatus($domain->health->code) . ' - ' . $domain->health->code, ]); $writerAllDomains->insertOne([ - $domain->domain_name, - $domain->uuid, - $this->showHumanReadableStatus($domain->health->code) . ' - ' . $domain->health->code, + $domain->domain_name, + $domain->uuid, + $this->showHumanReadableStatus($domain->health->code) . ' - ' . $domain->health->code, ]); foreach ($domain->dns_records as $index => $record) { if ($index === 0) { $writerAllDomainsDnsHealth->insertOne([ - $domain->domain_name, - $domain->uuid, - $this->showHumanReadableStatus($domain->health->code) . ' - ' . $domain->health->code, - $record->name, - $record->type, - $record->value, - $record->health->details, + $domain->domain_name, + $domain->uuid, + $this->showHumanReadableStatus($domain->health->code) . ' - ' . $domain->health->code, + $record->name, + $record->type, + $record->value, + $record->health->details, ]); } else { $writerAllDomainsDnsHealth->insertOne([ - '', - '', - '', - $record->name, - $record->type, - $record->value, - $record->health->details, + '', + '', + '', + $record->name, + $record->type, + $record->value, + $record->health->details, ]); } } @@ -204,17 +204,17 @@ private function renderApplicationAssociations(OutputInterface $output, Client $ if (count($appDomains)) { foreach ($appDomains as $domain) { $appsDomainsTable->addRow([ - $domain->domain_name, - var_export($domain->flags->associated, true), + $domain->domain_name, + var_export($domain->flags->associated, true), ]); $writerAppsDomains->insertOne([$app->name, $domain->domain_name, var_export($domain->flags->associated, true)]); } } else { $appsDomainsTable->addRow([new TableCell("No domains eligible for association.", [ - 'colspan' => 2, - 'style' => new TableCellStyle([ - 'fg' => 'yellow', - ]), + 'colspan' => 2, + 'style' => new TableCellStyle([ + 'fg' => 'yellow', + ]), ]), ]); $writerAppsDomains->insertOne([$app->name, 'No domains eligible for association', '']); diff --git a/src/Command/Env/EnvCopyCronCommand.php b/src/Command/Env/EnvCopyCronCommand.php index d6b6923a8..4c000d85b 100644 --- a/src/Command/Env/EnvCopyCronCommand.php +++ b/src/Command/Env/EnvCopyCronCommand.php @@ -73,11 +73,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int // when environment is provisioned. if (!$cron->flags->system) { $cronFrequency = implode(' ', [ - $cron->minute, - $cron->hour, - $cron->dayMonth, - $cron->month, - $cron->dayWeek, + $cron->minute, + $cron->hour, + $cron->dayMonth, + $cron->month, + $cron->dayWeek, ]); $this->io->info('Copying the cron task "' . $cron->label . '" from ' . $sourceEnvId . ' to ' . $destEnvId); @@ -93,10 +93,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->io->error('There was some error while copying the cron task "' . $cron->label . '"'); // Log the error for debugging purpose. $this->logger->debug('Error @error while copying the cron task @cron from @source env to @dest env', [ - '@cron' => $cron->label, - '@dest' => $destEnvId, - '@error' => $e->getMessage(), - '@source' => $sourceEnvId, + '@cron' => $cron->label, + '@dest' => $destEnvId, + '@error' => $e->getMessage(), + '@source' => $sourceEnvId, ]); return 1; } diff --git a/src/Command/Env/EnvCreateCommand.php b/src/Command/Env/EnvCreateCommand.php index 3eb49463c..19cf133a6 100644 --- a/src/Command/Env/EnvCreateCommand.php +++ b/src/Command/Env/EnvCreateCommand.php @@ -57,8 +57,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if (isset($environment)) { $this->output->writeln([ - '', - "Your CDE URL: domains[0]}>{$environment->domains[0]}", + '', + "Your CDE URL: domains[0]}>{$environment->domains[0]}", ]); } }; diff --git a/src/Command/Env/EnvDeleteCommand.php b/src/Command/Env/EnvDeleteCommand.php index 25719c9c1..e4c8488f9 100644 --- a/src/Command/Env/EnvDeleteCommand.php +++ b/src/Command/Env/EnvDeleteCommand.php @@ -33,7 +33,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $environmentsResource->delete($environment->uuid); $this->io->success([ - "The {$environment->label} environment is being deleted", + "The {$environment->label} environment is being deleted", ]); return Command::SUCCESS; diff --git a/src/Command/Env/EnvMirrorCommand.php b/src/Command/Env/EnvMirrorCommand.php index e3860ff7e..12592a767 100644 --- a/src/Command/Env/EnvMirrorCommand.php +++ b/src/Command/Env/EnvMirrorCommand.php @@ -92,9 +92,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $this->io->success([ - "Done! {$destinationEnvironment->label} now matches {$sourceEnvironment->label}", - "You can visit it here:", - "https://" . $destinationEnvironment->domains[0], + "Done! {$destinationEnvironment->label} now matches {$sourceEnvironment->label}", + "You can visit it here:", + "https://" . $destinationEnvironment->domains[0], ]); return Command::SUCCESS; @@ -130,9 +130,9 @@ private function mirrorCode(Client $acquiaCloudClient, mixed $destinationEnviron $this->checklist->addItem("Initiating code switch"); $outputCallback('out', "Switching to {$sourceEnvironment->vcs->path}"); $codeCopyResponse = $acquiaCloudClient->request('post', "/environments/$destinationEnvironmentUuid/code/actions/switch", [ - 'form_params' => [ - 'branch' => $sourceEnvironment->vcs->path, - ], + 'form_params' => [ + 'branch' => $sourceEnvironment->vcs->path, + ], ]); $codeCopyResponse->links = $codeCopyResponse->_links; $this->checklist->completePreviousItem(); diff --git a/src/Command/Ide/IdeCommandBase.php b/src/Command/Ide/IdeCommandBase.php index f3204ccc3..fbeab7c18 100644 --- a/src/Command/Ide/IdeCommandBase.php +++ b/src/Command/Ide/IdeCommandBase.php @@ -42,9 +42,9 @@ protected function promptIdeChoice( protected function startService(string $service): void { $process = $this->localMachineHelper->execute([ - 'supervisorctl', - 'start', - $service, + 'supervisorctl', + 'start', + $service, ], null, null, false); if (!$process->isSuccessful()) { throw new AcquiaCliException('Unable to start ' . $service . ' in the IDE: {error}', ['error' => $process->getErrorOutput()]); @@ -57,9 +57,9 @@ protected function startService(string $service): void protected function stopService(string $service): void { $process = $this->localMachineHelper->execute([ - 'supervisorctl', - 'stop', - $service, + 'supervisorctl', + 'stop', + $service, ], null, null, false); if (!$process->isSuccessful()) { throw new AcquiaCliException('Unable to stop ' . $service . ' in the IDE: {error}', ['error' => $process->getErrorOutput()]); @@ -72,9 +72,9 @@ protected function stopService(string $service): void protected function restartService(string $service): void { $process = $this->localMachineHelper->execute([ - 'supervisorctl', - 'restart', - $service, + 'supervisorctl', + 'restart', + $service, ], null, null, false); if (!$process->isSuccessful()) { throw new AcquiaCliException('Unable to restart ' . $service . ' in the IDE: {error}', ['error' => $process->getErrorOutput()]); diff --git a/src/Command/Ide/IdeCreateCommand.php b/src/Command/Ide/IdeCreateCommand.php index 2c106e5cd..f62933d6b 100644 --- a/src/Command/Ide/IdeCreateCommand.php +++ b/src/Command/Ide/IdeCreateCommand.php @@ -93,7 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int public function validateIdeLabel(string $label): string { $violations = Validation::createValidator()->validate($label, [ - new Regex(['pattern' => '/^[\w\' ]+$/', 'message' => 'Use only letters, numbers, and spaces']), + new Regex(['pattern' => '/^[\w\' ]+$/', 'message' => 'Use only letters, numbers, and spaces']), ]); if (count($violations)) { throw new ValidatorException($violations->get(0)->getMessage()); diff --git a/src/Command/Ide/IdeListCommand.php b/src/Command/Ide/IdeListCommand.php index dfa5e9bac..37bd43a86 100644 --- a/src/Command/Ide/IdeListCommand.php +++ b/src/Command/Ide/IdeListCommand.php @@ -36,10 +36,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int $table->setHeaders(['IDEs']); foreach ($applicationIdes as $ide) { $table->addRows([ - ["{$ide->label} ({$ide->owner->mail})"], - ["IDE URL: links->ide->href}>{$ide->links->ide->href}"], - ["Web URL: links->web->href}>{$ide->links->web->href}"], - new TableSeparator(), + ["{$ide->label} ({$ide->owner->mail})"], + ["IDE URL: links->ide->href}>{$ide->links->ide->href}"], + ["Web URL: links->web->href}>{$ide->links->web->href}"], + new TableSeparator(), ]); } $table->render(); diff --git a/src/Command/Ide/IdeListMineCommand.php b/src/Command/Ide/IdeListMineCommand.php index cb7fb3f87..a5a1325f3 100644 --- a/src/Command/Ide/IdeListMineCommand.php +++ b/src/Command/Ide/IdeListMineCommand.php @@ -36,13 +36,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int $applicationUrl = str_replace('/api', '/a', $application->links->self->href); $table->addRows([ - ["$ide->label"], - ["UUID: $ide->uuid"], - ["Application: $application->name"], - ["Subscription: {$application->subscription->name}"], - ["IDE URL: links->ide->href}>{$ide->links->ide->href}"], - ["Web URL: links->web->href}>{$ide->links->web->href}"], - new TableSeparator(), + ["$ide->label"], + ["UUID: $ide->uuid"], + ["Application: $application->name"], + ["Subscription: {$application->subscription->name}"], + ["IDE URL: links->ide->href}>{$ide->links->ide->href}"], + ["Web URL: links->web->href}>{$ide->links->web->href}"], + new TableSeparator(), ]); } $table->render(); diff --git a/src/Command/Ide/IdeServiceRestartCommand.php b/src/Command/Ide/IdeServiceRestartCommand.php index c6a0eee34..58e5dee2d 100644 --- a/src/Command/Ide/IdeServiceRestartCommand.php +++ b/src/Command/Ide/IdeServiceRestartCommand.php @@ -34,12 +34,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->validateService($service); $serviceNameMap = [ - 'apache' => 'apache2', - 'apache2' => 'apache2', - 'mysql' => 'mysqld', - 'mysqld' => 'mysqld', - 'php' => 'php-fpm', - 'php-fpm' => 'php-fpm', + 'apache' => 'apache2', + 'apache2' => 'apache2', + 'mysql' => 'mysqld', + 'mysqld' => 'mysqld', + 'php' => 'php-fpm', + 'php-fpm' => 'php-fpm', ]; $output->writeln("Restarting $service..."); $serviceName = $serviceNameMap[$service]; @@ -52,10 +52,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int private function validateService(string $service): void { $violations = Validation::createValidator()->validate($service, [ - new Choice([ - 'choices' => ['php', 'php-fpm', 'apache', 'apache2', 'mysql', 'mysqld'], - 'message' => 'Specify a valid service name: php, apache, or mysql', - ]), + new Choice([ + 'choices' => ['php', 'php-fpm', 'apache', 'apache2', 'mysql', 'mysqld'], + 'message' => 'Specify a valid service name: php, apache, or mysql', + ]), ]); if (count($violations)) { throw new ValidatorException($violations->get(0)->getMessage()); diff --git a/src/Command/Ide/IdeServiceStartCommand.php b/src/Command/Ide/IdeServiceStartCommand.php index 71a5e19b0..0e1e4bf4e 100644 --- a/src/Command/Ide/IdeServiceStartCommand.php +++ b/src/Command/Ide/IdeServiceStartCommand.php @@ -34,12 +34,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->validateService($service); $serviceNameMap = [ - 'apache' => 'apache2', - 'apache2' => 'apache2', - 'mysql' => 'mysqld', - 'mysqld' => 'mysqld', - 'php' => 'php-fpm', - 'php-fpm' => 'php-fpm', + 'apache' => 'apache2', + 'apache2' => 'apache2', + 'mysql' => 'mysqld', + 'mysqld' => 'mysqld', + 'php' => 'php-fpm', + 'php-fpm' => 'php-fpm', ]; $output->writeln("Starting $service..."); $serviceName = $serviceNameMap[$service]; @@ -52,10 +52,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int private function validateService(string $service): void { $violations = Validation::createValidator()->validate($service, [ - new Choice([ - 'choices' => ['php', 'php-fpm', 'apache', 'apache2', 'mysql', 'mysqld'], - 'message' => 'Specify a valid service name: php, apache, or mysql', - ]), + new Choice([ + 'choices' => ['php', 'php-fpm', 'apache', 'apache2', 'mysql', 'mysqld'], + 'message' => 'Specify a valid service name: php, apache, or mysql', + ]), ]); if (count($violations)) { throw new ValidatorException($violations->get(0)->getMessage()); diff --git a/src/Command/Ide/IdeServiceStopCommand.php b/src/Command/Ide/IdeServiceStopCommand.php index 039015a1d..ae93ff415 100644 --- a/src/Command/Ide/IdeServiceStopCommand.php +++ b/src/Command/Ide/IdeServiceStopCommand.php @@ -34,12 +34,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->validateService($service); $serviceNameMap = [ - 'apache' => 'apache2', - 'apache2' => 'apache2', - 'mysql' => 'mysqld', - 'mysqld' => 'mysqld', - 'php' => 'php-fpm', - 'php-fpm' => 'php-fpm', + 'apache' => 'apache2', + 'apache2' => 'apache2', + 'mysql' => 'mysqld', + 'mysqld' => 'mysqld', + 'php' => 'php-fpm', + 'php-fpm' => 'php-fpm', ]; $output->writeln("Stopping $service..."); $serviceName = $serviceNameMap[$service]; @@ -52,10 +52,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int private function validateService(string $service): void { $violations = Validation::createValidator()->validate($service, [ - new Choice([ - 'choices' => ['php', 'php-fpm', 'apache', 'apache2', 'mysql', 'mysqld'], - 'message' => 'Specify a valid service name: php, apache, or mysql', - ]), + new Choice([ + 'choices' => ['php', 'php-fpm', 'apache', 'apache2', 'mysql', 'mysqld'], + 'message' => 'Specify a valid service name: php, apache, or mysql', + ]), ]); if (count($violations)) { throw new ValidatorException($violations->get(0)->getMessage()); diff --git a/src/Command/Ide/IdeShareCommand.php b/src/Command/Ide/IdeShareCommand.php index f01240c89..5ebc67658 100644 --- a/src/Command/Ide/IdeShareCommand.php +++ b/src/Command/Ide/IdeShareCommand.php @@ -57,8 +57,8 @@ private function getShareCodeFilepaths(): array { if (!isset($this->shareCodeFilepaths)) { $this->shareCodeFilepaths = [ - '/usr/local/share/ide/.sharecode', - '/home/ide/.sharecode', + '/usr/local/share/ide/.sharecode', + '/home/ide/.sharecode', ]; } return $this->shareCodeFilepaths; diff --git a/src/Command/Ide/Wizard/IdeWizardCreateSshKeyCommand.php b/src/Command/Ide/Wizard/IdeWizardCreateSshKeyCommand.php index f8383b732..f6bbb2f0c 100644 --- a/src/Command/Ide/Wizard/IdeWizardCreateSshKeyCommand.php +++ b/src/Command/Ide/Wizard/IdeWizardCreateSshKeyCommand.php @@ -37,9 +37,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $account, [ // Add SSH key to git repository. - "add ssh key to git", + "add ssh key to git", // Add SSH key to non-production environments. - "add ssh key to non-prod", + "add ssh key to non-prod", ] ); diff --git a/src/Command/Pull/PullCommandBase.php b/src/Command/Pull/PullCommandBase.php index 84b93117a..f12954456 100644 --- a/src/Command/Pull/PullCommandBase.php +++ b/src/Command/Pull/PullCommandBase.php @@ -100,10 +100,10 @@ public static function getBackupPath(object $environment, DatabaseResponse $data $dbMachineName = 'db' . $database->id; } $filename = implode('-', [ - $environment->name, - $database->name, - $dbMachineName, - $backupResponse->completedAt, + $environment->name, + $database->name, + $dbMachineName, + $backupResponse->completedAt, ]) . '.sql.gz'; return Path::join(sys_get_temp_dir(), $filename); } @@ -182,9 +182,9 @@ private function pullCodeFromCloud(EnvironmentResponse $chosenEnvironment, Closu // @todo Validate that an Acquia remote is configured for this repository. $this->localMachineHelper->checkRequiredBinariesExist(['git']); $this->localMachineHelper->execute([ - 'git', - 'fetch', - '--all', + 'git', + 'fetch', + '--all', ], $outputCallback, $this->dir, false); $this->checkoutBranchFromEnv($chosenEnvironment, $outputCallback); } @@ -196,9 +196,9 @@ private function checkoutBranchFromEnv(EnvironmentResponse $environment, Closure { $this->localMachineHelper->checkRequiredBinariesExist(['git']); $this->localMachineHelper->execute([ - 'git', - 'checkout', - $environment->vcs->path, + 'git', + 'checkout', + $environment->vcs->path, ], $outputCallback, $this->dir, false); } @@ -234,8 +234,8 @@ private function downloadDatabaseBackup( $acquiaCloudClient = $this->cloudApiClientService->getClient(); $acquiaCloudClient->addOption('sink', $localFilepath); $acquiaCloudClient->addOption('curl.options', [ - 'CURLOPT_FILE' => $localFilepath, - 'CURLOPT_RETURNTRANSFER' => false, + 'CURLOPT_FILE' => $localFilepath, + 'CURLOPT_RETURNTRANSFER' => false, ]); $acquiaCloudClient->addOption( 'progress', @@ -352,21 +352,21 @@ private function connectToLocalDatabase(string $dbHost, string $dbUser, string $ } $this->localMachineHelper->checkRequiredBinariesExist(['mysql']); $command = [ - 'mysql', - '--host', - $dbHost, - '--user', - $dbUser, - $dbName, + 'mysql', + '--host', + $dbHost, + '--user', + $dbUser, + $dbName, ]; $process = $this->localMachineHelper->execute($command, $outputCallback, null, false, null, ['MYSQL_PWD' => $dbPassword]); if (!$process->isSuccessful()) { throw new AcquiaCliException('Unable to connect to local database using credentials mysql://{user}:{password}@{host}/{database}. {message}', [ - 'database' => $dbName, - 'host' => $dbHost, - 'message' => $process->getErrorOutput(), - 'password' => $dbPassword, - 'user' => $dbUser, + 'database' => $dbName, + 'host' => $dbHost, + 'message' => $process->getErrorOutput(), + 'password' => $dbPassword, + 'user' => $dbUser, ]); } } @@ -378,15 +378,15 @@ private function dropDbTables(string $dbHost, string $dbUser, string $dbName, st } $this->localMachineHelper->checkRequiredBinariesExist(['mysql']); $command = [ - 'mysql', - '--host', - $dbHost, - '--user', - $dbUser, - $dbName, - '--silent', - '-e', - 'SHOW TABLES;', + 'mysql', + '--host', + $dbHost, + '--user', + $dbUser, + $dbName, + '--silent', + '-e', + 'SHOW TABLES;', ]; $process = $this->localMachineHelper->execute($command, $outputCallback, null, false, null, ['MYSQL_PWD' => $dbPassword]); $tables = $this->listTablesQuoted($process->getOutput()); @@ -395,14 +395,14 @@ private function dropDbTables(string $dbHost, string $dbUser, string $dbName, st $tempnam = $this->localMachineHelper->getFilesystem()->tempnam(sys_get_temp_dir(), 'acli_drop_table_', '.sql'); $this->localMachineHelper->getFilesystem()->dumpFile($tempnam, $sql); $command = [ - 'mysql', - '--host', - $dbHost, - '--user', - $dbUser, - $dbName, - '-e', - 'source ' . $tempnam, + 'mysql', + '--host', + $dbHost, + '--user', + $dbUser, + $dbName, + '-e', + 'source ' . $tempnam, ]; $process = $this->localMachineHelper->execute($command, $outputCallback, null, false, null, ['MYSQL_PWD' => $dbPassword]); if (!$process->isSuccessful()) { @@ -489,10 +489,10 @@ private function cloneFromCloud(EnvironmentResponse $chosenEnvironment, Closure { $this->localMachineHelper->checkRequiredBinariesExist(['git']); $command = [ - 'git', - 'clone', - $chosenEnvironment->vcs->url, - $this->dir, + 'git', + 'clone', + $chosenEnvironment->vcs->url, + $this->dir, ]; $process = $this->localMachineHelper->execute($command, $outputCallback, null, ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL), null, ['GIT_SSH_COMMAND' => 'ssh -o StrictHostKeyChecking=no']); $this->checkoutBranchFromEnv($chosenEnvironment, $outputCallback); @@ -567,9 +567,9 @@ private function printDatabaseBackupInfo( $dateFormatted = date("D M j G:i:s T Y", strtotime($backupResponse->completedAt)); $webLink = "https://cloud.acquia.com/a/environments/{$sourceEnvironment->uuid}/databases"; $messages = [ - "Using a database backup that is $hoursInterval hours old. Backup #$backupResponse->id was created at {$dateFormatted}.", - "You can view your backups here: $webLink", - "To generate a new backup, re-run this command with the --on-demand option.", + "Using a database backup that is $hoursInterval hours old. Backup #$backupResponse->id was created at {$dateFormatted}.", + "You can view your backups here: $webLink", + "To generate a new backup, re-run this command with the --on-demand option.", ]; if ($hoursInterval > 24) { $this->io->warning($messages); diff --git a/src/Command/Push/PushArtifactCommand.php b/src/Command/Push/PushArtifactCommand.php index de9ccbdf6..9477ef84b 100644 --- a/src/Command/Push/PushArtifactCommand.php +++ b/src/Command/Push/PushArtifactCommand.php @@ -101,12 +101,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $destinationGitUrlsString = implode(',', $destinationGitUrls); $refType = $this->input->getOption('destination-git-tag') ? 'tag' : 'branch'; $this->io->note([ - "Acquia CLI will:", - "- git clone $sourceGitBranch from $destinationGitUrls[0]", - "- Compile the contents of $this->dir into an artifact in a temporary directory", - "- Copy the artifact files into the checked out copy of $sourceGitBranch", - "- Commit changes and push the $destinationGitRef $refType to the following git remote(s):", - " $destinationGitUrlsString", + "Acquia CLI will:", + "- git clone $sourceGitBranch from $destinationGitUrls[0]", + "- Compile the contents of $this->dir into an artifact in a temporary directory", + "- Copy the artifact files into the checked out copy of $sourceGitBranch", + "- Commit changes and push the $destinationGitRef $refType to the following git remote(s):", + " $destinationGitUrlsString", ]); $this->checklist->addItem('Preparing artifact directory'); @@ -180,37 +180,37 @@ private function cloneSourceBranch(Closure $outputCallback, string $artifactDir, $outputCallback('out', "Initializing Git in $artifactDir"); $this->localMachineHelper->checkRequiredBinariesExist(['git']); $process = $this->localMachineHelper->execute([ - 'git', - 'clone', - '--depth=1', - $vcsUrl, - $artifactDir, + 'git', + 'clone', + '--depth=1', + $vcsUrl, + $artifactDir, ], $outputCallback, null, ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL)); if (!$process->isSuccessful()) { throw new AcquiaCliException('Failed to clone repository from the Cloud Platform: {message}', ['message' => $process->getErrorOutput()]); } $process = $this->localMachineHelper->execute([ - 'git', - 'fetch', - '--depth=1', - '--update-head-ok', - $vcsUrl, - $vcsPath . ':' . $vcsPath, + 'git', + 'fetch', + '--depth=1', + '--update-head-ok', + $vcsUrl, + $vcsPath . ':' . $vcsPath, ], $outputCallback, $artifactDir, ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL)); if (!$process->isSuccessful()) { // Remote branch does not exist. Just create it locally. This will create // the new branch off of the current commit. $process = $this->localMachineHelper->execute([ - 'git', - 'checkout', - '-b', - $vcsPath, + 'git', + 'checkout', + '-b', + $vcsPath, ], $outputCallback, $artifactDir, ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL)); } else { $process = $this->localMachineHelper->execute([ - 'git', - 'checkout', - $vcsPath, + 'git', + 'checkout', + $vcsPath, ], $outputCallback, $artifactDir, ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL)); } if (!$process->isSuccessful()) { @@ -273,7 +273,7 @@ private function sanitizeArtifact(Closure $outputCallback, string $artifactDir): ->ignoreVCS(false) ->directories() ->in(["$artifactDir/docroot", - "$artifactDir/vendor", + "$artifactDir/vendor", ]) ->name('.git'); $drushDir = "$artifactDir/drush"; @@ -295,15 +295,15 @@ private function sanitizeArtifact(Closure $outputCallback, string $artifactDir): $outputCallback('out', 'Finding other common text files'); $filenames = [ - 'AUTHORS', - 'CHANGELOG', - 'CONDUCT', - 'CONTRIBUTING', - 'INSTALL', - 'MAINTAINERS', - 'PATCHES', - 'TESTING', - 'UPDATE', + 'AUTHORS', + 'CHANGELOG', + 'CONDUCT', + 'CONTRIBUTING', + 'INSTALL', + 'MAINTAINERS', + 'PATCHES', + 'TESTING', + 'UPDATE', ]; $textFileFinder = $this->localMachineHelper->getFinder() ->files() @@ -361,10 +361,10 @@ private function pushArtifact(Closure $outputCallback, string $artifactDir, arra foreach ($vcsUrls as $vcsUrl) { $outputCallback('out', "Pushing changes to Acquia Git ($vcsUrl)"); $args = [ - 'git', - 'push', - $vcsUrl, - $destGitBranch, + 'git', + 'push', + $vcsUrl, + $destGitBranch, ]; $process = $this->localMachineHelper->execute($args, $outputCallback, $artifactDir, ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL)); if (!$process->isSuccessful()) { @@ -385,7 +385,7 @@ private function vendorDirs(): array } $this->vendorDirs = [ - 'vendor', + 'vendor', ]; if (file_exists($this->composerJsonPath)) { $composerJson = json_decode($this->localMachineHelper->readFile($this->composerJsonPath), true, 512, JSON_THROW_ON_ERROR); @@ -424,8 +424,8 @@ private function scaffoldFiles(string $artifactDir): array private function validateSourceCode(): void { $requiredPaths = [ - $this->composerJsonPath, - $this->docrootPath, + $this->composerJsonPath, + $this->docrootPath, ]; foreach ($requiredPaths as $requiredPath) { if (!file_exists($requiredPath)) { @@ -483,9 +483,9 @@ private function createTag(mixed $tagName, Closure $outputCallback, string $arti { $this->localMachineHelper->checkRequiredBinariesExist(['git']); $process = $this->localMachineHelper->execute([ - 'git', - 'tag', - $tagName, + 'git', + 'tag', + $tagName, ], $outputCallback, $artifactDir, ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL)); if (!$process->isSuccessful()) { throw new AcquiaCliException('Failed to create Git tag: {message}', ['message' => $process->getErrorOutput()]); diff --git a/src/Command/Push/PushDatabaseCommand.php b/src/Command/Push/PushDatabaseCommand.php index dd9ee417c..0bfd6609d 100644 --- a/src/Command/Push/PushDatabaseCommand.php +++ b/src/Command/Push/PushDatabaseCommand.php @@ -67,11 +67,11 @@ private function uploadDatabaseDump( $this->logger->debug("Uploading database dump to $remoteFilepath on remote machine"); $this->localMachineHelper->checkRequiredBinariesExist(['rsync']); $command = [ - 'rsync', - '-tDvPhe', - 'ssh -o StrictHostKeyChecking=no', - $localFilepath, - $environment->sshUrl . ':' . $remoteFilepath, + 'rsync', + '-tDvPhe', + 'ssh -o StrictHostKeyChecking=no', + $localFilepath, + $environment->sshUrl . ':' . $remoteFilepath, ]; $process = $this->localMachineHelper->execute($command, $outputCallback, null, ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL)); if (!$process->isSuccessful()) { diff --git a/src/Command/Remote/AliasesDownloadCommand.php b/src/Command/Remote/AliasesDownloadCommand.php index 89f7a0978..da296796c 100644 --- a/src/Command/Remote/AliasesDownloadCommand.php +++ b/src/Command/Remote/AliasesDownloadCommand.php @@ -66,8 +66,8 @@ protected function promptChooseDrushAliasVersion(): string $this->io->writeln('Drush changed how aliases are defined in Drush 9. Drush 8 aliases are PHP-based and stored in your home directory, while Drush 9+ aliases are YAML-based and stored with your project.'); $question = 'Choose your preferred alias compatibility:'; $choices = [ - '8' => 'Drush 8 / Drupal 7 (PHP)', - '9' => 'Drush 9+ / Drupal 8+ (YAML)', + '8' => 'Drush 8 / Drupal 7 (PHP)', + '9' => 'Drush 9+ / Drupal 8+ (YAML)', ]; return (string) array_search($this->io->choice($question, $choices, '9'), $choices, true); } diff --git a/src/Command/Remote/DrushCommand.php b/src/Command/Remote/DrushCommand.php index dad6feb32..0b8c0bad8 100644 --- a/src/Command/Remote/DrushCommand.php +++ b/src/Command/Remote/DrushCommand.php @@ -40,9 +40,9 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int array_unshift($drushArguments, "--uri=http://$environment->default_domain"); } $drushCommandArguments = [ - "cd /var/www/html/$alias/docroot; ", - 'drush', - implode(' ', $drushArguments), + "cd /var/www/html/$alias/docroot; ", + 'drush', + implode(' ', $drushArguments), ]; return $this->sshHelper->executeCommand($environment->sshUrl, $drushCommandArguments)->getExitCode(); diff --git a/src/Command/Remote/SshCommand.php b/src/Command/Remote/SshCommand.php index 22ba6bee6..cd5841d36 100644 --- a/src/Command/Remote/SshCommand.php +++ b/src/Command/Remote/SshCommand.php @@ -37,7 +37,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int throw new AcquiaCliException('Cannot determine environment SSH URL. Check that you have SSH permissions on this environment.'); } $sshCommand = [ - 'cd /var/www/html/' . $alias, + 'cd /var/www/html/' . $alias, ]; $arguments = $input->getArguments(); if (empty($arguments['ssh_command'])) { diff --git a/src/Command/Self/ListCommand.php b/src/Command/Self/ListCommand.php index 224302db6..b8a8c940b 100644 --- a/src/Command/Self/ListCommand.php +++ b/src/Command/Self/ListCommand.php @@ -24,10 +24,10 @@ 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'), + 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' @@ -69,9 +69,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $helper = new DescriptorHelper(); $helper->describe($output, $this->getApplication(), [ - 'format' => $input->getOption('format'), - 'namespace' => $input->getArgument('namespace'), - 'raw_text' => $input->getOption('raw'), + 'format' => $input->getOption('format'), + 'namespace' => $input->getArgument('namespace'), + 'raw_text' => $input->getOption('raw'), ]); return Command::SUCCESS; diff --git a/src/Command/Self/MakeDocsCommand.php b/src/Command/Self/MakeDocsCommand.php index ad9896a5b..b888f642a 100644 --- a/src/Command/Self/MakeDocsCommand.php +++ b/src/Command/Self/MakeDocsCommand.php @@ -28,7 +28,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!$input->getOption('dump')) { $helper->describe($output, $this->getApplication(), [ - 'format' => $input->getOption('format'), + 'format' => $input->getOption('format'), ]); return Command::SUCCESS; } @@ -37,7 +37,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->localMachineHelper->getFilesystem()->mkdir($docs_dir); $buffer = new BufferedOutput(); $helper->describe($buffer, $this->getApplication(), [ - 'format' => 'json', + 'format' => 'json', ]); $commands = json_decode($buffer->fetch(), true); $index = []; @@ -47,10 +47,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $filename = $command['name'] . '.json'; $index[] = [ - 'command' => $command['name'], - 'help' => $command['help'], - 'path' => $filename, - 'usage' => $command['usage'][0], + 'command' => $command['name'], + 'help' => $command['help'], + 'path' => $filename, + 'usage' => $command['usage'][0], ]; file_put_contents("$docs_dir/$filename", json_encode($command)); } diff --git a/src/Command/Ssh/SshKeyCommandBase.php b/src/Command/Ssh/SshKeyCommandBase.php index 656ca01b9..55a3a71b3 100644 --- a/src/Command/Ssh/SshKeyCommandBase.php +++ b/src/Command/Ssh/SshKeyCommandBase.php @@ -71,8 +71,8 @@ protected function normalizePublicSshKey(string $publicKey): string protected function sshKeyIsAddedToKeychain(): bool { $process = $this->localMachineHelper->execute([ - 'ssh-add', - '-L', + 'ssh-add', + '-L', ], null, null, false); if ($process->isSuccessful()) { @@ -232,15 +232,15 @@ private function doCreateSshKey(string $filename, string $password): string $this->localMachineHelper->checkRequiredBinariesExist(['ssh-keygen']); $process = $this->localMachineHelper->execute([ - 'ssh-keygen', - '-t', - 'rsa', - '-b', - '4096', - '-f', - $filepath, - '-N', - $password, + 'ssh-keygen', + '-t', + 'rsa', + '-b', + '4096', + '-f', + $filepath, + '-N', + $password, ], null, null, false); if (!$process->isSuccessful()) { throw new AcquiaCliException($process->getOutput() . $process->getErrorOutput()); @@ -265,9 +265,9 @@ static function (mixed $value) { private function validateFilename(string $filename): string { $violations = Validation::createValidator()->validate($filename, [ - new Length(['min' => 5]), - new NotBlank(), - new Regex(['pattern' => '/^\S*$/', 'message' => 'The value may not contain spaces']), + new Length(['min' => 5]), + new NotBlank(), + new Regex(['pattern' => '/^\S*$/', 'message' => 'The value may not contain spaces']), ]); if (count($violations)) { throw new ValidatorException($violations->get(0)->getMessage()); @@ -291,8 +291,8 @@ static function (mixed $value) { private function validatePassword(string $password): string { $violations = Validation::createValidator()->validate($password, [ - new Length(['min' => 5]), - new NotBlank(), + new Length(['min' => 5]), + new NotBlank(), ]); if (count($violations)) { throw new ValidatorException($violations->get(0)->getMessage()); diff --git a/src/Command/Ssh/SshKeyInfoCommand.php b/src/Command/Ssh/SshKeyInfoCommand.php index 1c5a1f1a2..67bd204cf 100644 --- a/src/Command/Ssh/SshKeyInfoCommand.php +++ b/src/Command/Ssh/SshKeyInfoCommand.php @@ -67,10 +67,10 @@ private function determineSshKey(mixed $acquiaCloudClient): array $keys[$fingerprint]['fingerprint'] = $fingerprint; $keys[$fingerprint]['public_key'] = $key->public_key; $keys[$fingerprint]['cloud'] = [ - 'created_at' => $key->created_at, - 'fingerprint' => $key->fingerprint, - 'label' => $key->label, - 'uuid' => $key->uuid, + 'created_at' => $key->created_at, + 'fingerprint' => $key->fingerprint, + 'label' => $key->label, + 'uuid' => $key->uuid, ]; } foreach ($localKeys as $key) { @@ -78,7 +78,7 @@ private function determineSshKey(mixed $acquiaCloudClient): array $keys[$fingerprint]['fingerprint'] = $fingerprint; $keys[$fingerprint]['public_key'] = $key->getContents(); $keys[$fingerprint]['local'] = [ - 'filename' => $key->getFilename(), + 'filename' => $key->getFilename(), ]; } if ($fingerprint = $this->input->getOption('fingerprint')) { diff --git a/src/Command/Ssh/SshKeyListCommand.php b/src/Command/Ssh/SshKeyListCommand.php index 3f711a408..c70cf1001 100644 --- a/src/Command/Ssh/SshKeyListCommand.php +++ b/src/Command/Ssh/SshKeyListCommand.php @@ -29,9 +29,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (trim($localFile->getContents()) === trim($cloudKey->public_key)) { $hash = self::getFingerprint($cloudKey->public_key); $table->addRow([ - $cloudKey->label, - $localFile->getFilename(), - $hash, + $cloudKey->label, + $localFile->getFilename(), + $hash, ]); unset($cloudKeys[$index], $localKeys[$localIndex]); break; @@ -45,9 +45,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int foreach ($cloudKeys as $cloudKey) { $hash = self::getFingerprint($cloudKey->public_key); $table->addRow([ - $cloudKey->label, - 'none', - $hash, + $cloudKey->label, + 'none', + $hash, ]); } $table->render(); @@ -57,9 +57,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int foreach ($localKeys as $localFile) { $hash = self::getFingerprint($localFile->getContents()); $table->addRow([ - 'none', - $localFile->getFilename(), - $hash, + 'none', + $localFile->getFilename(), + $hash, ]); } $table->render(); diff --git a/src/Command/WizardCommandBase.php b/src/Command/WizardCommandBase.php index ccf773f16..2156da3a1 100644 --- a/src/Command/WizardCommandBase.php +++ b/src/Command/WizardCommandBase.php @@ -36,8 +36,8 @@ protected function initialize(InputInterface $input, OutputInterface $output): v protected function deleteLocalSshKey(): void { $this->localMachineHelper->getFilesystem()->remove([ - $this->publicSshKeyFilepath, - $this->privateSshKeyFilepath, + $this->publicSshKeyFilepath, + $this->privateSshKeyFilepath, ]); } diff --git a/src/Exception/AcquiaCliException.php b/src/Exception/AcquiaCliException.php index 28912e050..515d1d659 100644 --- a/src/Exception/AcquiaCliException.php +++ b/src/Exception/AcquiaCliException.php @@ -21,8 +21,8 @@ public function __construct( int $code = 0 ) { $eventProperties = [ - 'code' => $code, - 'message' => $rawMessage, + 'code' => $code, + 'message' => $rawMessage, ]; Amplitude::getInstance()->queueEvent('Threw exception', $eventProperties); diff --git a/src/Helpers/LocalMachineHelper.php b/src/Helpers/LocalMachineHelper.php index 5a48dcabd..696cbb433 100644 --- a/src/Helpers/LocalMachineHelper.php +++ b/src/Helpers/LocalMachineHelper.php @@ -137,8 +137,8 @@ private function executeProcess(Process $process, callable $callback = null, ?bo $process->wait($callback); $this->logger->notice('Command: {command} [Exit: {exit}]', [ - 'command' => $process->getCommandLine(), - 'exit' => $process->getExitCode(), + 'command' => $process->getCommandLine(), + 'exit' => $process->getExitCode(), ]); return $process; @@ -274,7 +274,7 @@ public static function getConfigDir(): string public static function getProjectDir(): ?string { $possibleProjectRoots = [ - getcwd(), + getcwd(), ]; // Check for PWD - some local environments will not have this key. if (getenv('PWD') && !in_array(getenv('PWD'), $possibleProjectRoots, true)) { diff --git a/src/Helpers/SshCommandTrait.php b/src/Helpers/SshCommandTrait.php index 98f7bbdbb..dd05f30f4 100644 --- a/src/Helpers/SshCommandTrait.php +++ b/src/Helpers/SshCommandTrait.php @@ -30,8 +30,8 @@ private function deleteSshKeyFromCloud(mixed $output, mixed $cloudKey = null): i $answer = $this->io->confirm("Do you also want to delete the corresponding local key files {$localFile->getRealPath()} and $privateKeyPath ?", false); if ($answer) { $this->localMachineHelper->getFilesystem()->remove([ - $localFile->getRealPath(), - $privateKeyPath, + $localFile->getRealPath(), + $privateKeyPath, ]); $this->io->success("Deleted $publicKeyPath and $privateKeyPath"); return 0; diff --git a/src/Helpers/SshHelper.php b/src/Helpers/SshHelper.php index a62582448..e1471e597 100644 --- a/src/Helpers/SshHelper.php +++ b/src/Helpers/SshHelper.php @@ -40,9 +40,9 @@ public function executeCommand(string $sshUrl, array $commandArgs, bool $printOu $process = $this->sendCommand($sshUrl, $commandArgs, $printOutput, $timeout); $this->logger->debug('Command: {command} [Exit: {exit}]', [ - 'command' => $commandSummary, - 'env' => $sshUrl, - 'exit' => $process->getExitCode(), + 'command' => $commandSummary, + 'env' => $sshUrl, + 'exit' => $process->getExitCode(), ]); if (!$process->isSuccessful() && $process->getExitCode() === 255) { @@ -107,12 +107,12 @@ private function getCommandSummary(array $commandArgs): string private function getConnectionArgs(string $url): array { return [ - 'ssh', - $url, - '-t', - '-o StrictHostKeyChecking=no', - '-o AddressFamily inet', - '-o LogLevel=ERROR', + 'ssh', + $url, + '-t', + '-o StrictHostKeyChecking=no', + '-o AddressFamily inet', + '-o LogLevel=ERROR', ]; } diff --git a/src/Helpers/TelemetryHelper.php b/src/Helpers/TelemetryHelper.php index aef7016e2..aab4aa901 100644 --- a/src/Helpers/TelemetryHelper.php +++ b/src/Helpers/TelemetryHelper.php @@ -63,7 +63,7 @@ public function initializeBugsnag(): void $userId = $this->getUserId(); if (isset($userId)) { $report->setUser([ - 'id' => $userId, + 'id' => $userId, ]); } $context = $report->getContext(); @@ -143,14 +143,14 @@ public static function normalizeAhEnv(string $ah_env): string private function getTelemetryUserData(): array { $data = [ - 'ah_app_uuid' => getenv('AH_APPLICATION_UUID'), - 'ah_env' => $this->normalizeAhEnv(AcquiaDrupalEnvironmentDetector::getAhEnv()), - 'ah_group' => AcquiaDrupalEnvironmentDetector::getAhGroup(), - 'ah_non_production' => getenv('AH_NON_PRODUCTION'), - 'ah_realm' => getenv('AH_REALM'), - 'CI' => getenv('CI'), - 'env_provider' => $this->getEnvironmentProvider(), - 'php_version' => PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION, + 'ah_app_uuid' => getenv('AH_APPLICATION_UUID'), + 'ah_env' => $this->normalizeAhEnv(AcquiaDrupalEnvironmentDetector::getAhEnv()), + 'ah_group' => AcquiaDrupalEnvironmentDetector::getAhGroup(), + 'ah_non_production' => getenv('AH_NON_PRODUCTION'), + 'ah_realm' => getenv('AH_REALM'), + 'CI' => getenv('CI'), + 'env_provider' => $this->getEnvironmentProvider(), + 'php_version' => PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION, ]; try { $user = $this->getUserData(); @@ -224,8 +224,8 @@ private function getDefaultUserData(): array // @todo Cache this! $account = new Account($this->cloudApiClientService->getClient()); return [ - 'is_acquian' => str_ends_with($account->get()->mail, 'acquia.com'), - 'uuid' => $account->get()->uuid, + 'is_acquian' => str_ends_with($account->get()->mail, 'acquia.com'), + 'uuid' => $account->get()->uuid, ]; } @@ -241,28 +241,28 @@ public static function getProviders(): array // Define the environment variables associated with each provider. // phpcs:ignore SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys.IncorrectKeyOrder return [ - 'lando' => ['LANDO'], - 'ddev' => ['IS_DDEV_PROJECT'], + 'lando' => ['LANDO'], + 'ddev' => ['IS_DDEV_PROJECT'], // Check Lando and DDEV first because the hijack AH_SITE_ENVIRONMENT. - 'acquia' => ['AH_SITE_ENVIRONMENT'], - 'bamboo' => ['BAMBOO_BUILDNUMBER'], - 'beanstalk' => ['BEANSTALK_ENVIRONMENT'], - 'bitbucket' => ['BITBUCKET_BUILD_NUMBER'], - 'bitrise' => ['BITRISE_IO'], - 'buddy' => ['BUDDY_WORKSPACE_ID'], - 'circleci' => ['CIRCLECI'], - 'codebuild' => ['CODEBUILD_BUILD_ID'], - 'docksal' => ['DOCKSAL_VERSION'], - 'drone' => ['DRONE'], - 'github' => ['GITHUB_ACTIONS'], - 'gitlab' => ['GITLAB_CI'], - 'heroku' => ['HEROKU_TEST_RUN_ID'], - 'jenkins' => ['JENKINS_URL'], - 'pantheon' => ['PANTHEON_ENVIRONMENT'], - 'pipelines' => ['PIPELINE_ENV'], - 'platformsh' => ['PLATFORM_ENVIRONMENT'], - 'teamcity' => ['TEAMCITY_VERSION'], - 'travis' => ['TRAVIS'], + 'acquia' => ['AH_SITE_ENVIRONMENT'], + 'bamboo' => ['BAMBOO_BUILDNUMBER'], + 'beanstalk' => ['BEANSTALK_ENVIRONMENT'], + 'bitbucket' => ['BITBUCKET_BUILD_NUMBER'], + 'bitrise' => ['BITRISE_IO'], + 'buddy' => ['BUDDY_WORKSPACE_ID'], + 'circleci' => ['CIRCLECI'], + 'codebuild' => ['CODEBUILD_BUILD_ID'], + 'docksal' => ['DOCKSAL_VERSION'], + 'drone' => ['DRONE'], + 'github' => ['GITHUB_ACTIONS'], + 'gitlab' => ['GITLAB_CI'], + 'heroku' => ['HEROKU_TEST_RUN_ID'], + 'jenkins' => ['JENKINS_URL'], + 'pantheon' => ['PANTHEON_ENVIRONMENT'], + 'pipelines' => ['PIPELINE_ENV'], + 'platformsh' => ['PLATFORM_ENVIRONMENT'], + 'teamcity' => ['TEAMCITY_VERSION'], + 'travis' => ['TRAVIS'], ]; } } diff --git a/src/Kernel.php b/src/Kernel.php index 77970db95..053bfa68b 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -52,7 +52,7 @@ protected function registerExtensionConfiguration(mixed $loader): void $finder = new Finder(); $extensions = $finder->files() ->in([ - __DIR__ . '/../../', + __DIR__ . '/../../', ]) ->depth(1) ->name('acli.services.yml'); @@ -70,8 +70,8 @@ protected function getContainerLoader(ContainerInterface $container): Delegating { $locator = new FileLocator([$this->getProjectDir()]); $resolver = new LoaderResolver([ - new YamlFileLoader($container, $locator), - new DirectoryLoader($container, $locator), + new YamlFileLoader($container, $locator), + new DirectoryLoader($container, $locator), ]); return new DelegatingLoader($resolver); @@ -98,11 +98,11 @@ public function process(ContainerBuilder $containerBuilder): void if ($definition->hasTag('kernel.event_listener')) { foreach ($definition->getTag('kernel.event_listener') as $tag) { $dispatcherDefinition->addMethodCall('addListener', [ - $tag['event'], - [ - new ServiceClosureArgument(new Reference($definition->getClass())), - $tag['method'], - ], + $tag['event'], + [ + new ServiceClosureArgument(new Reference($definition->getClass())), + $tag['method'], + ], ]); } } @@ -118,12 +118,12 @@ public function process(ContainerBuilder $containerBuilder): void } $appDefinition->addMethodCall('add', [ - new Reference($definition->getClass()), + new Reference($definition->getClass()), ]); } $appDefinition->addMethodCall('setDispatcher', [ - $dispatcherDefinition, + $dispatcherDefinition, ]); } }; diff --git a/src/Output/Spinner/Spinner.php b/src/Output/Spinner/Spinner.php index b3ab9ccb6..1817ae244 100644 --- a/src/Output/Spinner/Spinner.php +++ b/src/Output/Spinner/Spinner.php @@ -15,66 +15,66 @@ class Spinner { private const CHARS = ['⠏', '⠛', '⠹', '⢸', '⣰', '⣤', '⣆', '⡇']; private const COLORS = [ - 196, - 196, - 202, - 202, - 208, - 208, - 214, - 214, - 220, - 220, - 226, - 226, - 190, - 190, - 154, - 154, - 118, - 118, - 82, - 82, - 46, - 46, - 47, - 47, - 48, - 48, - 49, - 49, - 50, - 50, - 51, - 51, - 45, - 45, - 39, - 39, - 33, - 33, - 27, - 27, - 56, - 56, - 57, - 57, - 93, - 93, - 129, - 129, - 165, - 165, - 201, - 201, - 200, - 200, - 199, - 199, - 198, - 198, - 197, - 197, + 196, + 196, + 202, + 202, + 208, + 208, + 214, + 214, + 220, + 220, + 226, + 226, + 190, + 190, + 154, + 154, + 118, + 118, + 82, + 82, + 46, + 46, + 47, + 47, + 48, + 48, + 49, + 49, + 50, + 50, + 51, + 51, + 45, + 45, + 39, + 39, + 33, + 33, + 27, + 27, + 56, + 56, + 57, + 57, + 93, + 93, + 129, + 129, + 165, + 165, + 201, + 201, + 200, + 200, + 199, + 199, + 198, + 198, + 197, + 197, ]; private int $currentCharIdx = 0; diff --git a/tests/phpunit/src/AcsfApi/AcsfServiceTest.php b/tests/phpunit/src/AcsfApi/AcsfServiceTest.php index 4e381ef6b..1640c8b3a 100644 --- a/tests/phpunit/src/AcsfApi/AcsfServiceTest.php +++ b/tests/phpunit/src/AcsfApi/AcsfServiceTest.php @@ -24,22 +24,22 @@ protected function setUp(): void public function providerTestIsMachineAuthenticated(): array { return [ - [ - ['ACSF_USERNAME' => 'key', 'ACSF_KEY' => 'secret'], - true, - ], - [ - ['ACSF_USERNAME' => 'key', 'ACSF_KEY' => 'secret'], - true, - ], - [ - ['ACSF_USERNAME' => null, 'ACSF_KEY' => null], - false, - ], - [ - ['ACSF_USERNAME' => 'key', 'ACSF_KEY' => null], - false, - ], + [ + ['ACSF_USERNAME' => 'key', 'ACSF_KEY' => 'secret'], + true, + ], + [ + ['ACSF_USERNAME' => 'key', 'ACSF_KEY' => 'secret'], + true, + ], + [ + ['ACSF_USERNAME' => null, 'ACSF_KEY' => null], + false, + ], + [ + ['ACSF_USERNAME' => 'key', 'ACSF_KEY' => null], + false, + ], ]; } diff --git a/tests/phpunit/src/Application/ComposerScriptsListenerTest.php b/tests/phpunit/src/Application/ComposerScriptsListenerTest.php index 22acc722a..b2565157e 100644 --- a/tests/phpunit/src/Application/ComposerScriptsListenerTest.php +++ b/tests/phpunit/src/Application/ComposerScriptsListenerTest.php @@ -25,11 +25,11 @@ class ComposerScriptsListenerTest extends ApplicationTestBase public function testPreScripts(): void { $json = [ - 'scripts' => [ - 'pre-acli-hello-world' => [ - 'echo "good morning world"', - ], - ], + 'scripts' => [ + 'pre-acli-hello-world' => [ + 'echo "good morning world"', + ], + ], ]; file_put_contents( Path::join($this->projectDir, 'composer.json'), @@ -37,7 +37,7 @@ public function testPreScripts(): void ); $this->mockRequest('getAccount'); $this->setInput([ - 'command' => 'hello-world', + 'command' => 'hello-world', ]); $buffer = $this->runApp(); self::assertStringContainsString('pre-acli-hello-world', $buffer); @@ -49,11 +49,11 @@ public function testPreScripts(): void public function testPostScripts(): void { $json = [ - 'scripts' => [ - 'post-acli-hello-world' => [ - 'echo "goodbye world"', - ], - ], + 'scripts' => [ + 'post-acli-hello-world' => [ + 'echo "goodbye world"', + ], + ], ]; file_put_contents( Path::join($this->projectDir, 'composer.json'), @@ -61,7 +61,7 @@ public function testPostScripts(): void ); $this->mockRequest('getAccount'); $this->setInput([ - 'command' => 'hello-world', + 'command' => 'hello-world', ]); $buffer = $this->runApp(); self::assertStringContainsString('post-acli-hello-world', $buffer); @@ -70,19 +70,19 @@ public function testPostScripts(): void public function testNoScripts(): void { $json = [ - 'scripts' => [ - 'pre-acli-pull-code' => [ - 'echo "goodbye world"', - ], - ], + 'scripts' => [ + 'pre-acli-pull-code' => [ + 'echo "goodbye world"', + ], + ], ]; file_put_contents( Path::join($this->projectDir, 'composer.json'), json_encode($json, JSON_THROW_ON_ERROR) ); $this->setInput([ - '--no-scripts' => true, - 'command' => 'pull:code', + '--no-scripts' => true, + 'command' => 'pull:code', ]); $buffer = $this->runApp(); self::assertStringNotContainsString('pre-acli-pull-code', $buffer); diff --git a/tests/phpunit/src/Application/ExceptionApplicationTest.php b/tests/phpunit/src/Application/ExceptionApplicationTest.php index 69300a58a..a37f9e674 100644 --- a/tests/phpunit/src/Application/ExceptionApplicationTest.php +++ b/tests/phpunit/src/Application/ExceptionApplicationTest.php @@ -23,8 +23,8 @@ class ExceptionApplicationTest extends ApplicationTestBase public function testInvalidApiCredentials(): void { $this->setInput([ - 'applicationUuid' => '2ed281d4-9dec-4cc3-ac63-691c3ba002c2', - 'command' => 'aliases', + 'applicationUuid' => '2ed281d4-9dec-4cc3-ac63-691c3ba002c2', + 'command' => 'aliases', ]); $this->mockUnauthorizedRequest(); $buffer = $this->runApp(); diff --git a/tests/phpunit/src/Application/HelpApplicationTest.php b/tests/phpunit/src/Application/HelpApplicationTest.php index f40dec53f..cdbab643f 100644 --- a/tests/phpunit/src/Application/HelpApplicationTest.php +++ b/tests/phpunit/src/Application/HelpApplicationTest.php @@ -21,8 +21,8 @@ class HelpApplicationTest extends ApplicationTestBase public function testApplicationAliasHelp(): void { $this->setInput([ - 'command' => 'help', - 'command_name' => 'app:link', + 'command' => 'help', + 'command_name' => 'app:link', ]); $buffer = $this->runApp(); $this->assertStringContainsString('The Cloud Platform application UUID or alias (i.e. an application name optionally prefixed with the realm)', $buffer); @@ -41,8 +41,8 @@ public function testApplicationAliasHelp(): void public function testEnvironmentAliasHelp(): void { $this->setInput([ - 'command' => 'help', - 'command_name' => 'log:tail', + 'command' => 'help', + 'command_name' => 'log:tail', ]); $buffer = $this->runApp(); $this->assertStringContainsString('The Cloud Platform environment ID or alias (i.e. an application and environment name optionally prefixed with the realm)', $buffer); diff --git a/tests/phpunit/src/Application/KernelTest.php b/tests/phpunit/src/Application/KernelTest.php index 3963f24f5..0faec8699 100644 --- a/tests/phpunit/src/Application/KernelTest.php +++ b/tests/phpunit/src/Application/KernelTest.php @@ -14,7 +14,7 @@ class KernelTest extends ApplicationTestBase public function testRun(): void { $this->setInput([ - 'command' => 'list', + '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. diff --git a/tests/phpunit/src/CloudApi/AccessTokenConnectorTest.php b/tests/phpunit/src/CloudApi/AccessTokenConnectorTest.php index 560e9c7e4..866f07ea8 100644 --- a/tests/phpunit/src/CloudApi/AccessTokenConnectorTest.php +++ b/tests/phpunit/src/CloudApi/AccessTokenConnectorTest.php @@ -55,10 +55,10 @@ public function testAccessToken(): void self::assertEquals(self::$accessToken, $this->cloudCredentials->getCloudAccessToken()); $connectorFactory = new ConnectorFactory( [ - 'accessToken' => $this->cloudCredentials->getCloudAccessToken(), - 'accessTokenExpiry' => $this->cloudCredentials->getCloudAccessTokenExpiry(), - 'key' => null, - 'secret' => null, + 'accessToken' => $this->cloudCredentials->getCloudAccessToken(), + 'accessTokenExpiry' => $this->cloudCredentials->getCloudAccessTokenExpiry(), + 'key' => null, + 'secret' => null, ] ); $connector = $connectorFactory->createConnector(); @@ -83,8 +83,8 @@ public function testTokenFile(): void { $accessTokenExpiry = time() + 300; $directory = [ - 'expiry' => (string) $accessTokenExpiry . "\n", - 'token' => self::$accessToken . "\n", + 'expiry' => (string) $accessTokenExpiry . "\n", + 'token' => self::$accessToken . "\n", ]; $vfs = vfsStream::setup('root', null, $directory); $tokenFile = Path::join($vfs->url(), 'token'); @@ -99,7 +99,7 @@ public function testMissingTokenFile(): void { $accessTokenExpiry = time() + 300; $directory = [ - 'expiry' => (string) $accessTokenExpiry, + 'expiry' => (string) $accessTokenExpiry, ]; $vfs = vfsStream::setup('root', null, $directory); $tokenFile = Path::join($vfs->url(), 'token'); @@ -114,7 +114,7 @@ public function testMissingTokenFile(): void public function testMissingExpiryFile(): void { $directory = [ - 'token' => self::$accessToken, + 'token' => self::$accessToken, ]; $vfs = vfsStream::setup('root', null, $directory); $tokenFile = Path::join($vfs->url(), 'token'); @@ -137,10 +137,10 @@ public function testConnector(): void self::assertEquals(self::$accessToken, $this->cloudCredentials->getCloudAccessToken()); $connectorFactory = new ConnectorFactory( [ - 'accessToken' => $this->cloudCredentials->getCloudAccessToken(), - 'accessTokenExpiry' => $this->cloudCredentials->getCloudAccessTokenExpiry(), - 'key' => $this->cloudCredentials->getCloudKey(), - 'secret' => $this->cloudCredentials->getCloudSecret(), + 'accessToken' => $this->cloudCredentials->getCloudAccessToken(), + 'accessTokenExpiry' => $this->cloudCredentials->getCloudAccessTokenExpiry(), + 'key' => $this->cloudCredentials->getCloudKey(), + 'secret' => $this->cloudCredentials->getCloudSecret(), ] ); $connector = $connectorFactory->createConnector(); @@ -152,10 +152,10 @@ public function testExpiredAccessToken(): void self::setAccessTokenEnvVars(true); $connectorFactory = new ConnectorFactory( [ - 'accessToken' => $this->cloudCredentials->getCloudAccessToken(), - 'accessTokenExpiry' => $this->cloudCredentials->getCloudAccessTokenExpiry(), - 'key' => null, - 'secret' => null, + 'accessToken' => $this->cloudCredentials->getCloudAccessToken(), + 'accessTokenExpiry' => $this->cloudCredentials->getCloudAccessTokenExpiry(), + 'key' => null, + 'secret' => null, ] ); $connector = $connectorFactory->createConnector(); @@ -167,9 +167,9 @@ public function testConnectorConfig(): void self::setAccessTokenEnvVars(); $connectorFactory = new ConnectorFactory( [ - 'accessToken' => null, - 'key' => $this->cloudCredentials->getCloudKey(), - 'secret' => $this->cloudCredentials->getCloudSecret(), + 'accessToken' => null, + 'key' => $this->cloudCredentials->getCloudKey(), + 'secret' => $this->cloudCredentials->getCloudSecret(), ] ); $clientService = new ClientService($connectorFactory, $this->application, $this->cloudCredentials); @@ -186,9 +186,9 @@ public function testIdeHeader(): void IdeHelper::setCloudIdeEnvVars(); $connectorFactory = new ConnectorFactory( [ - 'accessToken' => null, - 'key' => $this->cloudCredentials->getCloudKey(), - 'secret' => $this->cloudCredentials->getCloudSecret(), + 'accessToken' => null, + 'key' => $this->cloudCredentials->getCloudKey(), + 'secret' => $this->cloudCredentials->getCloudSecret(), ] ); $clientService = new ClientService($connectorFactory, $this->application, $this->cloudCredentials); diff --git a/tests/phpunit/src/CloudApi/AcsfClientServiceTest.php b/tests/phpunit/src/CloudApi/AcsfClientServiceTest.php index b66b814da..087cb3e91 100644 --- a/tests/phpunit/src/CloudApi/AcsfClientServiceTest.php +++ b/tests/phpunit/src/CloudApi/AcsfClientServiceTest.php @@ -23,14 +23,14 @@ class AcsfClientServiceTest extends TestBase public function providerTestIsMachineAuthenticated(): array { return [ - [ - ['ACLI_ACCESS_TOKEN' => null, 'ACLI_KEY' => null, 'ACLI_SECRET' => null], - false, - ], - [ - ['ACLI_ACCESS_TOKEN' => null, 'ACLI_KEY' => 'key', 'ACLI_SECRET' => null], - false, - ], + [ + ['ACLI_ACCESS_TOKEN' => null, 'ACLI_KEY' => null, 'ACLI_SECRET' => null], + false, + ], + [ + ['ACLI_ACCESS_TOKEN' => null, 'ACLI_KEY' => 'key', 'ACLI_SECRET' => null], + false, + ], ]; } diff --git a/tests/phpunit/src/CloudApi/ClientServiceTest.php b/tests/phpunit/src/CloudApi/ClientServiceTest.php index 4ecac1dfa..fbf31875a 100644 --- a/tests/phpunit/src/CloudApi/ClientServiceTest.php +++ b/tests/phpunit/src/CloudApi/ClientServiceTest.php @@ -18,22 +18,22 @@ class ClientServiceTest extends TestBase public function providerTestIsMachineAuthenticated(): array { return [ - [ - ['ACLI_ACCESS_TOKEN' => 'token', 'ACLI_KEY' => 'key', 'ACLI_SECRET' => 'secret'], - true, - ], - [ - ['ACLI_ACCESS_TOKEN' => null, 'ACLI_KEY' => 'key', 'ACLI_SECRET' => 'secret'], - true, - ], - [ - ['ACLI_ACCESS_TOKEN' => null, 'ACLI_KEY' => null, 'ACLI_SECRET' => null], - false, - ], - [ - ['ACLI_ACCESS_TOKEN' => null, 'ACLI_KEY' => 'key', 'ACLI_SECRET' => null], - false, - ], + [ + ['ACLI_ACCESS_TOKEN' => 'token', 'ACLI_KEY' => 'key', 'ACLI_SECRET' => 'secret'], + true, + ], + [ + ['ACLI_ACCESS_TOKEN' => null, 'ACLI_KEY' => 'key', 'ACLI_SECRET' => 'secret'], + true, + ], + [ + ['ACLI_ACCESS_TOKEN' => null, 'ACLI_KEY' => null, 'ACLI_SECRET' => null], + false, + ], + [ + ['ACLI_ACCESS_TOKEN' => null, 'ACLI_KEY' => 'key', 'ACLI_SECRET' => null], + false, + ], ]; } diff --git a/tests/phpunit/src/CommandTestBase.php b/tests/phpunit/src/CommandTestBase.php index 1a7a36ea5..15a7a868e 100644 --- a/tests/phpunit/src/CommandTestBase.php +++ b/tests/phpunit/src/CommandTestBase.php @@ -212,13 +212,13 @@ protected static function inputChooseEnvironment(): array { return [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, // Would you like to link the project at ... ? - 'n', + 'n', // Choose an Acquia environment: - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, ]; } @@ -557,18 +557,18 @@ protected function getApiCommandByName(string $name): ApiBaseCommand|null protected function getMockedGitLabProject(mixed $projectId): array { return [ - 'default_branch' => 'master', - 'description' => '', - 'http_url_to_repo' => 'https://code.cloudservices.acquia.io/matthew.grasmick/codestudiodemo.git', - 'id' => $projectId, - 'name' => 'codestudiodemo', - 'name_with_namespace' => 'Matthew Grasmick / codestudiodemo', - 'path' => 'codestudiodemo', - 'path_with_namespace' => 'matthew.grasmick/codestudiodemo', - 'topics' => [ - 0 => 'Acquia Cloud Application', - ], - 'web_url' => 'https://code.cloudservices.acquia.io/matthew.grasmick/codestudiodemo', + 'default_branch' => 'master', + 'description' => '', + 'http_url_to_repo' => 'https://code.cloudservices.acquia.io/matthew.grasmick/codestudiodemo.git', + 'id' => $projectId, + 'name' => 'codestudiodemo', + 'name_with_namespace' => 'Matthew Grasmick / codestudiodemo', + 'path' => 'codestudiodemo', + 'path_with_namespace' => 'matthew.grasmick/codestudiodemo', + 'topics' => [ + 0 => 'Acquia Cloud Application', + ], + 'web_url' => 'https://code.cloudservices.acquia.io/matthew.grasmick/codestudiodemo', ]; } @@ -589,11 +589,11 @@ protected function mockGitlabGetToken(mixed $localMachineHelper, string $gitlabT $process = $this->mockProcess($success); $process->getOutput()->willReturn($gitlabToken); $localMachineHelper->execute([ - 'glab', - 'config', - 'get', - 'token', - '--host=' . $gitlabHost, + 'glab', + 'config', + 'get', + 'token', + '--host=' . $gitlabHost, ], null, null, false)->willReturn($process->reveal()); } @@ -602,10 +602,10 @@ protected function mockGitlabGetHost(mixed $localMachineHelper, string $gitlabHo $process = $this->mockProcess(); $process->getOutput()->willReturn($gitlabHost); $localMachineHelper->execute([ - 'glab', - 'config', - 'get', - 'host', + 'glab', + 'config', + 'get', + 'host', ], null, null, false)->willReturn($process->reveal()); } @@ -613,45 +613,45 @@ protected function mockGitLabUsersMe(ObjectProphecy|\Gitlab\Client $gitlabClient { $users = $this->prophet->prophesize(Users::class); $me = [ - 'avatar_url' => 'https://secure.gravatar.com/avatar/5ee7b8ad954bf7156e6eb57a45d60dec?s=80&d=identicon', - 'bio' => '', - 'bot' => false, - 'can_create_group' => true, - 'can_create_project' => true, - 'color_scheme_id' => 1, - 'commit_email' => 'matthew.grasmick@acquia.com', - 'confirmed_at' => '2021-12-21T02:26:51.898Z', - 'created_at' => '2021-12-21T02:26:52.240Z', - 'current_sign_in_at' => '2022-01-22T01:40:55.418Z', - 'email' => 'matthew.grasmick@acquia.com', - 'external' => false, - 'followers' => 0, - 'following' => 0, - 'id' => 20, - 'identities' => [], - 'is_admin' => true, - 'job_title' => '', - 'last_activity_on' => '2022-01-22', - 'last_sign_in_at' => '2022-01-21T23:00:49.035Z', - 'linkedin' => '', - 'local_time' => '2:00 AM', - 'location' => null, - 'name' => 'Matthew Grasmick', - 'note' => '', - 'organization' => null, - 'private_profile' => false, - 'projects_limit' => 100000, - 'pronouns' => null, - 'public_email' => '', - 'skype' => '', - 'state' => 'active', - 'theme_id' => 1, - 'twitter' => '', - 'two_factor_enabled' => false, - 'username' => 'matthew.grasmick', - 'website_url' => '', - 'web_url' => 'https://code.dev.cloudservices.acquia.io/matthew.grasmick', - 'work_information' => null, + 'avatar_url' => 'https://secure.gravatar.com/avatar/5ee7b8ad954bf7156e6eb57a45d60dec?s=80&d=identicon', + 'bio' => '', + 'bot' => false, + 'can_create_group' => true, + 'can_create_project' => true, + 'color_scheme_id' => 1, + 'commit_email' => 'matthew.grasmick@acquia.com', + 'confirmed_at' => '2021-12-21T02:26:51.898Z', + 'created_at' => '2021-12-21T02:26:52.240Z', + 'current_sign_in_at' => '2022-01-22T01:40:55.418Z', + 'email' => 'matthew.grasmick@acquia.com', + 'external' => false, + 'followers' => 0, + 'following' => 0, + 'id' => 20, + 'identities' => [], + 'is_admin' => true, + 'job_title' => '', + 'last_activity_on' => '2022-01-22', + 'last_sign_in_at' => '2022-01-21T23:00:49.035Z', + 'linkedin' => '', + 'local_time' => '2:00 AM', + 'location' => null, + 'name' => 'Matthew Grasmick', + 'note' => '', + 'organization' => null, + 'private_profile' => false, + 'projects_limit' => 100000, + 'pronouns' => null, + 'public_email' => '', + 'skype' => '', + 'state' => 'active', + 'theme_id' => 1, + 'twitter' => '', + 'two_factor_enabled' => false, + 'username' => 'matthew.grasmick', + 'website_url' => '', + 'web_url' => 'https://code.dev.cloudservices.acquia.io/matthew.grasmick', + 'work_information' => null, ]; $users->me()->willReturn($me); $gitlabClient->users()->willReturn($users->reveal()); @@ -690,29 +690,29 @@ protected function mockGetGitLabProjects(mixed $applicationUuid, mixed $gitlabPr protected function getMockGitLabVariables(): array { return [ - 0 => [ - 'environment_scope' => '*', - 'key' => 'ACQUIA_APPLICATION_UUID', - 'masked' => true, - 'protected' => false, - 'value' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', - 'variable_type' => 'env_var', - ], - 1 => [ - 'environment_scope' => '*', - 'key' => 'ACQUIA_CLOUD_API_TOKEN_KEY', - 'masked' => true, - 'protected' => false, - 'value' => '17feaf34-5d04-402b-9a67-15d5161d24e1', - 'variable_type' => 'env_var', - ], - 2 => [ - 'key' => 'ACQUIA_CLOUD_API_TOKEN_SECRET', - 'masked' => false, - 'protected' => false, - 'value' => 'X1u\/PIQXtYaoeui.4RJSJpGZjwmWYmfl5AUQkAebYE=', - 'variable_type' => 'env_var', - ], + 0 => [ + 'environment_scope' => '*', + 'key' => 'ACQUIA_APPLICATION_UUID', + 'masked' => true, + 'protected' => false, + 'value' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', + 'variable_type' => 'env_var', + ], + 1 => [ + 'environment_scope' => '*', + 'key' => 'ACQUIA_CLOUD_API_TOKEN_KEY', + 'masked' => true, + 'protected' => false, + 'value' => '17feaf34-5d04-402b-9a67-15d5161d24e1', + 'variable_type' => 'env_var', + ], + 2 => [ + 'key' => 'ACQUIA_CLOUD_API_TOKEN_SECRET', + 'masked' => false, + 'protected' => false, + 'value' => 'X1u\/PIQXtYaoeui.4RJSJpGZjwmWYmfl5AUQkAebYE=', + 'variable_type' => 'env_var', + ], ]; } @@ -726,8 +726,8 @@ final public static function assertStringContainsStringIgnoringLineEndings(strin $haystack = strtr( $haystack, [ - "\r" => "\n", - "\r\n" => "\n", + "\r" => "\n", + "\r\n" => "\n", ] ); static::assertThat($haystack, new StringContains($needle, false), $message); diff --git a/tests/phpunit/src/Commands/Acsf/AcsfApiCommandTest.php b/tests/phpunit/src/Commands/Acsf/AcsfApiCommandTest.php index 428ed6b02..6790e484e 100644 --- a/tests/phpunit/src/Commands/Acsf/AcsfApiCommandTest.php +++ b/tests/phpunit/src/Commands/Acsf/AcsfApiCommandTest.php @@ -42,10 +42,10 @@ public function testAcsfCommandExecutionForHttpPostWithMultipleDataTypes(): void $this->clientProphecy->addOption('json', ["uids" => ["1", "2", "3"]])->shouldBeCalled(); $this->command = $this->getApiCommandByName('acsf:groups:add-members'); $this->executeCommand([ - 'uids' => '1,2,3', + 'uids' => '1,2,3', ], [ // group_id. - '1', + '1', ]); // Assert. @@ -60,7 +60,7 @@ public function testAcsfCommandExecutionBool(): void $this->command = $this->getApiCommandByName('acsf:updates:pause'); $this->executeCommand([], [ // Pause. - '1', + '1', ]); // Assert. @@ -90,12 +90,12 @@ public function testAcsfCommandExecutionForHttpGet(): void public function providerTestAcsfCommandExecutionForHttpGetMultiple(): array { return [ - ['get', '/api/v1/audit', '/api/v1/audit', 'acsf:info:audit-events-find', [], []], - ['post', '/api/v1/sites', '/api/v1/sites', 'acsf:sites:create', ['site_name' => 'foobar', '--stack_id' => '1', 'group_ids' => ['91,81']], ['site_name' => 'foobar', 'stack_id' => '1', 'group_ids' => [91, 81]]], - ['post', '/api/v1/sites', '/api/v1/sites', 'acsf:sites:create', ['site_name' => 'foobar', '--stack_id' => '1', 'group_ids' => ['91','81']], ['site_name' => 'foobar', 'stack_id' => '1', 'group_ids' => [91, 81]]], - ['post', '/api/v1/sites/{site_id}/backup', '/api/v1/sites/1/backup', 'acsf:sites:backup', ['--label' => 'foo', 'site_id' => '1'], ['label' => 'foo']], - ['post', '/api/v1/groups/{group_id}/members', '/api/v1/groups/2/members', 'acsf:groups:add-members', ['group_id' => '2', 'uids' => '1'], ['group_id' => 'foo', 'uids' => 1]], - ['post', '/api/v1/groups/{group_id}/members', '/api/v1/groups/2/members', 'acsf:groups:add-members', ['group_id' => '2', 'uids' => '1,3'], ['group_id' => 'foo', 'uids' => [1, 3]]], + ['get', '/api/v1/audit', '/api/v1/audit', 'acsf:info:audit-events-find', [], []], + ['post', '/api/v1/sites', '/api/v1/sites', 'acsf:sites:create', ['site_name' => 'foobar', '--stack_id' => '1', 'group_ids' => ['91,81']], ['site_name' => 'foobar', 'stack_id' => '1', 'group_ids' => [91, 81]]], + ['post', '/api/v1/sites', '/api/v1/sites', 'acsf:sites:create', ['site_name' => 'foobar', '--stack_id' => '1', 'group_ids' => ['91','81']], ['site_name' => 'foobar', 'stack_id' => '1', 'group_ids' => [91, 81]]], + ['post', '/api/v1/sites/{site_id}/backup', '/api/v1/sites/1/backup', 'acsf:sites:backup', ['--label' => 'foo', 'site_id' => '1'], ['label' => 'foo']], + ['post', '/api/v1/groups/{group_id}/members', '/api/v1/groups/2/members', 'acsf:groups:add-members', ['group_id' => '2', 'uids' => '1'], ['group_id' => 'foo', 'uids' => 1]], + ['post', '/api/v1/groups/{group_id}/members', '/api/v1/groups/2/members', 'acsf:groups:add-members', ['group_id' => '2', 'uids' => '1,3'], ['group_id' => 'foo', 'uids' => [1, 3]]], ]; } @@ -126,7 +126,7 @@ public function testAcsfUnauthenticatedFailure(): void $inputs = [ // Would you like to share anonymous performance usage and data? - 'n', + 'n', ]; $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('This machine is not yet authenticated with Site Factory.'); diff --git a/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php b/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php index bab52a8ac..b5e777d50 100644 --- a/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php +++ b/tests/phpunit/src/Commands/Acsf/AcsfAuthLoginCommandTest.php @@ -28,63 +28,63 @@ public function providerTestAuthLoginCommand(): array { return [ // Data set 0. - [ + [ // $machineIsAuthenticated - false, + false, // $inputs - [ + [ // Would you like to share anonymous performance usage and data? (yes/no) [yes]. - 'yes', + 'yes', // Enter the full URL of the factory. - $this->acsfCurrentFactoryUrl, + $this->acsfCurrentFactoryUrl, // Enter a value for username. - $this->acsfUsername, + $this->acsfUsername, // Enter a value for key. - $this->acsfKey, - ], - // No arguments, all interactive. - [], - // Output to assert. - 'Saved credentials', - ], - // Data set 1. - [ - // $machineIsAuthenticated - false, - // $inputs - [], - // Arguments. - [ - // Enter the full URL of the factory. - '--factory-url' => $this->acsfCurrentFactoryUrl, - // Enter a value for key. - '--key' => $this->acsfKey, - // Enter a value for username. - '--username' => $this->acsfUsername, - ], - // Output to assert. - 'Saved credentials', - // $config. - $this->getAcsfCredentialsFileContents(), - ], - // Data set 2. - [ - // $machineIsAuthenticated - true, - // $inputs - [ - // Choose a factory to log in to. - $this->acsfCurrentFactoryUrl, - // Choose which user to log in as. - $this->acsfUsername, - ], - // Arguments. - [], - // Output to assert. - "Acquia CLI is now logged in to $this->acsfCurrentFactoryUrl as $this->acsfUsername", - // $config. - $this->getAcsfCredentialsFileContents(), - ], + $this->acsfKey, + ], + // No arguments, all interactive. + [], + // Output to assert. + 'Saved credentials', + ], + // Data set 1. + [ + // $machineIsAuthenticated + false, + // $inputs + [], + // Arguments. + [ + // Enter the full URL of the factory. + '--factory-url' => $this->acsfCurrentFactoryUrl, + // Enter a value for key. + '--key' => $this->acsfKey, + // Enter a value for username. + '--username' => $this->acsfUsername, + ], + // Output to assert. + 'Saved credentials', + // $config. + $this->getAcsfCredentialsFileContents(), + ], + // Data set 2. + [ + // $machineIsAuthenticated + true, + // $inputs + [ + // Choose a factory to log in to. + $this->acsfCurrentFactoryUrl, + // Choose which user to log in as. + $this->acsfUsername, + ], + // Arguments. + [], + // Output to assert. + "Acquia CLI is now logged in to $this->acsfCurrentFactoryUrl as $this->acsfUsername", + // $config. + $this->getAcsfCredentialsFileContents(), + ], ]; } diff --git a/tests/phpunit/src/Commands/Acsf/AcsfAuthLogoutCommandTest.php b/tests/phpunit/src/Commands/Acsf/AcsfAuthLogoutCommandTest.php index ca790931a..560b6c18f 100644 --- a/tests/phpunit/src/Commands/Acsf/AcsfAuthLogoutCommandTest.php +++ b/tests/phpunit/src/Commands/Acsf/AcsfAuthLogoutCommandTest.php @@ -28,24 +28,24 @@ public function providerTestAuthLogoutCommand(): array { return [ // Data set 0. - [ + [ // $machineIsAuthenticated - false, + false, // $inputs - [], - ], - // Data set 1. - [ - // $machineIsAuthenticated - true, - // $inputs - [ - // Choose a Factory to logout of. - 0, - ], - // $config. - $this->getAcsfCredentialsFileContents(), - ], + [], + ], + // Data set 1. + [ + // $machineIsAuthenticated + true, + // $inputs + [ + // Choose a Factory to logout of. + 0, + ], + // $config. + $this->getAcsfCredentialsFileContents(), + ], ]; } diff --git a/tests/phpunit/src/Commands/Acsf/AcsfCommandTestBase.php b/tests/phpunit/src/Commands/Acsf/AcsfCommandTestBase.php index 826d227c4..98dd15d10 100644 --- a/tests/phpunit/src/Commands/Acsf/AcsfCommandTestBase.php +++ b/tests/phpunit/src/Commands/Acsf/AcsfCommandTestBase.php @@ -31,20 +31,20 @@ abstract class AcsfCommandTestBase extends CommandTestBase protected function getAcsfCredentialsFileContents(): array { return [ - 'acsf_active_factory' => $this->acsfCurrentFactoryUrl, - 'acsf_factories' => [ - $this->acsfCurrentFactoryUrl => [ - 'active_user' => $this->acsfActiveUser, - 'url' => $this->acsfCurrentFactoryUrl, - 'users' => [ - $this->acsfUsername => [ - 'key' => $this->acsfKey, - 'username' => $this->acsfUsername, - ], - ], - ], - ], - DataStoreContract::SEND_TELEMETRY => false, + 'acsf_active_factory' => $this->acsfCurrentFactoryUrl, + 'acsf_factories' => [ + $this->acsfCurrentFactoryUrl => [ + 'active_user' => $this->acsfActiveUser, + 'url' => $this->acsfCurrentFactoryUrl, + 'users' => [ + $this->acsfUsername => [ + 'key' => $this->acsfKey, + 'username' => $this->acsfUsername, + ], + ], + ], + ], + DataStoreContract::SEND_TELEMETRY => false, ]; } } diff --git a/tests/phpunit/src/Commands/Api/ApiCommandTest.php b/tests/phpunit/src/Commands/Api/ApiCommandTest.php index 7bf45b3bf..557e2ff01 100644 --- a/tests/phpunit/src/Commands/Api/ApiCommandTest.php +++ b/tests/phpunit/src/Commands/Api/ApiCommandTest.php @@ -37,8 +37,8 @@ public function testArgumentsInteraction(): void { $this->command = $this->getApiCommandByName('api:environments:log-download'); $this->executeCommand([], [ - '289576-53785bca-1946-4adc-a022-e50d24686c20', - 'apache-access', + '289576-53785bca-1946-4adc-a022-e50d24686c20', + 'apache-access', ]); $output = $this->getDisplay(); $this->assertStringContainsString('Enter a value for environmentId', $output); @@ -53,9 +53,9 @@ public function testArgumentsInteractionValidation(): void $this->command = $this->getApiCommandByName('api:environments:variable-update'); try { $this->executeCommand([], [ - '289576-53785bca-1946-4adc-a022-e50d24686c20', - 'AH_SOMETHING', - 'AH_SOMETHING', + '289576-53785bca-1946-4adc-a022-e50d24686c20', + 'AH_SOMETHING', + 'AH_SOMETHING', ]); } catch (MissingInputException) { } @@ -68,7 +68,7 @@ public function testArgumentsInteractionValidationFormat(): void $this->command = $this->getApiCommandByName('api:notifications:find'); try { $this->executeCommand([], [ - 'test', + 'test', ]); } catch (MissingInputException) { } @@ -93,11 +93,11 @@ public function testApiCommandErrorResponse(): void $this->executeCommand(['applicationUuid' => $invalidUuid], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - '0', + '0', // Would you like to link the Cloud application Sample application to this repository? - 'n', + 'n', ]); // Assert. @@ -135,8 +135,8 @@ public function testObjectParam(): void $this->mockRequest('putEnvironmentCloudActions', '24-a47ac10b-58cc-4372-a567-0e02b2c3d470'); $this->command = $this->getApiCommandByName('api:environments:cloud-actions-update'); $this->executeCommand([ - 'cloud-actions' => '{"fb4aa87a-8be2-42c6-bdf0-ef9d09a3de70":true}', - 'environmentId' => '24-a47ac10b-58cc-4372-a567-0e02b2c3d470', + 'cloud-actions' => '{"fb4aa87a-8be2-42c6-bdf0-ef9d09a3de70":true}', + 'environmentId' => '24-a47ac10b-58cc-4372-a567-0e02b2c3d470', ]); $output = $this->getDisplay(); $this->assertStringContainsString('Cloud Actions have been updated.', $output); @@ -150,11 +150,11 @@ public function testInferApplicationUuidArgument(): void $this->command = $this->getApiCommandByName('api:applications:find'); $this->executeCommand([], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - '0', + '0', // Would you like to link the Cloud application Sample application to this repository? - 'n', + 'n', ]); // Assert. @@ -170,8 +170,8 @@ public function testInferApplicationUuidArgument(): void public function providerTestConvertApplicationAliasToUuidArgument(): array { return [ - [false], - [true], + [false], + [true], ]; } @@ -202,11 +202,11 @@ public function testConvertApplicationAliasToUuidArgument(bool $support): void $this->executeCommand(['applicationUuid' => $alias], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, // Would you like to link the Cloud application Sample application to this repository? - 'n', + 'n', ]); // Assert. @@ -279,11 +279,11 @@ public function testConvertEnvironmentAliasToUuidArgument(): void $this->executeCommand(['environmentId' => $alias], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - '0', + '0', // Would you like to link the Cloud application Sample application to this repository? - 'n', + 'n', ]); // Assert. @@ -363,12 +363,12 @@ public function providerTestApiCommandDefinitionParameters(): array { $apiAccountsSshKeysListUsage = '--from="-7d" --to="-1d" --sort="field1,-field2" --limit="10" --offset="10"'; return [ - ['0', 'api:accounts:ssh-keys-list', 'get', $apiAccountsSshKeysListUsage], - ['1', 'api:accounts:ssh-keys-list', 'get', $apiAccountsSshKeysListUsage], - ['1', 'api:accounts:ssh-keys-list', 'get', $apiAccountsSshKeysListUsage], - ['1', 'api:environments:domain-clear-caches', 'post', '12-d314739e-296f-11e9-b210-d663bd873d93 example.com'], - ['1', 'api:applications:find', 'get', 'da1c0a8e-ff69-45db-88fc-acd6d2affbb7'], - ['1', 'api:applications:find', 'get', 'myapp'], + ['0', 'api:accounts:ssh-keys-list', 'get', $apiAccountsSshKeysListUsage], + ['1', 'api:accounts:ssh-keys-list', 'get', $apiAccountsSshKeysListUsage], + ['1', 'api:accounts:ssh-keys-list', 'get', $apiAccountsSshKeysListUsage], + ['1', 'api:environments:domain-clear-caches', 'post', '12-d314739e-296f-11e9-b210-d663bd873d93 example.com'], + ['1', 'api:applications:find', 'get', 'da1c0a8e-ff69-45db-88fc-acd6d2affbb7'], + ['1', 'api:applications:find', 'get', 'myapp'], ]; } @@ -415,8 +415,8 @@ public function testModifiedParameterDescriptions(): void public function providerTestApiCommandDefinitionRequestBody(): array { return [ - ['api:accounts:ssh-key-create', 'post', 'api:accounts:ssh-key-create "mykey" "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQChwPHzTTDKDpSbpa2+d22LcbQmsw92eLsUK3Fmei1fiGDkd34NsYCN8m7lsi3NbvdMS83CtPQPWiCveYPzFs1/hHc4PYj8opD2CNnr5iWVVbyaulCYHCgVv4aB/ojcexg8q483A4xJeF15TiCr/gu34rK6ucTvC/tn/rCwJBudczvEwt0klqYwv8Cl/ytaQboSuem5KgSjO3lMrb6CWtfSNhE43ZOw+UBFBqxIninN868vGMkIv9VY34Pwj54rPn/ItQd6Ef4B0KHHaGmzK0vfP+AK7FxNMoHnj3iYT33KZNqtDozdn5tYyH/bThPebEtgqUn+/w5l6wZIC/8zzvls/127ngHk+jNa0PlNyS2TxhPUK4NaPHIEnnrlp07JEYC4ImcBjaYCWAdcTcUkcJjwZQkN4bGmyO9cjICH98SdLD/HxqzTHeaYDbAX/Hu9HfaBb5dXLWsjw3Xc6hoVnUUZbMQyfgb0KgxDLh92eNGxJkpZiL0VDNOWCxDWsNpzwhLNkLqCvI6lyxiLaUzvJAk6dPaRhExmCbU1lDO2eR0FdSwC1TEhJOT9eDIK1r2hztZKs2oa5FNFfB/IFHVWasVFC9N2h/r/egB5zsRxC9MqBLRBq95NBxaRSFng6ML5WZSw41Qi4C/JWVm89rdj2WqScDHYyAdwyyppWU4T5c9Fmw== example@example.com"'], - ['api:environments:file-copy', 'post', '12-d314739e-296f-11e9-b210-d663bd873d93 --source="14-0c7e79ab-1c4a-424e-8446-76ae8be7e851"'], + ['api:accounts:ssh-key-create', 'post', 'api:accounts:ssh-key-create "mykey" "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQChwPHzTTDKDpSbpa2+d22LcbQmsw92eLsUK3Fmei1fiGDkd34NsYCN8m7lsi3NbvdMS83CtPQPWiCveYPzFs1/hHc4PYj8opD2CNnr5iWVVbyaulCYHCgVv4aB/ojcexg8q483A4xJeF15TiCr/gu34rK6ucTvC/tn/rCwJBudczvEwt0klqYwv8Cl/ytaQboSuem5KgSjO3lMrb6CWtfSNhE43ZOw+UBFBqxIninN868vGMkIv9VY34Pwj54rPn/ItQd6Ef4B0KHHaGmzK0vfP+AK7FxNMoHnj3iYT33KZNqtDozdn5tYyH/bThPebEtgqUn+/w5l6wZIC/8zzvls/127ngHk+jNa0PlNyS2TxhPUK4NaPHIEnnrlp07JEYC4ImcBjaYCWAdcTcUkcJjwZQkN4bGmyO9cjICH98SdLD/HxqzTHeaYDbAX/Hu9HfaBb5dXLWsjw3Xc6hoVnUUZbMQyfgb0KgxDLh92eNGxJkpZiL0VDNOWCxDWsNpzwhLNkLqCvI6lyxiLaUzvJAk6dPaRhExmCbU1lDO2eR0FdSwC1TEhJOT9eDIK1r2hztZKs2oa5FNFfB/IFHVWasVFC9N2h/r/egB5zsRxC9MqBLRBq95NBxaRSFng6ML5WZSw41Qi4C/JWVm89rdj2WqScDHYyAdwyyppWU4T5c9Fmw== example@example.com"'], + ['api:environments:file-copy', 'post', '12-d314739e-296f-11e9-b210-d663bd873d93 --source="14-0c7e79ab-1c4a-424e-8446-76ae8be7e851"'], ]; } @@ -465,8 +465,8 @@ public function testOrganizationMemberDeleteByUserUuid(): void $this->command = $this->getApiCommandByName('api:organizations:member-delete'); $this->executeCommand( [ - 'organizationUuid' => $orgId, - 'userUuid' => $memberUuid, + 'organizationUuid' => $orgId, + 'userUuid' => $memberUuid, ], ); @@ -493,8 +493,8 @@ public function testOrganizationMemberDeleteByUserEmail(): void $this->command = $this->getApiCommandByName('api:organizations:member-delete'); $this->executeCommand( [ - 'organizationUuid' => $orgId, - 'userUuid' => $memberMail, + 'organizationUuid' => $orgId, + 'userUuid' => $memberMail, ], ); @@ -521,8 +521,8 @@ public function testOrganizationMemberDeleteInvalidEmail(): void $this->expectExceptionMessage('No matching user found in this organization'); $this->executeCommand( [ - 'organizationUuid' => $orgId, - 'userUuid' => $memberUuid, + 'organizationUuid' => $orgId, + 'userUuid' => $memberUuid, ], ); } @@ -543,8 +543,8 @@ public function testOrganizationMemberDeleteNoMembers(): void $this->expectExceptionMessage('Organization has no members'); $this->executeCommand( [ - 'organizationUuid' => $orgId, - 'userUuid' => $memberUuid, + 'organizationUuid' => $orgId, + 'userUuid' => $memberUuid, ], ); } diff --git a/tests/phpunit/src/Commands/App/AppVcsInfoTest.php b/tests/phpunit/src/Commands/App/AppVcsInfoTest.php index 97f3b7a47..e057fc58e 100644 --- a/tests/phpunit/src/Commands/App/AppVcsInfoTest.php +++ b/tests/phpunit/src/Commands/App/AppVcsInfoTest.php @@ -40,7 +40,7 @@ public function testNoEnvAvailableCommand(): void $this->executeCommand( [ - 'applicationUuid' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', + 'applicationUuid' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', ], ); } @@ -65,7 +65,7 @@ public function testNoVcsAvailableCommand(): void $this->expectExceptionMessage('No branch or tag is available with this application.'); $this->executeCommand( [ - 'applicationUuid' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', + 'applicationUuid' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', ], ); } @@ -83,7 +83,7 @@ public function testShowVcsListCommand(): void $this->executeCommand( [ - 'applicationUuid' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', + 'applicationUuid' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', ], ); @@ -128,8 +128,8 @@ public function testNoDeployedVcs(): void $this->expectExceptionMessage('No branch or tag is deployed on any of the environment of this application.'); $this->executeCommand( [ - 'applicationUuid' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', - '--deployed', + 'applicationUuid' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', + '--deployed', ], ); } @@ -147,8 +147,8 @@ public function testListOnlyDeployedVcs(): void $this->executeCommand( [ - 'applicationUuid' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', - '--deployed', + 'applicationUuid' => 'a47ac10b-58cc-4372-a567-0e02b2c3d470', + '--deployed', ], ); diff --git a/tests/phpunit/src/Commands/App/From/AbandonmentRecommendationTest.php b/tests/phpunit/src/Commands/App/From/AbandonmentRecommendationTest.php index 78c9e9092..c7bed4ba6 100644 --- a/tests/phpunit/src/Commands/App/From/AbandonmentRecommendationTest.php +++ b/tests/phpunit/src/Commands/App/From/AbandonmentRecommendationTest.php @@ -21,12 +21,12 @@ protected function setUp(): void // @see \Acquia\Cli\Tests\Commands\App\From\DefinedRecommendationTest::getTestConfigurations() // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys $this->sut = DefinedRecommendation::createFromDefinition([ - 'package' => null, - 'note' => 'Example: The module bar is no longer required because its functionality has been incorporated into Drupal core.', - 'replaces' => [ - 'name' => 'bar', - ], - 'vetted' => true, + 'package' => null, + 'note' => 'Example: The module bar is no longer required because its functionality has been incorporated into Drupal core.', + 'replaces' => [ + 'name' => 'bar', + ], + 'vetted' => true, ]); // phpcs:enable } diff --git a/tests/phpunit/src/Commands/App/From/ConfigurationTest.php b/tests/phpunit/src/Commands/App/From/ConfigurationTest.php index b7d6071ea..128b6ca55 100644 --- a/tests/phpunit/src/Commands/App/From/ConfigurationTest.php +++ b/tests/phpunit/src/Commands/App/From/ConfigurationTest.php @@ -37,8 +37,8 @@ public function test(string $configuration, Exception $expected_exception): void public function getTestConfigurations(): array { return [ - 'bad JSON in configuration file' => ['{,}', new JsonException('Syntax error', JSON_ERROR_SYNTAX)], - 'empty configuration file' => [json_encode((object) []), new DomainException('Missing required key: rootPackageDefinition')], + 'bad JSON in configuration file' => ['{,}', new JsonException('Syntax error', JSON_ERROR_SYNTAX)], + 'empty configuration file' => [json_encode((object) []), new DomainException('Missing required key: rootPackageDefinition')], ]; } } diff --git a/tests/phpunit/src/Commands/App/From/DefinedRecommendationTest.php b/tests/phpunit/src/Commands/App/From/DefinedRecommendationTest.php index 7f4c1511b..36e09b5ac 100755 --- a/tests/phpunit/src/Commands/App/From/DefinedRecommendationTest.php +++ b/tests/phpunit/src/Commands/App/From/DefinedRecommendationTest.php @@ -51,127 +51,127 @@ public function getTestConfigurations(): array { // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys return [ - 'config is not array' => [42, new NoRecommendation()], - 'empty array' => [[], new NoRecommendation()], - 'missing required key' => [ - ['package' => '', 'constraint' => ''], - new NoRecommendation(), - ], - 'key value does not match schema' => [ - ['package' => 42, 'constraint' => '', 'replaces' => ['name' => '']], - new NoRecommendation(), - ], - 'nested key value does not match schema' => [ - ['package' => '', 'constraint' => '', 'replaces' => ['name' => 42]], - new NoRecommendation(), - ], - 'invalid patches key' => [ - [ - 'package' => 'foo', - 'constraint' => '^1.42', - 'patches' => [ - 0 => 'https://example.com', - ], - 'replaces' => [ - 'name' => 'foo', - ], - ], - new NoRecommendation(), - ], - 'invalid patches key value' => [ - [ - 'package' => 'foo', - 'constraint' => '^1.42', - 'patches' => [ - 'A patch description' => true, - ], - 'replaces' => [ - 'name' => 'foo', - ], - ], - new NoRecommendation(), - ], - 'missing replaces key, not universal by default' => [ - [ - 'package' => 'foo', - 'constraint' => '^1.42', - ], - new NoRecommendation(), - ], - 'missing replaces key, explicitly not universal' => [ - [ - 'universal' => false, - 'package' => 'foo', - 'constraint' => '^1.42', - ], - new NoRecommendation(), - ], - 'valid config; does not apply' => [ - [ - 'package' => 'foo', - 'constraint' => '^1.42', - 'replaces' => [ - 'name' => 'foo', - ], - ], - new TestRecommendation(false, 'foo', '^1.42'), - ], - 'valid config; does apply; missing replaces key but universal is true' => [ - [ - 'universal' => true, - 'package' => 'foo', - 'constraint' => '^1.42', - ], - new TestRecommendation(true, 'foo', '^1.42'), - ], - 'valid config; does apply; no patches key' => [ - [ - 'package' => 'foo', - 'constraint' => '^1.42', - 'replaces' => [ - 'name' => 'bar', - ], - ], - new TestRecommendation(true, 'foo', '^1.42'), - ], - 'valid config; does apply; empty patches value' => [ - [ - 'package' => 'foo', - 'constraint' => '^1.42', - 'patches' => [], - 'replaces' => [ - 'name' => 'bar', - ], - ], - new TestRecommendation(true, 'foo', '^1.42'), - ], - 'valid config; does apply; has patches' => [ - [ - 'package' => 'foo', - 'constraint' => '^1.42', - 'patches' => [ - 'A patch description' => 'https://example.com/example.patch', - ], - 'install' => ['foo'], - 'replaces' => [ - 'name' => 'bar', - ], - ], - new TestRecommendation(true, 'foo', '^1.42', ['foo'], false, [ - 'A patch description' => 'https://example.com/example.patch', - ]), - ], - 'valid config; does apply; has null package property' => [ - [ - 'package' => null, - 'note' => 'Example: The module bar is no longer required because its functionality has been incorporated into Drupal core.', - 'replaces' => [ - 'name' => 'bar', - ], - 'vetted' => true, - ], - new TestRecommendation(true, TestRecommendation::ABANDON), - ], + 'config is not array' => [42, new NoRecommendation()], + 'empty array' => [[], new NoRecommendation()], + 'missing required key' => [ + ['package' => '', 'constraint' => ''], + new NoRecommendation(), + ], + 'key value does not match schema' => [ + ['package' => 42, 'constraint' => '', 'replaces' => ['name' => '']], + new NoRecommendation(), + ], + 'nested key value does not match schema' => [ + ['package' => '', 'constraint' => '', 'replaces' => ['name' => 42]], + new NoRecommendation(), + ], + 'invalid patches key' => [ + [ + 'package' => 'foo', + 'constraint' => '^1.42', + 'patches' => [ + 0 => 'https://example.com', + ], + 'replaces' => [ + 'name' => 'foo', + ], + ], + new NoRecommendation(), + ], + 'invalid patches key value' => [ + [ + 'package' => 'foo', + 'constraint' => '^1.42', + 'patches' => [ + 'A patch description' => true, + ], + 'replaces' => [ + 'name' => 'foo', + ], + ], + new NoRecommendation(), + ], + 'missing replaces key, not universal by default' => [ + [ + 'package' => 'foo', + 'constraint' => '^1.42', + ], + new NoRecommendation(), + ], + 'missing replaces key, explicitly not universal' => [ + [ + 'universal' => false, + 'package' => 'foo', + 'constraint' => '^1.42', + ], + new NoRecommendation(), + ], + 'valid config; does not apply' => [ + [ + 'package' => 'foo', + 'constraint' => '^1.42', + 'replaces' => [ + 'name' => 'foo', + ], + ], + new TestRecommendation(false, 'foo', '^1.42'), + ], + 'valid config; does apply; missing replaces key but universal is true' => [ + [ + 'universal' => true, + 'package' => 'foo', + 'constraint' => '^1.42', + ], + new TestRecommendation(true, 'foo', '^1.42'), + ], + 'valid config; does apply; no patches key' => [ + [ + 'package' => 'foo', + 'constraint' => '^1.42', + 'replaces' => [ + 'name' => 'bar', + ], + ], + new TestRecommendation(true, 'foo', '^1.42'), + ], + 'valid config; does apply; empty patches value' => [ + [ + 'package' => 'foo', + 'constraint' => '^1.42', + 'patches' => [], + 'replaces' => [ + 'name' => 'bar', + ], + ], + new TestRecommendation(true, 'foo', '^1.42'), + ], + 'valid config; does apply; has patches' => [ + [ + 'package' => 'foo', + 'constraint' => '^1.42', + 'patches' => [ + 'A patch description' => 'https://example.com/example.patch', + ], + 'install' => ['foo'], + 'replaces' => [ + 'name' => 'bar', + ], + ], + new TestRecommendation(true, 'foo', '^1.42', ['foo'], false, [ + 'A patch description' => 'https://example.com/example.patch', + ]), + ], + 'valid config; does apply; has null package property' => [ + [ + 'package' => null, + 'note' => 'Example: The module bar is no longer required because its functionality has been incorporated into Drupal core.', + 'replaces' => [ + 'name' => 'bar', + ], + 'vetted' => true, + ], + new TestRecommendation(true, TestRecommendation::ABANDON), + ], ]; // phpcs:enable } diff --git a/tests/phpunit/src/Commands/App/From/ProjectBuilderTest.php b/tests/phpunit/src/Commands/App/From/ProjectBuilderTest.php index f9d1c8f2a..244611f39 100644 --- a/tests/phpunit/src/Commands/App/From/ProjectBuilderTest.php +++ b/tests/phpunit/src/Commands/App/From/ProjectBuilderTest.php @@ -35,29 +35,29 @@ public function getTestResources(): array { // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys $test_cases = [ - 'simplest case, sanity check' => [ - json_encode([ - 'sourceModules' => [], - 'filePaths' => [ - 'public' => 'sites/default/files', - 'private' => null, - ], - 'rootPackageDefinition' => [], - ]), - json_encode([ - 'data' => [], - ]), - [ - 'installModules' => [], - 'filePaths' => [ - 'public' => 'sites/default/files', - 'private' => null, - ], - 'sourceModules' => [], - 'recommendations' => [], - 'rootPackageDefinition' => [], - ], - ], + 'simplest case, sanity check' => [ + json_encode([ + 'sourceModules' => [], + 'filePaths' => [ + 'public' => 'sites/default/files', + 'private' => null, + ], + 'rootPackageDefinition' => [], + ]), + json_encode([ + 'data' => [], + ]), + [ + 'installModules' => [], + 'filePaths' => [ + 'public' => 'sites/default/files', + 'private' => null, + ], + 'sourceModules' => [], + 'recommendations' => [], + 'rootPackageDefinition' => [], + ], + ], ]; // phpcs:enable return array_map(function (array $data) { diff --git a/tests/phpunit/src/Commands/App/From/RecommendationsTest.php b/tests/phpunit/src/Commands/App/From/RecommendationsTest.php index 54e6007ca..e60d65c5a 100644 --- a/tests/phpunit/src/Commands/App/From/RecommendationsTest.php +++ b/tests/phpunit/src/Commands/App/From/RecommendationsTest.php @@ -52,40 +52,40 @@ public function getTestConfigurations(): array { // phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys return [ - 'bad JSON in configuration file' => [ - '{,}', - static::NO_RECOMMENDATIONS, - ], - 'empty configuration file' => [ - json_encode((object) []), - static::NO_RECOMMENDATIONS, - ], - 'unexpected recommendations value' => [ - json_encode(['data' => true]), - static::NO_RECOMMENDATIONS, - ], - 'empty recommendations key' => [ - json_encode(['data' => []]), - static::NO_RECOMMENDATIONS, - ], - 'populated recommendations key with invalid item' => [ - json_encode(['recommendations' => [[]]]), - static::NO_RECOMMENDATIONS, - ], - 'populated recommendations key with valid item' => [ - json_encode([ - 'data' => [ - [ - 'package' => 'foo', - 'constraint' => '^1.42', - 'replaces' => [ - 'name' => 'foo', - ], - ], - ], - ]), - new TestRecommendation(true, 'foo', '^1.42'), - ], + 'bad JSON in configuration file' => [ + '{,}', + static::NO_RECOMMENDATIONS, + ], + 'empty configuration file' => [ + json_encode((object) []), + static::NO_RECOMMENDATIONS, + ], + 'unexpected recommendations value' => [ + json_encode(['data' => true]), + static::NO_RECOMMENDATIONS, + ], + 'empty recommendations key' => [ + json_encode(['data' => []]), + static::NO_RECOMMENDATIONS, + ], + 'populated recommendations key with invalid item' => [ + json_encode(['recommendations' => [[]]]), + static::NO_RECOMMENDATIONS, + ], + 'populated recommendations key with valid item' => [ + json_encode([ + 'data' => [ + [ + 'package' => 'foo', + 'constraint' => '^1.42', + 'replaces' => [ + 'name' => 'foo', + ], + ], + ], + ]), + new TestRecommendation(true, 'foo', '^1.42'), + ], ]; // phpcs:enable } diff --git a/tests/phpunit/src/Commands/App/LinkCommandTest.php b/tests/phpunit/src/Commands/App/LinkCommandTest.php index 85a26744c..83ecfb901 100644 --- a/tests/phpunit/src/Commands/App/LinkCommandTest.php +++ b/tests/phpunit/src/Commands/App/LinkCommandTest.php @@ -26,9 +26,9 @@ public function testLinkCommand(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application. - 0, + 0, ]; $this->executeCommand([], $inputs); $output = $this->getDisplay(); diff --git a/tests/phpunit/src/Commands/App/LogTailCommandTest.php b/tests/phpunit/src/Commands/App/LogTailCommandTest.php index 6bd3d3a1e..dd9b3fd60 100644 --- a/tests/phpunit/src/Commands/App/LogTailCommandTest.php +++ b/tests/phpunit/src/Commands/App/LogTailCommandTest.php @@ -25,8 +25,8 @@ class LogTailCommandTest extends CommandTestBase public function providerLogTailCommand(): array { return [ - [0], - [null], + [0], + [null], ]; } @@ -64,15 +64,15 @@ public function testLogTailCommand(?int $stream): void $this->mockLogStreamRequest(); $this->executeCommand([], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select the application. - 0, + 0, // Would you like to link the project at ... ? - 'y', + 'y', // Select environment. - 0, + 0, // Select log. - $stream, + $stream, ]); // Assert. @@ -114,15 +114,15 @@ public function testLogTailNode(): void $this->expectExceptionMessage('No compatible environments found'); $this->executeCommand([], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select the application. - 0, + 0, // Would you like to link the project at ... ? - 'y', + 'y', // Select environment. - 0, + 0, // Select log. - 0, + 0, ]); } diff --git a/tests/phpunit/src/Commands/App/NewCommandTest.php b/tests/phpunit/src/Commands/App/NewCommandTest.php index 90b502fda..fe3499925 100644 --- a/tests/phpunit/src/Commands/App/NewCommandTest.php +++ b/tests/phpunit/src/Commands/App/NewCommandTest.php @@ -35,8 +35,8 @@ protected function createCommand(): CommandBase public function provideTestNewDrupalCommand(): array { return [ - [['acquia_drupal_recommended' => 'acquia/drupal-recommended-project']], - [['acquia_drupal_recommended' => 'acquia/drupal-recommended-project', 'test-dir']], + [['acquia_drupal_recommended' => 'acquia/drupal-recommended-project']], + [['acquia_drupal_recommended' => 'acquia/drupal-recommended-project', 'test-dir']], ]; } @@ -46,8 +46,8 @@ public function provideTestNewDrupalCommand(): array public function provideTestNewNextJsAppCommand(): array { return [ - [['acquia_next_acms' => 'acquia/next-acms']], - [['acquia_next_acms' => 'acquia/next-acms'], 'test-dir'], + [['acquia_next_acms' => 'acquia/next-acms']], + [['acquia_next_acms' => 'acquia/next-acms'], 'test-dir'], ]; } @@ -76,10 +76,10 @@ public function testNewDrupalCommand(array $package, string $directory = 'drupal $inputs = [ // Choose a starting project. - $project, + $project, ]; $this->executeCommand([ - 'directory' => $directory, + 'directory' => $directory, ], $inputs); $output = $this->getDisplay(); @@ -116,10 +116,10 @@ public function testNewNextJSAppCommand(array $package, string $directory = 'nex $inputs = [ // Choose a starting project. - $project, + $project, ]; $this->executeCommand([ - 'directory' => $directory, + 'directory' => $directory, ], $inputs); $output = $this->getDisplay(); @@ -137,11 +137,11 @@ protected function mockExecuteComposerCreate( string $project ): void { $command = [ - 'composer', - 'create-project', - $project, - $projectDir, - '--no-interaction', + 'composer', + 'create-project', + $project, + $projectDir, + '--no-interaction', ]; $localMachineHelper ->execute($command) @@ -155,11 +155,11 @@ protected function mockExecuteNpxCreate( ObjectProphecy $process, ): void { $command = [ - 'npx', - 'create-next-app', - '-e', - 'https://github.com/acquia/next-acms/tree/main/starters/basic-starter', - $projectDir, + 'npx', + 'create-next-app', + '-e', + 'https://github.com/acquia/next-acms/tree/main/starters/basic-starter', + $projectDir, ]; $localMachineHelper ->execute($command) @@ -173,9 +173,9 @@ protected function mockExecuteGitInit( ObjectProphecy $process ): void { $command = [ - 'git', - 'init', - '--initial-branch=main', + 'git', + 'init', + '--initial-branch=main', ]; $localMachineHelper ->execute($command, null, $projectDir) @@ -189,9 +189,9 @@ protected function mockExecuteGitAdd( ObjectProphecy $process ): void { $command = [ - 'git', - 'add', - '-A', + 'git', + 'add', + '-A', ]; $localMachineHelper ->execute($command, null, $projectDir) @@ -205,11 +205,11 @@ protected function mockExecuteGitCommit( ObjectProphecy $process ): void { $command = [ - 'git', - 'commit', - '--message', - 'Initial commit.', - '--quiet', + 'git', + 'commit', + '--message', + 'Initial commit.', + '--quiet', ]; $localMachineHelper ->execute($command, null, $projectDir) diff --git a/tests/phpunit/src/Commands/App/NewFromDrupal7CommandTest.php b/tests/phpunit/src/Commands/App/NewFromDrupal7CommandTest.php index 77ce1750e..0b6385441 100644 --- a/tests/phpunit/src/Commands/App/NewFromDrupal7CommandTest.php +++ b/tests/phpunit/src/Commands/App/NewFromDrupal7CommandTest.php @@ -45,9 +45,9 @@ public function provideTestNewFromDrupal7Command(): array $cases = []; foreach ($case_directories as $case_directory) { $cases[basename($case_directory)] = [ - "$case_directory/extensions.json", - "$repo_root/config/from_d7_recommendations.json", - "$case_directory/expected.json", + "$case_directory/extensions.json", + "$repo_root/config/from_d7_recommendations.json", + "$case_directory/expected.json", ]; } return $cases; @@ -108,9 +108,9 @@ public function testNewFromDrupal7Command(string $extensions_json, string $recom $this->mockExecuteGitCommit($localMachineHelper, $race_condition_proof_tmpdir, $process); $this->executeCommand([ - '--directory' => $race_condition_proof_tmpdir, - '--recommendations' => $recommendations_json, - '--stored-analysis' => $extensions_json, + '--directory' => $race_condition_proof_tmpdir, + '--recommendations' => $recommendations_json, + '--stored-analysis' => $extensions_json, ]); $output = $this->getDisplay(); @@ -138,11 +138,11 @@ protected function mockExecuteComposerCreate( ObjectProphecy $process ): void { $command = [ - 'composer', - 'install', - '--working-dir', - $projectDir, - '--no-interaction', + 'composer', + 'install', + '--working-dir', + $projectDir, + '--no-interaction', ]; $localMachineHelper ->execute($command) @@ -156,10 +156,10 @@ protected function mockExecuteGitInit( ObjectProphecy $process ): void { $command = [ - 'git', - 'init', - '--initial-branch=main', - '--quiet', + 'git', + 'init', + '--initial-branch=main', + '--quiet', ]; $localMachineHelper ->execute($command, null, $projectDir) @@ -173,9 +173,9 @@ protected function mockExecuteGitAdd( ObjectProphecy $process ): void { $command = [ - 'git', - 'add', - '-A', + 'git', + 'add', + '-A', ]; $localMachineHelper ->execute($command, null, $projectDir) @@ -189,11 +189,11 @@ protected function mockExecuteGitCommit( ObjectProphecy $process ): void { $command = [ - 'git', - 'commit', - '--message', - "Generated by Acquia CLI's app:new:from:drupal7.", - '--quiet', + 'git', + 'commit', + '--message', + "Generated by Acquia CLI's app:new:from:drupal7.", + '--quiet', ]; $localMachineHelper ->execute($command, null, $projectDir) diff --git a/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php b/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php index 0549a951f..3b1942c4e 100644 --- a/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php +++ b/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php @@ -28,7 +28,7 @@ public function testTaskWaitCommand(string $notification): void $notificationUuid = '1bd3487e-71d1-4fca-a2d9-5f969b3d35c1'; $this->mockRequest('getNotificationByUuid', $notificationUuid); $this->executeCommand([ - 'notification-uuid' => $notification, + 'notification-uuid' => $notification, ]); $output = $this->getDisplay(); @@ -53,7 +53,7 @@ function ($response): void { } ); $this->executeCommand([ - 'notification-uuid' => $notificationUuid, + 'notification-uuid' => $notificationUuid, ]); self::assertStringContainsString(' [ERROR] The task with notification uuid 1bd3487e-71d1-4fca-a2d9-5f969b3d35c1 failed', $this->getDisplay()); @@ -68,14 +68,14 @@ function ($response): void { public function providerTestTaskWaitCommand(): array { return [ - [ - '1bd3487e-71d1-4fca-a2d9-5f969b3d35c1', - ], - [ - 'https://cloud.acquia.com/api/notifications/1bd3487e-71d1-4fca-a2d9-5f969b3d35c1', - ], - [ - <<<'EOT' + [ + '1bd3487e-71d1-4fca-a2d9-5f969b3d35c1', + ], + [ + 'https://cloud.acquia.com/api/notifications/1bd3487e-71d1-4fca-a2d9-5f969b3d35c1', + ], + [ + <<<'EOT' { "message": "Caches are being cleared.", "_links": { @@ -88,10 +88,10 @@ public function providerTestTaskWaitCommand(): array } } EOT, - ], - [ - '"1bd3487e-71d1-4fca-a2d9-5f969b3d35c1"', - ], + ], + [ + '"1bd3487e-71d1-4fca-a2d9-5f969b3d35c1"', + ], ]; } @@ -120,7 +120,7 @@ public function testTaskWaitCommandWithInvalidJson(string $notification): void { $this->expectException(AcquiaCliException::class); $this->executeCommand([ - 'notification-uuid' => $notification, + 'notification-uuid' => $notification, ]); } @@ -130,8 +130,8 @@ public function testTaskWaitCommandWithInvalidJson(string $notification): void public function providerTestTaskWaitCommandWithInvalidJson(): array { return [ - [ - <<<'EOT' + [ + <<<'EOT' { "message": "Caches are being cleared.", "_links": { @@ -147,9 +147,9 @@ public function providerTestTaskWaitCommandWithInvalidJson(): array } } EOT, - ], - [ - <<<'EOT' + ], + [ + <<<'EOT' { "message": "Caches are being cleared.", "_links": { @@ -159,10 +159,10 @@ public function providerTestTaskWaitCommandWithInvalidJson(): array } } EOT, - ], - [ - '"11bd3487e-71d1-4fca-a2d9-5f969b3d35c1"', - ], + ], + [ + '"11bd3487e-71d1-4fca-a2d9-5f969b3d35c1"', + ], ]; } } diff --git a/tests/phpunit/src/Commands/Archive/ArchiveExporterCommandTest.php b/tests/phpunit/src/Commands/Archive/ArchiveExporterCommandTest.php index 2cd9b3791..373342fca 100644 --- a/tests/phpunit/src/Commands/Archive/ArchiveExporterCommandTest.php +++ b/tests/phpunit/src/Commands/Archive/ArchiveExporterCommandTest.php @@ -48,10 +48,10 @@ public function testArchiveExport(): void $inputs = [ // ... Do you want to continue? (yes/no) [yes] - 'y', + 'y', ]; $this->executeCommand([ - 'destination-dir' => $destinationDir, + 'destination-dir' => $destinationDir, ], $inputs); $output = $this->getDisplay(); diff --git a/tests/phpunit/src/Commands/Auth/AuthLoginCommandTest.php b/tests/phpunit/src/Commands/Auth/AuthLoginCommandTest.php index 32ae7560d..0a1c9c2a7 100644 --- a/tests/phpunit/src/Commands/Auth/AuthLoginCommandTest.php +++ b/tests/phpunit/src/Commands/Auth/AuthLoginCommandTest.php @@ -62,18 +62,18 @@ public function providerTestAuthLoginInvalidInputCommand(): Generator { yield [ - [], - ['--key' => 'no spaces are allowed' , '--secret' => $this->secret], + [], + ['--key' => 'no spaces are allowed' , '--secret' => $this->secret], ]; yield [ - [], - ['--key' => 'shorty' , '--secret' => $this->secret], + [], + ['--key' => 'shorty' , '--secret' => $this->secret], ]; yield [ - [], - ['--key' => ' ', '--secret' => $this->secret], + [], + ['--key' => ' ', '--secret' => $this->secret], ]; } @@ -95,14 +95,14 @@ public function testAuthLoginInvalidDatastore(): void $this->clientServiceProphecy->isMachineAuthenticated()->willReturn(false); $this->removeMockCloudConfigFile(); $data = [ - 'acli_key' => 'key2', - 'keys' => [ - 'key1' => [ - 'label' => 'foo', - 'secret' => 'foo', - 'uuid' => 'foo', - ], - ], + 'acli_key' => 'key2', + 'keys' => [ + 'key1' => [ + 'label' => 'foo', + 'secret' => 'foo', + 'uuid' => 'foo', + ], + ], ]; $this->fs->dumpFile($this->cloudConfigFilepath, json_encode($data)); $this->expectException(AcquiaCliException::class); diff --git a/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php b/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php index c63b13e59..309330607 100644 --- a/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php +++ b/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php @@ -34,14 +34,14 @@ public function testAuthLogoutInvalidDatastore(): void $this->clientServiceProphecy->isMachineAuthenticated()->willReturn(false); $this->removeMockCloudConfigFile(); $data = [ - 'acli_key' => 'key2', - 'keys' => [ - 'key1' => [ - 'label' => 'foo', - 'secret' => 'foo', - 'uuid' => 'foo', - ], - ], + 'acli_key' => 'key2', + 'keys' => [ + 'key1' => [ + 'label' => 'foo', + 'secret' => 'foo', + 'uuid' => 'foo', + ], + ], ]; $this->fs->dumpFile($this->cloudConfigFilepath, json_encode($data)); $this->expectException(AcquiaCliException::class); diff --git a/tests/phpunit/src/Commands/ClearCacheCommandTest.php b/tests/phpunit/src/Commands/ClearCacheCommandTest.php index 535d648da..f972c8ae9 100644 --- a/tests/phpunit/src/Commands/ClearCacheCommandTest.php +++ b/tests/phpunit/src/Commands/ClearCacheCommandTest.php @@ -48,7 +48,7 @@ public function testAliasesAreCached(): void $args = ['applicationUuid' => $alias]; $inputs = [ // Would you like to link the Cloud application Sample application to this repository? - 'n', + 'n', ]; $this->executeCommand($args, $inputs); diff --git a/tests/phpunit/src/Commands/CodeStudio/CodeStudioPhpVersionCommandTest.php b/tests/phpunit/src/Commands/CodeStudio/CodeStudioPhpVersionCommandTest.php index 8634a089f..6b825fe33 100644 --- a/tests/phpunit/src/Commands/CodeStudio/CodeStudioPhpVersionCommandTest.php +++ b/tests/phpunit/src/Commands/CodeStudio/CodeStudioPhpVersionCommandTest.php @@ -33,10 +33,10 @@ protected function createCommand(): CommandBase public function providerTestPhpVersionFailure(): array { return [ - ['', ValidatorException::class], - ['8', ValidatorException::class], - ['8 1', ValidatorException::class], - ['ABC', ValidatorException::class], + ['', ValidatorException::class], + ['8', ValidatorException::class], + ['8 1', ValidatorException::class], + ['ABC', ValidatorException::class], ]; } @@ -49,8 +49,8 @@ public function testPhpVersionFailure(mixed $phpVersion): void { $this->expectException(ValidatorException::class); $this->executeCommand([ - 'applicationUuid' => self::$applicationUuid, - 'php-version' => $phpVersion, + 'applicationUuid' => self::$applicationUuid, + 'php-version' => $phpVersion, ]); } @@ -72,10 +72,10 @@ public function testCiCdNotEnabled(): void $this->command->setGitLabClient($gitlabClient->reveal()); $this->executeCommand([ - '--gitlab-host-name' => $this->gitLabHost, - '--gitlab-token' => $this->gitLabToken, - 'applicationUuid' => self::$applicationUuid, - 'php-version' => '8.1', + '--gitlab-host-name' => $this->gitLabHost, + '--gitlab-token' => $this->gitLabToken, + 'applicationUuid' => self::$applicationUuid, + 'php-version' => '8.1', ]); $output = $this->getDisplay(); @@ -105,10 +105,10 @@ public function testPhpVersionAddFail(): void $gitlabClient->projects()->willReturn($projects); $this->command->setGitLabClient($gitlabClient->reveal()); $this->executeCommand([ - '--gitlab-host-name' => $this->gitLabHost, - '--gitlab-token' => $this->gitLabToken, - 'applicationUuid' => self::$applicationUuid, - 'php-version' => '8.1', + '--gitlab-host-name' => $this->gitLabHost, + '--gitlab-token' => $this->gitLabToken, + 'applicationUuid' => self::$applicationUuid, + 'php-version' => '8.1', ]); $output = $this->getDisplay(); @@ -138,10 +138,10 @@ public function testPhpVersionAdd(): void $this->command->setGitLabClient($gitlabClient->reveal()); $this->executeCommand([ - '--gitlab-host-name' => $this->gitLabHost, - '--gitlab-token' => $this->gitLabToken, - 'applicationUuid' => self::$applicationUuid, - 'php-version' => '8.1', + '--gitlab-host-name' => $this->gitLabHost, + '--gitlab-token' => $this->gitLabToken, + 'applicationUuid' => self::$applicationUuid, + 'php-version' => '8.1', ]); $output = $this->getDisplay(); @@ -166,12 +166,12 @@ public function testPhpVersionUpdateFail(): void $variables = $this->getMockGitLabVariables(); $variables[] = [ - 'environment_scope' => '*', - 'key' => 'PHP_VERSION', - 'masked' => false, - 'protected' => false, - 'value' => '8.1', - 'variable_type' => 'env_var', + 'environment_scope' => '*', + 'key' => 'PHP_VERSION', + 'masked' => false, + 'protected' => false, + 'value' => '8.1', + 'variable_type' => 'env_var', ]; $projects->variables($this->gitLabProjectId)->willReturn($variables); $projects->updateVariable($this->gitLabProjectId, Argument::type('string'), Argument::type('string')) @@ -180,10 +180,10 @@ public function testPhpVersionUpdateFail(): void $gitlabClient->projects()->willReturn($projects); $this->command->setGitLabClient($gitlabClient->reveal()); $this->executeCommand([ - '--gitlab-host-name' => $this->gitLabHost, - '--gitlab-token' => $this->gitLabToken, - 'applicationUuid' => self::$applicationUuid, - 'php-version' => '8.1', + '--gitlab-host-name' => $this->gitLabHost, + '--gitlab-token' => $this->gitLabToken, + 'applicationUuid' => self::$applicationUuid, + 'php-version' => '8.1', ]); $output = $this->getDisplay(); @@ -208,12 +208,12 @@ public function testPhpVersionUpdate(): void $variables = $this->getMockGitLabVariables(); $variables[] = [ - 'environment_scope' => '*', - 'key' => 'PHP_VERSION', - 'masked' => false, - 'protected' => false, - 'value' => '8.1', - 'variable_type' => 'env_var', + 'environment_scope' => '*', + 'key' => 'PHP_VERSION', + 'masked' => false, + 'protected' => false, + 'value' => '8.1', + 'variable_type' => 'env_var', ]; $projects->variables($this->gitLabProjectId)->willReturn($variables); $projects->updateVariable($this->gitLabProjectId, Argument::type('string'), Argument::type('string')); @@ -222,10 +222,10 @@ public function testPhpVersionUpdate(): void $this->command->setGitLabClient($gitlabClient->reveal()); $this->executeCommand([ - '--gitlab-host-name' => $this->gitLabHost, - '--gitlab-token' => $this->gitLabToken, - 'applicationUuid' => self::$applicationUuid, - 'php-version' => '8.1', + '--gitlab-host-name' => $this->gitLabHost, + '--gitlab-token' => $this->gitLabToken, + 'applicationUuid' => self::$applicationUuid, + 'php-version' => '8.1', ]); $output = $this->getDisplay(); diff --git a/tests/phpunit/src/Commands/CodeStudio/CodeStudioPipelinesMigrateCommandTest.php b/tests/phpunit/src/Commands/CodeStudio/CodeStudioPipelinesMigrateCommandTest.php index f04927bb5..e37f022a1 100644 --- a/tests/phpunit/src/Commands/CodeStudio/CodeStudioPipelinesMigrateCommandTest.php +++ b/tests/phpunit/src/Commands/CodeStudio/CodeStudioPipelinesMigrateCommandTest.php @@ -53,24 +53,24 @@ protected function createCommand(): CommandBase public function providerTestCommand(): array { return [ - [ + [ // One project. - [$this->getMockedGitLabProject($this->gitLabProjectId)], + [$this->getMockedGitLabProject($this->gitLabProjectId)], // Inputs. - [ + [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // @todo - '0', + '0', // Do you want to continue? - 'y', - ], - // Args. - [ - '--key' => $this->key, - '--secret' => $this->secret, - ], - ], + 'y', + ], + // Args. + [ + '--key' => $this->key, + '--secret' => $this->secret, + ], + ], ]; } @@ -97,48 +97,48 @@ public function testCommand(mixed $mockedGitlabProjects, mixed $inputs, mixed $a $this->mockGitLabPermissionsRequest($this::$applicationUuid); $projects = $this->mockGetGitLabProjects($this::$applicationUuid, $this->gitLabProjectId, $mockedGitlabProjects); $gitlabCicdVariables = [ - [ - 'key' => 'ACQUIA_APPLICATION_UUID', - 'masked' => true, - 'protected' => false, - 'value' => null, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_CLOUD_API_TOKEN_KEY', - 'masked' => true, - 'protected' => false, - 'value' => null, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_CLOUD_API_TOKEN_SECRET', - 'masked' => true, - 'protected' => false, - 'value' => null, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_GLAB_TOKEN_NAME', - 'masked' => true, - 'protected' => false, - 'value' => null, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'ACQUIA_GLAB_TOKEN_SECRET', - 'masked' => true, - 'protected' => false, - 'value' => null, - 'variable_type' => 'env_var', - ], - [ - 'key' => 'PHP_VERSION', - 'masked' => false, - 'protected' => false, - 'value' => null, - 'variable_type' => 'env_var', - ], + [ + 'key' => 'ACQUIA_APPLICATION_UUID', + 'masked' => true, + 'protected' => false, + 'value' => null, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_CLOUD_API_TOKEN_KEY', + 'masked' => true, + 'protected' => false, + 'value' => null, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_CLOUD_API_TOKEN_SECRET', + 'masked' => true, + 'protected' => false, + 'value' => null, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_GLAB_TOKEN_NAME', + 'masked' => true, + 'protected' => false, + 'value' => null, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'ACQUIA_GLAB_TOKEN_SECRET', + 'masked' => true, + 'protected' => false, + 'value' => null, + 'variable_type' => 'env_var', + ], + [ + 'key' => 'PHP_VERSION', + 'masked' => false, + 'protected' => false, + 'value' => null, + 'variable_type' => 'env_var', + ], ]; $projects->variables($this->gitLabProjectId)->willReturn($gitlabCicdVariables); $projects->update($this->gitLabProjectId, Argument::type('array')); diff --git a/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php b/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php index 531a80f0e..52265c6e5 100644 --- a/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php +++ b/tests/phpunit/src/Commands/CodeStudio/CodeStudioWizardCommandTest.php @@ -58,230 +58,230 @@ protected function createCommand(): CommandBase public function providerTestCommand(): array { return [ - [ + [ // One project. - [$this->getMockedGitLabProject($this->gitLabProjectId)], + [$this->getMockedGitLabProject($this->gitLabProjectId)], // Inputs. - [ + [ // Do you want to continue? - 'y', + 'y', // Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]: - 'y', - ], - // Args. - [ - '--key' => $this->key, - '--secret' => $this->secret, - ], - ], - // Two projects. - [ - [$this->getMockedGitLabProject($this->gitLabProjectId), $this->getMockedGitLabProject($this->gitLabProjectId)], - // Inputs. - [ - // Found multiple projects that could match the Sample application 1 application. Choose which one to configure. - '0', - // Do you want to continue? - 'y', - // Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]: - 'y', - ], - // Args. - [ - '--key' => $this->key, - '--secret' => $this->secret, - ], - ], - [ - // No projects. - [], - // Inputs. - [ - // 'Would you like to create a new Code Studio project? - 'y', - // Select a project type Drupal_project. - '0', - // Select PHP version 8.1. - '0', - // Do you want to continue? - 'y', - // Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]: - 'y', - ], - // Args. - [ - '--key' => $this->key, - '--secret' => $this->secret, - ], - ], - [ - // No projects. - [], - // Inputs. - [ - // 'Would you like to create a new Code Studio project? - 'y', - // Select a project type Drupal_project. - '0', - // Select PHP version 8.2. - '1', - // Do you want to continue? - 'y', - // Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]: - 'y', - ], - // Args. - [ - '--key' => $this->key, - '--secret' => $this->secret, - ], - ], - [ - // No projects. - [], - // Inputs. - [ - // 'Would you like to create a new Code Studio project? - 'y', - // Select a project type Node_project. - '1', - // Select NODE version 18.17.1. - '0', - // Do you want to continue? - 'y', - // Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]: - 'y', - ], - // Args. - [ - '--key' => $this->key, - '--secret' => $this->secret, - ], - ], - [ - // No projects. - [], - // Inputs. - [ - // 'Would you like to create a new Code Studio project? - 'y', - // Select a project type Node_project. - '1', - // Select NODE version 20.5.1. - '1', - // Do you want to continue? - 'y', - // Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]: - 'y', - ], - // Args. - [ - '--key' => $this->key, - '--secret' => $this->secret, - ], - ], - [ - // No projects. - [], - // Inputs. - [ - // 'Would you like to create a new Code Studio project? - 'n', - // Choose project. - '0', - // Do you want to continue? - 'y', - ], - // Args. - [ - '--key' => $this->key, - '--secret' => $this->secret, - ], - ], - [ - // No projects. - [], - // Inputs. - [ - // 'Would you like to create a new Code Studio project? - 'y', - // Enter Cloud Key. - $this->key, - // Enter Cloud secret,. - $this->secret, - // Select a project type Drupal_project. - '0', - // Select PHP version 8.1. - '0', - // Do you want to continue? - 'y', - ], - // Args. - [], - ], - [ - // No projects. - [], - // Inputs. - [ - // 'Would you like to create a new Code Studio project? - 'y', - // Enter Cloud Key. - $this->key, - // Enter Cloud secret,. - $this->secret, - // Select a project type Node_project. - '1', - // Select NODE version 18.17.1. - '0', - // Do you want to continue? - 'y', - ], - // Args. - [], - ], - [ - // No projects. - [], - // Inputs. - [ - // 'Would you like to create a new Code Studio project? - 'y', - // Enter Cloud Key. - $this->key, - // Enter Cloud secret,. - $this->secret, - // Select a project type Drupal_project. - '0', - // Select PHP version 8.2. - '1', - // Do you want to continue? - 'y', - ], - // Args. - [], - ], - [ - // No projects. - [], - // Inputs. - [ - // 'Would you like to create a new Code Studio project? - 'y', - // Enter Cloud Key. - $this->key, - // Enter Cloud secret,. - $this->secret, - // Select a project type Node_project. - '1', - // Select NODE version 20.5.1. - '1', - // Do you want to continue? - 'y', - ], - // Args. - [], - ], + 'y', + ], + // Args. + [ + '--key' => $this->key, + '--secret' => $this->secret, + ], + ], + // Two projects. + [ + [$this->getMockedGitLabProject($this->gitLabProjectId), $this->getMockedGitLabProject($this->gitLabProjectId)], + // Inputs. + [ + // Found multiple projects that could match the Sample application 1 application. Choose which one to configure. + '0', + // Do you want to continue? + 'y', + // Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]: + 'y', + ], + // Args. + [ + '--key' => $this->key, + '--secret' => $this->secret, + ], + ], + [ + // No projects. + [], + // Inputs. + [ + // 'Would you like to create a new Code Studio project? + 'y', + // Select a project type Drupal_project. + '0', + // Select PHP version 8.1. + '0', + // Do you want to continue? + 'y', + // Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]: + 'y', + ], + // Args. + [ + '--key' => $this->key, + '--secret' => $this->secret, + ], + ], + [ + // No projects. + [], + // Inputs. + [ + // 'Would you like to create a new Code Studio project? + 'y', + // Select a project type Drupal_project. + '0', + // Select PHP version 8.2. + '1', + // Do you want to continue? + 'y', + // Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]: + 'y', + ], + // Args. + [ + '--key' => $this->key, + '--secret' => $this->secret, + ], + ], + [ + // No projects. + [], + // Inputs. + [ + // 'Would you like to create a new Code Studio project? + 'y', + // Select a project type Node_project. + '1', + // Select NODE version 18.17.1. + '0', + // Do you want to continue? + 'y', + // Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]: + 'y', + ], + // Args. + [ + '--key' => $this->key, + '--secret' => $this->secret, + ], + ], + [ + // No projects. + [], + // Inputs. + [ + // 'Would you like to create a new Code Studio project? + 'y', + // Select a project type Node_project. + '1', + // Select NODE version 20.5.1. + '1', + // Do you want to continue? + 'y', + // Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]: + 'y', + ], + // Args. + [ + '--key' => $this->key, + '--secret' => $this->secret, + ], + ], + [ + // No projects. + [], + // Inputs. + [ + // 'Would you like to create a new Code Studio project? + 'n', + // Choose project. + '0', + // Do you want to continue? + 'y', + ], + // Args. + [ + '--key' => $this->key, + '--secret' => $this->secret, + ], + ], + [ + // No projects. + [], + // Inputs. + [ + // 'Would you like to create a new Code Studio project? + 'y', + // Enter Cloud Key. + $this->key, + // Enter Cloud secret,. + $this->secret, + // Select a project type Drupal_project. + '0', + // Select PHP version 8.1. + '0', + // Do you want to continue? + 'y', + ], + // Args. + [], + ], + [ + // No projects. + [], + // Inputs. + [ + // 'Would you like to create a new Code Studio project? + 'y', + // Enter Cloud Key. + $this->key, + // Enter Cloud secret,. + $this->secret, + // Select a project type Node_project. + '1', + // Select NODE version 18.17.1. + '0', + // Do you want to continue? + 'y', + ], + // Args. + [], + ], + [ + // No projects. + [], + // Inputs. + [ + // 'Would you like to create a new Code Studio project? + 'y', + // Enter Cloud Key. + $this->key, + // Enter Cloud secret,. + $this->secret, + // Select a project type Drupal_project. + '0', + // Select PHP version 8.2. + '1', + // Do you want to continue? + 'y', + ], + // Args. + [], + ], + [ + // No projects. + [], + // Inputs. + [ + // 'Would you like to create a new Code Studio project? + 'y', + // Enter Cloud Key. + $this->key, + // Enter Cloud secret,. + $this->secret, + // Select a project type Node_project. + '1', + // Select NODE version 20.5.1. + '1', + // Do you want to continue? + 'y', + ], + // Args. + [], + ], ]; } @@ -301,21 +301,21 @@ public function testCommand(array $mockedGitlabProjects, array $inputs, array $a $projects = $this->mockGetGitLabProjects($this::$applicationUuid, $this->gitLabProjectId, $mockedGitlabProjects); $parameters = [ - 'container_registry_access_level' => 'disabled', - 'default_branch' => 'main', - 'description' => 'Source repository for Acquia Cloud Platform application a47ac10b-58cc-4372-a567-0e02b2c3d470', - 'initialize_with_readme' => true, - 'namespace_id' => 47, - 'topics' => 'Acquia Cloud Application', + 'container_registry_access_level' => 'disabled', + 'default_branch' => 'main', + 'description' => 'Source repository for Acquia Cloud Platform application a47ac10b-58cc-4372-a567-0e02b2c3d470', + 'initialize_with_readme' => true, + 'namespace_id' => 47, + 'topics' => 'Acquia Cloud Application', ]; $projects->create('Sample-application-1', $parameters)->willReturn($this->getMockedGitLabProject($this->gitLabProjectId)); $this->mockGitLabProjectsTokens($projects); $parameters = [ - 'container_registry_access_level' => 'disabled', - 'default_branch' => 'main', - 'description' => 'Source repository for Acquia Cloud Platform application a47ac10b-58cc-4372-a567-0e02b2c3d470', - 'initialize_with_readme' => true, - 'topics' => 'Acquia Cloud Application', + 'container_registry_access_level' => 'disabled', + 'default_branch' => 'main', + 'description' => 'Source repository for Acquia Cloud Platform application a47ac10b-58cc-4372-a567-0e02b2c3d470', + 'initialize_with_readme' => true, + 'topics' => 'Acquia Cloud Application', ]; $projects->update($this->gitLabProjectId, $parameters)->shouldBeCalled(); $projects->uploadAvatar( @@ -326,7 +326,7 @@ public function testCommand(array $mockedGitlabProjects, array $inputs, array $a if ($inputs[0] === 'y' && ($inputs[1] === '1' || (array_key_exists(3, $inputs) && $inputs[3] === '1'))) { $parameters = [ - 'ci_config_path' => 'gitlab-ci/Auto-DevOps.acquia.gitlab-ci.yml@acquia/node-template', + 'ci_config_path' => 'gitlab-ci/Auto-DevOps.acquia.gitlab-ci.yml@acquia/node-template', ]; $projects->update($this->gitLabProjectId, $parameters)->shouldBeCalled(); } else { @@ -335,18 +335,18 @@ public function testCommand(array $mockedGitlabProjects, array $inputs, array $a $pipeline = ['id' => 1]; $parameters = [ // Every Thursday at midnight. - 'cron' => '0 0 * * 4', - 'description' => 'Code Studio Automatic Updates', - 'ref' => 'master', + 'cron' => '0 0 * * 4', + 'description' => 'Code Studio Automatic Updates', + 'ref' => 'master', ]; $schedules->create($this->gitLabProjectId, $parameters)->willReturn($pipeline); $schedules->addVariable($this->gitLabProjectId, $pipeline['id'], [ - 'key' => 'ACQUIA_JOBS_DEPRECATED_UPDATE', - 'value' => 'true', + 'key' => 'ACQUIA_JOBS_DEPRECATED_UPDATE', + 'value' => 'true', ])->shouldBeCalled(); $schedules->addVariable($this->gitLabProjectId, $pipeline['id'], [ - 'key' => 'ACQUIA_JOBS_COMPOSER_UPDATE', - 'value' => 'true', + 'key' => 'ACQUIA_JOBS_COMPOSER_UPDATE', + 'value' => 'true', ])->shouldBeCalled(); $gitlabClient->schedules()->willReturn($schedules->reveal()); } @@ -393,8 +393,8 @@ public function testInvalidGitLabCredentials(): void $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('Unable to authenticate with Code Studio'); $this->executeCommand([ - '--key' => $this->key, - '--secret' => $this->secret, + '--key' => $this->key, + '--secret' => $this->secret, ]); } @@ -411,28 +411,28 @@ public function testMissingGitLabCredentials(): void $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('Could not determine GitLab token'); $this->executeCommand([ - '--key' => $this->key, - '--secret' => $this->secret, + '--key' => $this->key, + '--secret' => $this->secret, ]); } protected function mockGitLabProjectsTokens(ObjectProphecy $projects): void { $tokens = [ - 0 => [ - 'access_level' => 40, - 'active' => true, - 'created_at' => '2021-12-28T20:08:21.629Z', - 'expires_at' => new DateTime('+365 days'), - 'id' => $this->gitLabTokenId, - 'name' => 'acquia-codestudio', - 'revoked' => false, - 'scopes' => [ - 0 => 'api', - 1 => 'write_repository', - ], - 'user_id' => 154, - ], + 0 => [ + 'access_level' => 40, + 'active' => true, + 'created_at' => '2021-12-28T20:08:21.629Z', + 'expires_at' => new DateTime('+365 days'), + 'id' => $this->gitLabTokenId, + 'name' => 'acquia-codestudio', + 'revoked' => false, + 'scopes' => [ + 0 => 'api', + 1 => 'write_repository', + ], + 'user_id' => 154, + ], ]; $projects->projectAccessTokens($this->gitLabProjectId)->willReturn($tokens)->shouldBeCalled(); $projects->deleteProjectAccessToken($this->gitLabProjectId, $this->gitLabTokenId)->shouldBeCalled(); @@ -446,10 +446,10 @@ protected function mockGetCurrentBranchName(mixed $localMachineHelper): void $process = $this->mockProcess(); $process->getOutput()->willReturn('main'); $localMachineHelper->execute([ - 'git', - 'rev-parse', - '--abbrev-ref', - 'HEAD', + 'git', + 'rev-parse', + '--abbrev-ref', + 'HEAD', ], null, null, false)->willReturn($process->reveal()); } @@ -457,60 +457,60 @@ protected function mockGitLabGroups(ObjectProphecy $gitlabClient): void { $groups = $this->prophet->prophesize(Groups::class); $groups->all(Argument::type('array'))->willReturn([ - 0 => [ - 'auto_devops_enabled' => null, - 'avatar_url' => null, - 'created_at' => '2021-11-16T18:54:31.275Z', - 'default_branch_protection' => 2, - 'description' => '', - 'emails_disabled' => null, - 'full_name' => 'awesome-demo', - 'full_path' => 'awesome-demo', - 'id' => 47, - 'ldap_access' => null, - 'ldap_cn' => null, - 'lfs_enabled' => true, - 'marked_for_deletion_on' => null, - 'mentions_disabled' => null, - 'name' => 'awesome-demo', - 'parent_id' => null, - 'path' => 'awesome-demo', - 'project_creation_level' => 'developer', - 'request_access_enabled' => true, - 'require_two_factor_authentication' => false, - 'share_with_group_lock' => false, - 'subgroup_creation_level' => 'maintainer', - 'two_factor_grace_period' => 48, - 'visibility' => 'private', - 'web_url' => 'https://code.cloudservices.acquia.io/groups/awesome-demo', - ], - 1 => [ - 'auto_devops_enabled' => null, - 'avatar_url' => null, - 'created_at' => '2021-12-14T18:49:50.724Z', - 'default_branch_protection' => 2, - 'description' => '', - 'emails_disabled' => null, - 'full_name' => 'Nestle', - 'full_path' => 'nestle', - 'id' => 68, - 'ldap_access' => null, - 'ldap_cn' => null, - 'lfs_enabled' => true, - 'marked_for_deletion_on' => null, - 'mentions_disabled' => null, - 'name' => 'Nestle', - 'parent_id' => null, - 'path' => 'nestle', - 'project_creation_level' => 'developer', - 'request_access_enabled' => true, - 'require_two_factor_authentication' => false, - 'share_with_group_lock' => false, - 'subgroup_creation_level' => 'maintainer', - 'two_factor_grace_period' => 48, - 'visibility' => 'private', - 'web_url' => 'https://code.cloudservices.acquia.io/groups/nestle', - ], + 0 => [ + 'auto_devops_enabled' => null, + 'avatar_url' => null, + 'created_at' => '2021-11-16T18:54:31.275Z', + 'default_branch_protection' => 2, + 'description' => '', + 'emails_disabled' => null, + 'full_name' => 'awesome-demo', + 'full_path' => 'awesome-demo', + 'id' => 47, + 'ldap_access' => null, + 'ldap_cn' => null, + 'lfs_enabled' => true, + 'marked_for_deletion_on' => null, + 'mentions_disabled' => null, + 'name' => 'awesome-demo', + 'parent_id' => null, + 'path' => 'awesome-demo', + 'project_creation_level' => 'developer', + 'request_access_enabled' => true, + 'require_two_factor_authentication' => false, + 'share_with_group_lock' => false, + 'subgroup_creation_level' => 'maintainer', + 'two_factor_grace_period' => 48, + 'visibility' => 'private', + 'web_url' => 'https://code.cloudservices.acquia.io/groups/awesome-demo', + ], + 1 => [ + 'auto_devops_enabled' => null, + 'avatar_url' => null, + 'created_at' => '2021-12-14T18:49:50.724Z', + 'default_branch_protection' => 2, + 'description' => '', + 'emails_disabled' => null, + 'full_name' => 'Nestle', + 'full_path' => 'nestle', + 'id' => 68, + 'ldap_access' => null, + 'ldap_cn' => null, + 'lfs_enabled' => true, + 'marked_for_deletion_on' => null, + 'mentions_disabled' => null, + 'name' => 'Nestle', + 'parent_id' => null, + 'path' => 'nestle', + 'project_creation_level' => 'developer', + 'request_access_enabled' => true, + 'require_two_factor_authentication' => false, + 'share_with_group_lock' => false, + 'subgroup_creation_level' => 'maintainer', + 'two_factor_grace_period' => 48, + 'visibility' => 'private', + 'web_url' => 'https://code.cloudservices.acquia.io/groups/nestle', + ], ]); $gitlabClient->groups()->willReturn($groups->reveal()); } @@ -519,20 +519,20 @@ protected function mockGitLabNamespaces(ObjectProphecy $gitlabClient): void { $namespaces = $this->prophet->prophesize(ProjectNamespaces::class); $namespaces->show(Argument::type('string'))->willReturn([ - 'avatar_url' => 'https://secure.gravatar.com/avatar/5ee7b8ad954bf7156e6eb57a45d60dec?s=80&d=identicon', - 'billable_members_count' => 1, - 'full_path' => 'matthew.grasmick', - 'id' => 48, - 'kind' => 'user', - 'max_seats_used' => 0, - 'name' => 'Matthew Grasmick', - 'parent_id' => null, - 'path' => 'matthew.grasmick', - 'plan' => 'default', - 'seats_in_use' => 0, - 'trial' => false, - 'trial_ends_on' => null, - 'web_url' => 'https://code.cloudservices.acquia.io/matthew.grasmick', + 'avatar_url' => 'https://secure.gravatar.com/avatar/5ee7b8ad954bf7156e6eb57a45d60dec?s=80&d=identicon', + 'billable_members_count' => 1, + 'full_path' => 'matthew.grasmick', + 'id' => 48, + 'kind' => 'user', + 'max_seats_used' => 0, + 'name' => 'Matthew Grasmick', + 'parent_id' => null, + 'path' => 'matthew.grasmick', + 'plan' => 'default', + 'seats_in_use' => 0, + 'trial' => false, + 'trial_ends_on' => null, + 'web_url' => 'https://code.cloudservices.acquia.io/matthew.grasmick', ]); $gitlabClient->namespaces()->willReturn($namespaces->reveal()); } diff --git a/tests/phpunit/src/Commands/CommandBaseTest.php b/tests/phpunit/src/Commands/CommandBaseTest.php index 49e0d7853..2dfee6b90 100644 --- a/tests/phpunit/src/Commands/CommandBaseTest.php +++ b/tests/phpunit/src/Commands/CommandBaseTest.php @@ -31,7 +31,7 @@ public function testUnauthenticatedFailure(): void $inputs = [ // Would you like to share anonymous performance usage and data? - 'n', + 'n', ]; $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('This machine is not yet authenticated with the Cloud Platform.'); @@ -53,8 +53,8 @@ public function testCloudAppFromLocalConfig(): void public function providerTestCloudAppUuidArg(): array { return [ - ['a47ac10b-58cc-4372-a567-0e02b2c3d470'], - ['165c887b-7633-4f64-799d-a5d4669c768e'], + ['a47ac10b-58cc-4372-a567-0e02b2c3d470'], + ['165c887b-7633-4f64-799d-a5d4669c768e'], ]; } @@ -74,8 +74,8 @@ public function testCloudAppUuidArg(string $uuid): void public function providerTestInvalidCloudAppUuidArg(): array { return [ - ['a47ac10b-58cc-4372-a567-0e02b2c3d4', 'This value should have exactly 36 characters.'], - ['a47ac10b-58cc-4372-a567-0e02b2c3d47z', 'This is not a valid UUID.'], + ['a47ac10b-58cc-4372-a567-0e02b2c3d4', 'This value should have exactly 36 characters.'], + ['a47ac10b-58cc-4372-a567-0e02b2c3d47z', 'This is not a valid UUID.'], ]; } @@ -95,9 +95,9 @@ public function testInvalidCloudAppUuidArg(string $uuid, string $message): void public function providerTestInvalidCloudEnvironmentAlias(): array { return [ - ['bl.a', 'This value is too short. It should have 5 characters or more.'], - ['blarg', 'You must enter either an environment ID or alias. Environment aliases must match the pattern [app-name].[env]'], - ['12345', 'You must enter either an environment ID or alias. Environment aliases must match the pattern [app-name].[env]'], + ['bl.a', 'This value is too short. It should have 5 characters or more.'], + ['blarg', 'You must enter either an environment ID or alias. Environment aliases must match the pattern [app-name].[env]'], + ['12345', 'You must enter either an environment ID or alias. Environment aliases must match the pattern [app-name].[env]'], ]; } diff --git a/tests/phpunit/src/Commands/DocsCommandTest.php b/tests/phpunit/src/Commands/DocsCommandTest.php index b69936a1a..7158cd283 100644 --- a/tests/phpunit/src/Commands/DocsCommandTest.php +++ b/tests/phpunit/src/Commands/DocsCommandTest.php @@ -39,78 +39,78 @@ public function testDocsCommand(int $input, string $expectedOutput): void public function providerTestDocsCommand(): array { return [ - [ - 0, - '[0 ] Acquia CLI', - ], - [ - 1, - '[1 ] Acquia CMS', - ], - [ - 2, - '[2 ] Acquia DAM Classic', - ], - [ - 3, - '[3 ] Acquia Migrate Accelerate', - ], - [ - 4, - '[4 ] BLT', - ], - [ - 5, - '[5 ] Campaign Factory', - ], - [ - 6, - '[6 ] Campaign Studio', - ], - [ - 7, - '[7 ] Cloud IDE', - ], - [ - 8, - '[8 ] Cloud Platform', - ], - [ - 9, - '[9 ] Code Studio', - ], - [ - 10, - '[10] Content Hub', - ], - [ - 11, - '[11] Customer Data Platform', - ], - [ - 12, - '[12] Edge', - ], - [ - 13, - '[13] Personalization', - ], - [ - 14, - '[14] Search', - ], - [ - 15, - '[15] Shield', - ], - [ - 16, - '[16] Site Factory', - ], - [ - 17, - '[17] Site Studio', - ], + [ + 0, + '[0 ] Acquia CLI', + ], + [ + 1, + '[1 ] Acquia CMS', + ], + [ + 2, + '[2 ] Acquia DAM Classic', + ], + [ + 3, + '[3 ] Acquia Migrate Accelerate', + ], + [ + 4, + '[4 ] BLT', + ], + [ + 5, + '[5 ] Campaign Factory', + ], + [ + 6, + '[6 ] Campaign Studio', + ], + [ + 7, + '[7 ] Cloud IDE', + ], + [ + 8, + '[8 ] Cloud Platform', + ], + [ + 9, + '[9 ] Code Studio', + ], + [ + 10, + '[10] Content Hub', + ], + [ + 11, + '[11] Customer Data Platform', + ], + [ + 12, + '[12] Edge', + ], + [ + 13, + '[13] Personalization', + ], + [ + 14, + '[14] Search', + ], + [ + 15, + '[15] Shield', + ], + [ + 16, + '[16] Site Factory', + ], + [ + 17, + '[17] Site Studio', + ], ]; } } diff --git a/tests/phpunit/src/Commands/Email/ConfigurePlatformEmailCommandTest.php b/tests/phpunit/src/Commands/Email/ConfigurePlatformEmailCommandTest.php index d935b4596..663cb6963 100644 --- a/tests/phpunit/src/Commands/Email/ConfigurePlatformEmailCommandTest.php +++ b/tests/phpunit/src/Commands/Email/ConfigurePlatformEmailCommandTest.php @@ -91,98 +91,98 @@ public function providerTestConfigurePlatformEmail(): array { return [ - [ - 'test.com', - 'zone', - self::ZONE_TEST_OUTPUT, - [ + [ + 'test.com', + 'zone', + self::ZONE_TEST_OUTPUT, + [ // What's the domain name you'd like to register? - 'test.com', + 'test.com', // Select a Cloud Platform subscription. - '0', + '0', // Would you like your DNS records in BIND Zone File, JSON, or YAML format? - '0', + '0', // Have you finished providing the DNS records to your DNS provider? - 'y', + 'y', // What are the environments you'd like to enable email for? You may enter multiple separated by a comma. - '0', - ], - // Status code. - 0, - // Expected text. - ["You're all set to start using Platform Email!"], - // Domain registration responses. - "200", - ], - [ - 'test.com', - 'yaml', - self::YAML_TEST_OUTPUT, - [ - // What's the domain name you'd like to register? - 'test.com', - // Select a Cloud Platform subscription. - '0', - // Would you like your DNS records in BIND Zone File, JSON, or YAML format? - '1', - // Have you finished providing the DNS records to your DNS provider? - 'n', - ], - // Status code. - 1, - // Expected text. - ["Make sure to give these records to your DNS provider"], - // Domain registration responses. - "404", - ], - [ - 'test.com', - 'json', - self::JSON_TEST_OUTPUT, - [ - // What's the domain name you'd like to register? - 'test.com', - // Select a Cloud Platform subscription. - '0', - // Would you like your DNS records in BIND Zone File, JSON, or YAML format? - '2', - // Have you finished providing the DNS records to your DNS provider? - 'y', - // Would you like to retry verification? - 'n', - ], - // Status code. - 1, - // Expected text. - ["Verification pending...", "Check your DNS records with your DNS provider"], - // Domain registration responses. - "202", - ], - [ - 'test.com', - 'zone', - self::ZONE_TEST_OUTPUT, - [ - // What's the domain name you'd like to register? - 'test.com', - // Select a Cloud Platform subscription. - '0', - // Would you like your DNS records in BIND Zone File, JSON, or YAML format? - '0', - // Have you finished providing the DNS records to your DNS provider? - 'y', - // Would you like to refresh? - 'y', - // Would you like to re-check domain verification? - 'n', - ], - // Status code. - 1, - // Expected text. - ["Refreshing...", "Check your DNS records with your DNS provider"], - // Domain registration responses. - "404", - ], + '0', + ], + // Status code. + 0, + // Expected text. + ["You're all set to start using Platform Email!"], + // Domain registration responses. + "200", + ], + [ + 'test.com', + 'yaml', + self::YAML_TEST_OUTPUT, + [ + // What's the domain name you'd like to register? + 'test.com', + // Select a Cloud Platform subscription. + '0', + // Would you like your DNS records in BIND Zone File, JSON, or YAML format? + '1', + // Have you finished providing the DNS records to your DNS provider? + 'n', + ], + // Status code. + 1, + // Expected text. + ["Make sure to give these records to your DNS provider"], + // Domain registration responses. + "404", + ], + [ + 'test.com', + 'json', + self::JSON_TEST_OUTPUT, + [ + // What's the domain name you'd like to register? + 'test.com', + // Select a Cloud Platform subscription. + '0', + // Would you like your DNS records in BIND Zone File, JSON, or YAML format? + '2', + // Have you finished providing the DNS records to your DNS provider? + 'y', + // Would you like to retry verification? + 'n', + ], + // Status code. + 1, + // Expected text. + ["Verification pending...", "Check your DNS records with your DNS provider"], + // Domain registration responses. + "202", + ], + [ + 'test.com', + 'zone', + self::ZONE_TEST_OUTPUT, + [ + // What's the domain name you'd like to register? + 'test.com', + // Select a Cloud Platform subscription. + '0', + // Would you like your DNS records in BIND Zone File, JSON, or YAML format? + '0', + // Have you finished providing the DNS records to your DNS provider? + 'y', + // Would you like to refresh? + 'y', + // Would you like to re-check domain verification? + 'n', + ], + // Status code. + 1, + // Expected text. + ["Refreshing...", "Check your DNS records with your DNS provider"], + // Domain registration responses. + "404", + ], ]; } @@ -192,52 +192,52 @@ public function providerTestConfigurePlatformEmail(): array public function providerTestConfigurePlatformEmailEnableEnv(): array { return [ - [ - 'example.com', - [ - // What's the domain name you'd like to register? - 'example.com', - // Select a Cloud Platform subscription. - '0', - // Would you like your DNS records in BIND Zone File, JSON, or YAML format? - '0', - // Have you finished providing the DNS records to your DNS provider? - 'y', - // What are the environments you'd like to enable email for? You may enter multiple separated by a comma. - '0', - ], - // Status code. - 0, - // Enablement response code. - '409', - // Spec key for enablement response code. - 'Already enabled', - // Expected text. - ['already enabled', "You're all set to start using Platform Email!"], - ], - [ - 'example.com', - [ + [ + 'example.com', + [ // What's the domain name you'd like to register? - 'example.com', + 'example.com', // Select a Cloud Platform subscription. - '0', + '0', // Would you like your DNS records in BIND Zone File, JSON, or YAML format? - '0', + '0', // Have you finished providing the DNS records to your DNS provider? - 'y', + 'y', // What are the environments you'd like to enable email for? You may enter multiple separated by a comma. - '0', - ], - // Status code. - 1, - // Enablement response code. - '403', - // Spec key for enablement response code. - 'No permission', - // Expected text. - ['You do not have permission', 'Something went wrong'], - ], + '0', + ], + // Status code. + 0, + // Enablement response code. + '409', + // Spec key for enablement response code. + 'Already enabled', + // Expected text. + ['already enabled', "You're all set to start using Platform Email!"], + ], + [ + 'example.com', + [ + // What's the domain name you'd like to register? + 'example.com', + // Select a Cloud Platform subscription. + '0', + // Would you like your DNS records in BIND Zone File, JSON, or YAML format? + '0', + // Have you finished providing the DNS records to your DNS provider? + 'y', + // What are the environments you'd like to enable email for? You may enter multiple separated by a comma. + '0', + ], + // Status code. + 1, + // Enablement response code. + '403', + // Spec key for enablement response code. + 'No permission', + // Expected text. + ['You do not have permission', 'Something went wrong'], + ], ]; } @@ -256,9 +256,9 @@ public function testConfigurePlatformEmail(mixed $baseDomain, mixed $fileDumpFor $postDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'post', '200'); $this->clientProphecy->request('post', "/subscriptions/{$subscriptionsResponse->_embedded->items[0]->uuid}/domains", [ - 'form_params' => [ - 'domain' => $baseDomain, - ], + 'form_params' => [ + 'domain' => $baseDomain, + ], ])->willReturn($postDomainsResponse); $getDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'get', '200'); @@ -305,19 +305,19 @@ public function testConfigurePlatformEmailWithMultipleAppsAndEnvs(): void { $inputs = [ // What's the domain name you'd like to register? - 'test.com', + 'test.com', // Select a Cloud Platform subscription. - '0', + '0', // Would you like your DNS records in BIND Zone File, JSON, or YAML format? - '0', + '0', // Have you finished providing the DNS records to your DNS provider? - 'y', + 'y', // What are the applications you'd like to associate this domain with? You may enter multiple separated by a comma. - '0,1', + '0,1', // What are the environments you'd like to enable email for? You may enter multiple separated by a comma. - Application 0. - '0,1', + '0,1', // What are the environments you'd like to enable email for? You may enter multiple separated by a comma. - Application 1. - '0', + '0', ]; $localMachineHelper = $this->mockLocalMachineHelper(); $mockFileSystem = $this->mockGetFilesystem($localMachineHelper); @@ -329,9 +329,9 @@ public function testConfigurePlatformEmailWithMultipleAppsAndEnvs(): void $postDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'post', '200'); $this->clientProphecy->request('post', "/subscriptions/{$subscriptionsResponse->_embedded->items[0]->uuid}/domains", [ - 'form_params' => [ - 'domain' => 'test.com', - ], + 'form_params' => [ + 'domain' => 'test.com', + ], ])->willReturn($postDomainsResponse); $getDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'get', '200'); @@ -387,13 +387,13 @@ public function testConfigurePlatformEmailNoApps(): void $baseDomain = 'test.com'; $inputs = [ // What's the domain name you'd like to register? - $baseDomain, + $baseDomain, // Select a Cloud Platform subscription. - '0', + '0', // Would you like your DNS records in BIND Zone File, JSON, or YAML format? - '0', + '0', // Have you finished providing the DNS records to your DNS provider? - 'y', + 'y', ]; $subscriptionsResponse = $this->getMockResponseFromSpec('/subscriptions', 'get', '200'); @@ -403,9 +403,9 @@ public function testConfigurePlatformEmailNoApps(): void $postDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'post', '200'); $this->clientProphecy->request('post', "/subscriptions/{$subscriptionsResponse->_embedded->items[0]->uuid}/domains", [ - 'form_params' => [ - 'domain' => $baseDomain, - ], + 'form_params' => [ + 'domain' => $baseDomain, + ], ])->willReturn($postDomainsResponse); $getDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'get', '200'); @@ -439,13 +439,13 @@ public function testConfigurePlatformEmailWithNoDomainMatch(): void $baseDomain = 'test.com'; $inputs = [ // What's the domain name you'd like to register? - $baseDomain, + $baseDomain, // Select a Cloud Platform subscription. - '0', + '0', // Would you like your DNS records in BIND Zone File, JSON, or YAML format? - '0', + '0', // Have you finished providing the DNS records to your DNS provider? - 'y', + 'y', ]; $subscriptionsResponse = $this->getMockResponseFromSpec('/subscriptions', 'get', '200'); @@ -455,9 +455,9 @@ public function testConfigurePlatformEmailWithNoDomainMatch(): void $postDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'post', '200'); $this->clientProphecy->request('post', "/subscriptions/{$subscriptionsResponse->_embedded->items[0]->uuid}/domains", [ - 'form_params' => [ - 'domain' => $baseDomain, - ], + 'form_params' => [ + 'domain' => $baseDomain, + ], ])->willReturn($postDomainsResponse); $getDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'get', '200'); @@ -474,13 +474,13 @@ public function testConfigurePlatformEmailWithErrorRetrievingDomainHealth(): voi $baseDomain = 'test.com'; $inputs = [ // What's the domain name you'd like to register? - $baseDomain, + $baseDomain, // Select a Cloud Platform subscription. - '0', + '0', // Would you like your DNS records in BIND Zone File, JSON, or YAML format? - '0', + '0', // Have you finished providing the DNS records to your DNS provider? - 'y', + 'y', ]; $subscriptionsResponse = $this->getMockResponseFromSpec('/subscriptions', 'get', '200'); @@ -490,9 +490,9 @@ public function testConfigurePlatformEmailWithErrorRetrievingDomainHealth(): voi $postDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'post', '200'); $this->clientProphecy->request('post', "/subscriptions/{$subscriptionsResponse->_embedded->items[0]->uuid}/domains", [ - 'form_params' => [ - 'domain' => $baseDomain, - ], + 'form_params' => [ + 'domain' => $baseDomain, + ], ])->willReturn($postDomainsResponse); $getDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'get', '200'); @@ -517,15 +517,15 @@ public function testConfigurePlatformEmailJsonOutput(): void $inputs = [ // What's the domain name you'd like to register? - 'test.com', + 'test.com', // Select a Cloud Platform subscription. - '0', + '0', // Would you like your DNS records in BIND Zone File, JSON, or YAML format? - '2', + '2', // Have you finished providing the DNS records to your DNS provider? - 'y', + 'y', // What are the environments you'd like to enable email for? You may enter multiple separated by a comma. - '0', + '0', ]; $subscriptionsResponse = $this->getMockResponseFromSpec('/subscriptions', 'get', '200'); $this->clientProphecy->request('get', '/subscriptions') @@ -533,9 +533,9 @@ public function testConfigurePlatformEmailJsonOutput(): void $postDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'post', '200'); $this->clientProphecy->request('post', "/subscriptions/{$subscriptionsResponse->_embedded->items[0]->uuid}/domains", [ - 'form_params' => [ - 'domain' => 'test.com', - ], + 'form_params' => [ + 'domain' => 'test.com', + ], ])->willReturn($postDomainsResponse); $getDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'get', '200'); @@ -585,9 +585,9 @@ public function testConfigurePlatformEmailWithAlreadyEnabledEnvs(mixed $baseDoma $postDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'post', '200'); $this->clientProphecy->request('post', "/subscriptions/{$subscriptionsResponse->_embedded->items[0]->uuid}/domains", [ - 'form_params' => [ - 'domain' => $baseDomain, - ], + 'form_params' => [ + 'domain' => $baseDomain, + ], ])->willReturn($postDomainsResponse); $getDomainsResponse = $this->getMockResponseFromSpec('/subscriptions/{subscriptionUuid}/domains', 'get', '200'); diff --git a/tests/phpunit/src/Commands/Email/EmailInfoForSubscriptionCommandTest.php b/tests/phpunit/src/Commands/Email/EmailInfoForSubscriptionCommandTest.php index 0214457a6..8540928e9 100644 --- a/tests/phpunit/src/Commands/Email/EmailInfoForSubscriptionCommandTest.php +++ b/tests/phpunit/src/Commands/Email/EmailInfoForSubscriptionCommandTest.php @@ -30,7 +30,7 @@ public function testEmailInfoForSubscription(): void { $inputs = [ // Select a Cloud Platform subscription. - 0, + 0, ]; $subscriptions = $this->mockRequest('getSubscriptions'); @@ -82,7 +82,7 @@ public function testEmailInfoForSubscriptionNoApps(): void { $inputs = [ // Select a Cloud Platform subscription. - 0, + 0, ]; $subscriptions = $this->mockRequest('getSubscriptions'); @@ -100,9 +100,9 @@ public function testEmailInfoForSubscriptionWith101Apps(): void { $inputs = [ // Select a Cloud Platform subscription. - 0, + 0, // Do you wish to continue? - 'no', + 'no', ]; $subscriptions = $this->mockRequest('getSubscriptions'); @@ -134,7 +134,7 @@ public function testEmailInfoForSubscriptionNoDomains(): void { $inputs = [ // Select a Cloud Platform subscription. - 0, + 0, ]; $subscriptions = $this->mockRequest('getSubscriptions'); @@ -149,7 +149,7 @@ public function testEmailInfoForSubscriptionNoAppDomains(): void { $inputs = [ // Select a Cloud Platform subscription. - 0, + 0, ]; $subscriptions = $this->mockRequest('getSubscriptions'); @@ -171,7 +171,7 @@ public function testEmailInfoForSubscriptionNoSubscriptions(): void { $inputs = [ // Select a Cloud Platform subscription. - 0, + 0, ]; $this->clientProphecy->request('get', '/subscriptions') ->willReturn([]) diff --git a/tests/phpunit/src/Commands/Env/EnvCertCreateCommandTest.php b/tests/phpunit/src/Commands/Env/EnvCertCreateCommandTest.php index 89dc4ab63..2e644a169 100644 --- a/tests/phpunit/src/Commands/Env/EnvCertCreateCommandTest.php +++ b/tests/phpunit/src/Commands/Env/EnvCertCreateCommandTest.php @@ -36,14 +36,14 @@ public function testCreateCert(): void '202' ); $options = [ - 'json' => [ - 'ca_certificates' => null, - 'certificate' => $certContents, - 'csr_id' => $csrId, - 'label' => $label, - 'legacy' => false, - 'private_key' => $keyContents, - ], + 'json' => [ + 'ca_certificates' => null, + 'certificate' => $certContents, + 'csr_id' => $csrId, + 'label' => $label, + 'legacy' => false, + 'private_key' => $keyContents, + ], ]; $this->clientProphecy->request('post', "/environments/{$environments[1]->id}/ssl/certificates", $options) ->willReturn($sslResponse->{'Site is being imported'}->value) @@ -52,20 +52,20 @@ public function testCreateCert(): void $this->executeCommand( [ - '--csr-id' => $csrId, - '--label' => $label, - '--legacy' => false, - 'certificate' => $certName, - 'private-key' => $keyName, + '--csr-id' => $csrId, + '--label' => $label, + '--legacy' => false, + 'certificate' => $certName, + 'private-key' => $keyName, ], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config?'. - 'n', + 'n', // Select a Cloud Platform application: [Sample application 1]: - 0, - 'n', - 1, - '', + 0, + 'n', + 1, + '', ] ); } @@ -96,14 +96,14 @@ public function testCreateCertNode(): void '202' ); $options = [ - 'json' => [ - 'ca_certificates' => null, - 'certificate' => $certContents, - 'csr_id' => $csrId, - 'label' => $label, - 'legacy' => false, - 'private_key' => $keyContents, - ], + 'json' => [ + 'ca_certificates' => null, + 'certificate' => $certContents, + 'csr_id' => $csrId, + 'label' => $label, + 'legacy' => false, + 'private_key' => $keyContents, + ], ]; $this->clientProphecy->request('post', "/environments/{$environments[0]->id}/ssl/certificates", $options) ->willReturn($sslResponse->{'Site is being imported'}->value) @@ -112,17 +112,17 @@ public function testCreateCertNode(): void $this->executeCommand( [ - '--csr-id' => $csrId, - '--label' => $label, - '--legacy' => false, - 'certificate' => $certName, - 'private-key' => $keyName, + '--csr-id' => $csrId, + '--label' => $label, + '--legacy' => false, + 'certificate' => $certName, + 'private-key' => $keyName, ], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config?'. - 'n', + 'n', // Select a Cloud Platform application: [Sample application 1]: - 0, + 0, ] ); } diff --git a/tests/phpunit/src/Commands/Env/EnvCopyCronCommandTest.php b/tests/phpunit/src/Commands/Env/EnvCopyCronCommandTest.php index 6bee7ed66..4f36f6d06 100644 --- a/tests/phpunit/src/Commands/Env/EnvCopyCronCommandTest.php +++ b/tests/phpunit/src/Commands/Env/EnvCopyCronCommandTest.php @@ -44,11 +44,11 @@ public function testCopyCronTasksCommandTest(): void $dest = '32-a47ac10b-58cc-4372-a567-0e02b2c3d470'; $this->executeCommand( [ - 'dest_env' => $dest, - 'source_env' => $source, + 'dest_env' => $dest, + 'source_env' => $source, ], [ - 'y', + 'y', ] ); @@ -63,8 +63,8 @@ public function testCopyCronTasksCommandTest(): void public function testCopyCronTasksCommandTestFail(): void { $this->executeCommand([ - 'dest_env' => 'app.test', - 'source_env' => 'app.test', + 'dest_env' => 'app.test', + 'source_env' => 'app.test', ],); $output = $this->getDisplay(); $this->assertStringContainsString('The source and destination environments can not be same', $output); @@ -87,11 +87,11 @@ public function testNoCronJobOnSource(): void $dest = '32-a47ac10b-58cc-4372-a567-0e02b2c3d470'; $this->executeCommand( [ - 'dest_env' => $dest, - 'source_env' => $source, + 'dest_env' => $dest, + 'source_env' => $source, ], [ - 'y', + 'y', ] ); @@ -125,11 +125,11 @@ public function testExceptionOnCronJobCopy(): void $dest = '32-a47ac10b-58cc-4372-a567-0e02b2c3d470'; $this->executeCommand( [ - 'dest_env' => $dest, - 'source_env' => $source, + 'dest_env' => $dest, + 'source_env' => $source, ], [ - 'y', + 'y', ] ); diff --git a/tests/phpunit/src/Commands/Env/EnvCreateCommandTest.php b/tests/phpunit/src/Commands/Env/EnvCreateCommandTest.php index f7e3cdd87..d7fc310f4 100644 --- a/tests/phpunit/src/Commands/Env/EnvCreateCommandTest.php +++ b/tests/phpunit/src/Commands/Env/EnvCreateCommandTest.php @@ -94,11 +94,11 @@ public function providerTestCreateCde(): array $branch = $this->getBranch(); return [ // No args, only interactive input. - [[null, null], ['n', 0, 0]], + [[null, null], ['n', 0, 0]], // Branch as arg. - [[$branch, null], ['n', 0]], + [[$branch, null], ['n', 0]], // Branch and app id as args. - [[$branch, $application], []], + [[$branch, $application], []], ]; } @@ -112,9 +112,9 @@ public function testCreateCde(mixed $args, mixed $input): void $this->executeCommand( [ - 'applicationUuid' => $args[1], - 'branch' => $args[0], - 'label' => self::$validLabel, + 'applicationUuid' => $args[1], + 'branch' => $args[0], + 'label' => self::$validLabel, ], $input ); @@ -136,9 +136,9 @@ public function testCreateCdeNonUniqueLabel(): void $this->expectExceptionMessage('An environment named Dev already exists.'); $this->executeCommand( [ - 'applicationUuid' => $this->getApplication(), - 'branch' => $this->getBranch(), - 'label' => $label, + 'applicationUuid' => $this->getApplication(), + 'branch' => $this->getBranch(), + 'label' => $label, ] ); } @@ -154,9 +154,9 @@ public function testCreateCdeInvalidTag(): void $this->expectExceptionMessage('There is no branch or tag with the name bogus on the remote VCS.'); $this->executeCommand( [ - 'applicationUuid' => $this->getApplication(), - 'branch' => 'bogus', - 'label' => self::$validLabel, + 'applicationUuid' => $this->getApplication(), + 'branch' => 'bogus', + 'label' => self::$validLabel, ] ); } diff --git a/tests/phpunit/src/Commands/Env/EnvDeleteCommandTest.php b/tests/phpunit/src/Commands/Env/EnvDeleteCommandTest.php index b51c46d0b..2bb6a0aa3 100644 --- a/tests/phpunit/src/Commands/Env/EnvDeleteCommandTest.php +++ b/tests/phpunit/src/Commands/Env/EnvDeleteCommandTest.php @@ -27,8 +27,8 @@ public function providerTestDeleteCde(): array $environmentResponse = $this->getMockEnvironmentsResponse(); $environment = $environmentResponse->_embedded->items[0]; return [ - [$environment->id], - [null], + [$environment->id], + [null], ]; } @@ -76,13 +76,13 @@ public function testDeleteCde(mixed $environmentId): void $this->executeCommand( [ - 'environmentId' => $environmentId, + 'environmentId' => $environmentId, ], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config?'. - 'n', + 'n', // Select a Cloud Platform application: [Sample application 1]: - 0, + 0, ] ); $output = $this->getDisplay(); @@ -106,9 +106,9 @@ public function testNoExistingCDEEnvironment(): void [], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config?'. - 'n', + 'n', // Select a Cloud Platform application: [Sample application 1]: - 0, + 0, ] ); } @@ -145,9 +145,9 @@ public function testNoEnvironmentArgumentPassed(): void [], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config?'. - 'n', + 'n', // Select a Cloud Platform application: [Sample application 1]: - 0, + 0, ] ); diff --git a/tests/phpunit/src/Commands/Env/EnvMirrorCommandTest.php b/tests/phpunit/src/Commands/Env/EnvMirrorCommandTest.php index 4577e7d8e..975ccd8f7 100644 --- a/tests/phpunit/src/Commands/Env/EnvMirrorCommandTest.php +++ b/tests/phpunit/src/Commands/Env/EnvMirrorCommandTest.php @@ -30,9 +30,9 @@ public function testEnvironmentMirror(): void 'post', "/environments/{$environmentResponse->id}/code/actions/switch", [ - 'form_params' => [ - 'branch' => $environmentResponse->vcs->path, - ], + 'form_params' => [ + 'branch' => $environmentResponse->vcs->path, + ], ] ) ->willReturn($response) @@ -51,10 +51,10 @@ public function testEnvironmentMirror(): void $this->mockNotificationResponseFromObject($response); $response->links = $response->{'_links'}; $this->clientProphecy->request('post', "/environments/{$environmentResponse->id}/databases", [ - 'json' => [ - 'name' => $databasesResponse->_embedded->items[0]->name, - 'source' => $environmentResponse->id, - ], + 'json' => [ + 'name' => $databasesResponse->_embedded->items[0]->name, + 'source' => $environmentResponse->id, + ], ]) ->willReturn($response) ->shouldBeCalled(); @@ -64,9 +64,9 @@ public function testEnvironmentMirror(): void $this->mockNotificationResponseFromObject($response); $response->links = $response->{'_links'}; $this->clientProphecy->request('post', "/environments/{$environmentResponse->id}/files", [ - 'json' => [ - 'source' => $environmentResponse->id, - ], + 'json' => [ + 'source' => $environmentResponse->id, + ], ]) ->willReturn($response) ->shouldBeCalled(); @@ -79,12 +79,12 @@ public function testEnvironmentMirror(): void $this->executeCommand( [ - 'destination-environment' => $environmentResponse->id, - 'source-environment' => $environmentResponse->id, + 'destination-environment' => $environmentResponse->id, + 'source-environment' => $environmentResponse->id, ], [ // Are you sure that you want to overwrite everything ... - 'y', + 'y', ] ); diff --git a/tests/phpunit/src/Commands/Ide/IdeCreateCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeCreateCommandTest.php index df555137e..34834f783 100644 --- a/tests/phpunit/src/Commands/Ide/IdeCreateCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeCreateCommandTest.php @@ -62,11 +62,11 @@ public function testCreate(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? // Would you like to link the project at ... ? - 'n', - 0, - self::$INPUT_DEFAULT_CHOICE, + 'n', + 0, + self::$INPUT_DEFAULT_CHOICE, // Enter a label for your Cloud IDE: - 'Example IDE', + 'Example IDE', ]; $this->executeCommand([], $inputs); diff --git a/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php index 59c186bd1..0dcc9ca30 100644 --- a/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php @@ -23,7 +23,7 @@ public function setUp(OutputInterface $output = null): void parent::setUp(); $this->getCommandTester(); $this->application->addCommands([ - $this->injectCommand(SshKeyDeleteCommand::class), + $this->injectCommand(SshKeyDeleteCommand::class), ]); } @@ -44,15 +44,15 @@ public function testIdeDeleteCommand(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select the application for which you'd like to create a new IDE. - 0, + 0, // Would you like to link the project at ... ? - 'y', + 'y', // Select the IDE you'd like to delete: - 0, + 0, // Are you sure you want to delete ExampleIDE? - 'y', + 'y', ]; $this->executeCommand([], $inputs); @@ -72,7 +72,7 @@ public function testIdeDeleteByUuid(): void $inputs = [ // Would you like to delete the SSH key associated with this IDE from your Cloud Platform account? - 'y', + 'y', ]; $this->executeCommand(['--uuid' => IdeHelper::$remoteIdeUuid], $inputs); @@ -89,15 +89,15 @@ public function testIdeDeleteNeverMind(): void $this->mockRequest('getApplicationIdes', $applications[0]->uuid); $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select the application for which you'd like to create a new IDE. - 0, + 0, // Would you like to link the project at ... ? - 'y', + 'y', // Select the IDE you'd like to delete: - 0, + 0, // Are you sure you want to delete ExampleIDE? - 'n', + 'n', ]; $this->executeCommand([], $inputs); diff --git a/tests/phpunit/src/Commands/Ide/IdeHelper.php b/tests/phpunit/src/Commands/Ide/IdeHelper.php index f5f9773a7..41aa6423b 100644 --- a/tests/phpunit/src/Commands/Ide/IdeHelper.php +++ b/tests/phpunit/src/Commands/Ide/IdeHelper.php @@ -27,10 +27,10 @@ public static function unsetCloudIdeEnvVars(): void public static function getEnvVars(): array { return [ - 'ACQUIA_USER_UUID' => '4acf8956-45df-3cf4-5106-065b62cf1ac8', - 'AH_SITE_ENVIRONMENT' => 'IDE', - 'REMOTEIDE_LABEL' => self::$remoteIdeLabel, - 'REMOTEIDE_UUID' => self::$remoteIdeUuid, + 'ACQUIA_USER_UUID' => '4acf8956-45df-3cf4-5106-065b62cf1ac8', + 'AH_SITE_ENVIRONMENT' => 'IDE', + 'REMOTEIDE_LABEL' => self::$remoteIdeLabel, + 'REMOTEIDE_UUID' => self::$remoteIdeUuid, ]; } } diff --git a/tests/phpunit/src/Commands/Ide/IdeInfoCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeInfoCommandTest.php index 6fca529b1..6f9ba1f89 100644 --- a/tests/phpunit/src/Commands/Ide/IdeInfoCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeInfoCommandTest.php @@ -29,13 +29,13 @@ public function testIdeInfoCommand(): void $this->mockRequest('getIde', $ides[0]->uuid); $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select the application. - 0, + 0, // Would you like to link the project at ... ? - 'y', + 'y', // Select an IDE ... - 0, + 0, ]; $this->executeCommand([], $inputs); diff --git a/tests/phpunit/src/Commands/Ide/IdeListCommandMineTest.php b/tests/phpunit/src/Commands/Ide/IdeListCommandMineTest.php index 4aebefff6..a9a658167 100644 --- a/tests/phpunit/src/Commands/Ide/IdeListCommandMineTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeListCommandMineTest.php @@ -34,11 +34,11 @@ public function testIdeListMineCommand(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select the application. - 0, + 0, // Would you like to link the project at ... ? - 'y', + 'y', ]; $this->executeCommand([], $inputs); diff --git a/tests/phpunit/src/Commands/Ide/IdeListCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeListCommandTest.php index 9e975cb3b..95b9475c4 100644 --- a/tests/phpunit/src/Commands/Ide/IdeListCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeListCommandTest.php @@ -28,11 +28,11 @@ public function testIdeListCommand(): void $this->mockRequest('getApplicationIdes', $application->uuid); $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select the application. - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, // Would you like to link the project at ... ? - 'y', + 'y', ]; $this->executeCommand([], $inputs); @@ -65,11 +65,11 @@ public function testIdeListEmptyCommand(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select the application. - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, // Would you like to link the project at ... ? - 'y', + 'y', ]; $this->executeCommand([], $inputs); diff --git a/tests/phpunit/src/Commands/Ide/IdeOpenCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeOpenCommandTest.php index fdad33d2c..2864d1f1d 100644 --- a/tests/phpunit/src/Commands/Ide/IdeOpenCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeOpenCommandTest.php @@ -32,13 +32,13 @@ public function testIdeOpenCommand(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'y', + 'y', // Select the IDE you'd like to open: - 0, + 0, ]; $this->executeCommand([], $inputs); diff --git a/tests/phpunit/src/Commands/Ide/IdePhpVersionCommandTest.php b/tests/phpunit/src/Commands/Ide/IdePhpVersionCommandTest.php index e9f258b3b..30439e738 100644 --- a/tests/phpunit/src/Commands/Ide/IdePhpVersionCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdePhpVersionCommandTest.php @@ -32,9 +32,9 @@ protected function createCommand(): CommandBase public function providerTestIdePhpVersionCommand(): array { return [ - ['7.4'], - ['8.0'], - ['8.1'], + ['7.4'], + ['8.0'], + ['8.1'], ]; } @@ -55,7 +55,7 @@ public function testIdePhpVersionCommand(string $version): void $this->command->setPhpVersionFilePath($phpVersionFilePath); $this->command->setIdePhpFilePathPrefix($phpFilepathPrefix); $this->executeCommand([ - 'version' => $version, + 'version' => $version, ], []); } @@ -65,10 +65,10 @@ public function testIdePhpVersionCommand(string $version): void public function providerTestIdePhpVersionCommandFailure(): array { return [ - ['6.3', AcquiaCliException::class], - ['6', ValidatorException::class], - ['7', ValidatorException::class], - ['7.', ValidatorException::class], + ['6.3', AcquiaCliException::class], + ['6', ValidatorException::class], + ['7', ValidatorException::class], + ['7.', ValidatorException::class], ]; } @@ -79,7 +79,7 @@ public function testIdePhpVersionCommandFailure(string $version, string $excepti { $this->expectException($exceptionClass); $this->executeCommand([ - 'version' => $version, + 'version' => $version, ]); } @@ -89,7 +89,7 @@ public function testIdePhpVersionCommandOutsideIde(): void $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('This command can only be run inside of an Acquia Cloud IDE'); $this->executeCommand([ - 'version' => '7.3', + 'version' => '7.3', ]); } @@ -99,9 +99,9 @@ protected function mockRestartPhp(ObjectProphecy|LocalMachineHelper $localMachin $process->isSuccessful()->willReturn(true); $process->getExitCode()->willReturn(0); $localMachineHelper->execute([ - 'supervisorctl', - 'restart', - 'php-fpm', + 'supervisorctl', + 'restart', + 'php-fpm', ], null, null, false)->willReturn($process->reveal())->shouldBeCalled(); return $process; } diff --git a/tests/phpunit/src/Commands/Ide/IdeXdebugToggleCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeXdebugToggleCommandTest.php index 89da557cb..83363d27b 100644 --- a/tests/phpunit/src/Commands/Ide/IdeXdebugToggleCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeXdebugToggleCommandTest.php @@ -30,9 +30,9 @@ public function setUpXdebug(string $phpVersion): void $localMachineHelper = $this->mockLocalMachineHelper(); $localMachineHelper ->execute([ - 'supervisorctl', - 'restart', - 'php-fpm', + 'supervisorctl', + 'restart', + 'php-fpm', ], null, null, false) ->willReturn($process->reveal()) ->shouldBeCalled(); @@ -49,9 +49,9 @@ protected function createCommand(): CommandBase public function providerTestXdebugCommandEnable(): array { return [ - ['7.4'], - ['8.0'], - ['8.1'], + ['7.4'], + ['8.0'], + ['8.1'], ]; } diff --git a/tests/phpunit/src/Commands/InferApplicationTest.php b/tests/phpunit/src/Commands/InferApplicationTest.php index 0743818e8..afb39f52b 100644 --- a/tests/phpunit/src/Commands/InferApplicationTest.php +++ b/tests/phpunit/src/Commands/InferApplicationTest.php @@ -41,9 +41,9 @@ public function testInfer(): void $this->executeCommand([], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'y', + 'y', // Would you like to link the project at ... - 'y', + 'y', ]); $output = $this->getDisplay(); @@ -76,11 +76,11 @@ public function testInferFailure(): void $this->executeCommand([], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'y', + 'y', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... - 'y', + 'y', ]); $output = $this->getDisplay(); @@ -95,7 +95,7 @@ public function testInferInvalidGitConfig(): void { $this->expectException(AcquiaCliException::class); $this->executeCommand([], [ - 'y', + 'y', ]); } } diff --git a/tests/phpunit/src/Commands/Pull/PullCodeCommandTest.php b/tests/phpunit/src/Commands/Pull/PullCodeCommandTest.php index 2726ccf6d..fb396a67a 100644 --- a/tests/phpunit/src/Commands/Pull/PullCodeCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullCodeCommandTest.php @@ -57,17 +57,17 @@ public function testCloneRepo(): void $inputs = [ // Would you like to clone a project into the current directory? - 'y', + 'y', // Select a Cloud Platform application: - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, // Would you like to link the project at ... ? - 'n', + 'n', // Choose an Acquia environment: - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, ]; $this->executeCommand([ - '--dir' => $dir, - '--no-scripts' => true, + '--dir' => $dir, + '--no-scripts' => true, ], $inputs); } @@ -86,7 +86,7 @@ public function testPullCode(): void $this->mockExecuteGitStatus(false, $localMachineHelper, $this->projectDir); $this->executeCommand([ - '--no-scripts' => true, + '--no-scripts' => true, ], self::inputChooseEnvironment()); $output = $this->getDisplay(); @@ -220,9 +220,9 @@ public function testWithVendorDir(): void public function providerTestMatchPhpVersion(): array { return [ - ['7.1'], - ['7.2'], - [''], + ['7.1'], + ['7.2'], + [''], ]; } @@ -233,7 +233,7 @@ public function testMatchPhpVersion(string $phpVersion): void { IdeHelper::setCloudIdeEnvVars(); $this->application->addCommands([ - $this->injectCommand(IdePhpVersionCommand::class), + $this->injectCommand(IdePhpVersionCommand::class), ]); $this->command = $this->createCommand(); $dir = '/home/ide/project'; @@ -260,15 +260,15 @@ public function testMatchPhpVersion(string $phpVersion): void ->shouldBeCalled(); $this->executeCommand([ - '--dir' => $dir, - '--no-scripts' => true, + '--dir' => $dir, + '--no-scripts' => true, // @todo Execute ONLY match php aspect, not the code pull. - 'environmentId' => $environmentResponse->id, + 'environmentId' => $environmentResponse->id, ], [ // Choose an Acquia environment: - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, // Would you like to change the PHP version on this IDE to match the PHP version on ... ? - 'n', + 'n', ]); $output = $this->getDisplay(); @@ -288,10 +288,10 @@ protected function mockExecuteGitClone( mixed $dir ): void { $command = [ - 'git', - 'clone', - $environmentsResponse->vcs->url, - $dir, + 'git', + 'clone', + $environmentsResponse->vcs->url, + $dir, ]; $localMachineHelper->execute($command, Argument::type('callable'), null, true, null, ['GIT_SSH_COMMAND' => 'ssh -o StrictHostKeyChecking=no']) ->willReturn($process->reveal()) diff --git a/tests/phpunit/src/Commands/Pull/PullCommandTest.php b/tests/phpunit/src/Commands/Pull/PullCommandTest.php index cf04096d1..7e22962c7 100644 --- a/tests/phpunit/src/Commands/Pull/PullCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullCommandTest.php @@ -67,17 +67,17 @@ public function testPull(): void ->shouldBeCalled(); $this->mockExecuteMySqlImport($localMachineHelper, true, true, 'my_db', 'my_dbdev', 'drupal'); $this->executeCommand([ - '--no-scripts' => true, + '--no-scripts' => true, ], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, // Would you like to link the project at ... ? - 'n', + 'n', // Choose an Acquia environment: - self::$INPUT_DEFAULT_CHOICE, - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, ]); $output = $this->getDisplay(); @@ -101,7 +101,7 @@ public function testMissingLocalRepo(): void $this->expectExceptionMessage('Execute this command from within a Drupal project directory or an empty directory'); $inputs = [ // Would you like to clone a project into the current directory? - 'n', + 'n', ]; $this->executeCommand([], $inputs); } diff --git a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php index 5a38c923c..0dc9022f6 100644 --- a/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php +++ b/tests/phpunit/src/Commands/Pull/PullCommandTestBase.php @@ -57,11 +57,11 @@ protected function mockExecuteDrushStatus( ->willReturn(json_encode(['db-status' => 'Connected'])); $localMachineHelper ->execute([ - 'drush', - 'status', - '--fields=db-status,drush-version', - '--format=json', - '--no-interaction', + 'drush', + 'status', + '--fields=db-status,drush-version', + '--format=json', + '--no-interaction', ], Argument::any(), $dir, false) ->willReturn($drushStatusProcess->reveal()) ->shouldBeCalled(); @@ -73,11 +73,11 @@ protected function mockExecuteDrushCacheRebuild( ): void { $localMachineHelper ->execute([ - 'drush', - 'cache:rebuild', - '--yes', - '--no-interaction', - '--verbose', + 'drush', + 'cache:rebuild', + '--yes', + '--no-interaction', + '--verbose', ], Argument::type('callable'), $this->projectDir, false) ->willReturn($process->reveal()) ->shouldBeCalled(); @@ -89,11 +89,11 @@ protected function mockExecuteDrushSqlSanitize( ): void { $localMachineHelper ->execute([ - 'drush', - 'sql:sanitize', - '--yes', - '--no-interaction', - '--verbose', + 'drush', + 'sql:sanitize', + '--yes', + '--no-interaction', + '--verbose', ], Argument::type('callable'), $this->projectDir, false) ->willReturn($process->reveal()) ->shouldBeCalled(); @@ -114,9 +114,9 @@ protected function mockExecuteComposerInstall( ): void { $localMachineHelper ->execute([ - 'composer', - 'install', - '--no-interaction', + 'composer', + 'install', + '--no-interaction', ], Argument::type('callable'), $this->projectDir, false, null) ->willReturn($process->reveal()) ->shouldBeCalled(); @@ -127,7 +127,7 @@ protected function mockDrupalSettingsRefresh( ): void { $localMachineHelper ->execute([ - '/ide/drupal-setup.sh', + '/ide/drupal-setup.sh', ]); } @@ -150,9 +150,9 @@ protected function mockGetLocalCommitHash( $process->isSuccessful()->willReturn(true)->shouldBeCalled(); $process->getOutput()->willReturn($commitHash)->shouldBeCalled(); $localMachineHelper->execute([ - 'git', - 'rev-parse', - 'HEAD', + 'git', + 'rev-parse', + 'HEAD', ], null, $cwd, false)->willReturn($process->reveal())->shouldBeCalled(); } @@ -181,9 +181,9 @@ protected function mockExecuteGitFetchAndCheckout( string $vcsPath ): void { $localMachineHelper->execute([ - 'git', - 'fetch', - '--all', + 'git', + 'fetch', + '--all', ], Argument::type('callable'), $cwd, false) ->willReturn($process->reveal()) ->shouldBeCalled(); @@ -193,9 +193,9 @@ protected function mockExecuteGitFetchAndCheckout( protected function mockExecuteGitCheckout(ObjectProphecy $localMachineHelper, string $vcsPath, string $cwd, ObjectProphecy $process): void { $localMachineHelper->execute([ - 'git', - 'checkout', - $vcsPath, + 'git', + 'checkout', + $vcsPath, ], Argument::type('callable'), $cwd, false) ->willReturn($process->reveal()) ->shouldBeCalled(); @@ -210,11 +210,11 @@ protected function mockExecuteRsync( $process = $this->mockProcess(); $localMachineHelper->checkRequiredBinariesExist(['rsync'])->shouldBeCalled(); $command = [ - 'rsync', - '-avPhze', - 'ssh -o StrictHostKeyChecking=no', - $environment->ssh_url . ':' . $sourceDir, - $destinationDir, + 'rsync', + '-avPhze', + 'ssh -o StrictHostKeyChecking=no', + $environment->ssh_url . ':' . $sourceDir, + $destinationDir, ]; $localMachineHelper->execute($command, Argument::type('callable'), null, true) ->willReturn($process->reveal()) @@ -229,12 +229,12 @@ protected function mockExecuteMySqlConnect( $process = $this->mockProcess($success); $localMachineHelper ->execute([ - 'mysql', - '--host', - $this->dbHost, - '--user', - 'drupal', - 'drupal', + 'mysql', + '--host', + $this->dbHost, + '--user', + 'drupal', + 'drupal', ], Argument::type('callable'), null, false, null, ['MYSQL_PWD' => 'drupal']) ->willReturn($process->reveal()) ->shouldBeCalled(); @@ -248,15 +248,15 @@ protected function mockExecuteMySqlListTables( $process = $this->mockProcess(); $process->getOutput()->willReturn('table1'); $command = [ - 'mysql', - '--host', - 'localhost', - '--user', - 'drupal', - $dbName, - '--silent', - '-e', - 'SHOW TABLES;', + 'mysql', + '--host', + 'localhost', + '--user', + 'drupal', + $dbName, + '--silent', + '-e', + 'SHOW TABLES;', ]; $localMachineHelper ->execute($command, Argument::type('callable'), null, false, null, ['MYSQL_PWD' => $this->dbPassword]) @@ -339,8 +339,8 @@ public function mockGetBackup(mixed $environment): void }; $backups = new BackupsResponse( $this->mockRequest('getEnvironmentsDatabaseBackups', [ - $environment->id, - 'my_db', + $environment->id, + 'my_db', ], null, null, $tamper) ); $this->mockDownloadBackup($databases[0], $environment, $backups[0]); @@ -370,16 +370,16 @@ protected function mockDownloadBackup(object $database, object $environment, obj $dbMachineName = 'db' . $database->id; } $filename = implode('-', [ - $environment->name, - $database->name, - $dbMachineName, - $backup->completedAt, + $environment->name, + $database->name, + $dbMachineName, + $backup->completedAt, ]) . '.sql.gz'; $localFilepath = Path::join(sys_get_temp_dir(), $filename); $this->clientProphecy->addOption('sink', $localFilepath)->shouldBeCalled(); $this->clientProphecy->addOption('curl.options', [ - 'CURLOPT_FILE' => $localFilepath, - 'CURLOPT_RETURNTRANSFER' => false, + 'CURLOPT_FILE' => $localFilepath, + 'CURLOPT_RETURNTRANSFER' => false, ])->shouldBeCalled(); $this->clientProphecy->addOption('progress', Argument::type('Closure'))->shouldBeCalled(); $this->clientProphecy->addOption('on_stats', Argument::type('Closure'))->shouldBeCalled(); diff --git a/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php b/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php index 0a6ede37d..5b9705c6c 100644 --- a/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php @@ -68,7 +68,7 @@ public function testPullDatabases(): void $this->mockExecuteDrushSqlSanitize($localMachineHelper, $process); $this->executeCommand([ - '--no-scripts' => false, + '--no-scripts' => false, ], self::inputChooseEnvironment()); $output = $this->getDisplay(); @@ -103,16 +103,16 @@ public function testPullProdDatabase(): void $localMachineHelper->getFilesystem()->willReturn($fs)->shouldBeCalled(); $this->executeCommand([ - '--no-scripts' => true, + '--no-scripts' => true, ], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, // Would you like to link the project at ... ? - 'n', + 'n', // Choose an Acquia environment: - 1, + 1, ]); $output = $this->getDisplay(); @@ -134,7 +134,7 @@ public function testPullDatabasesLocalConnectionFailure(): void $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('Unable to connect'); $this->executeCommand([ - '--no-scripts' => true, + '--no-scripts' => true, ], self::inputChooseEnvironment()); } @@ -154,7 +154,7 @@ public function testPullDatabaseNoPv(): void $fs->remove(Argument::type('string'))->shouldBeCalled(); $this->executeCommand([ - '--no-scripts' => true, + '--no-scripts' => true, ], self::inputChooseEnvironment()); $output = $this->getDisplay(); @@ -167,21 +167,21 @@ public function testPullMultipleDatabases(): void $this->setupPullDatabase(true, true, false, true, true); $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'n', + 'n', // Choose a Cloud Platform environment [Dev, dev (vcs: master)]: - 0, + 0, // Choose a site [jxr5000596dev (oracletest1.dev-profserv2.acsitefactory.com)]: - 0, + 0, // Choose databases. You may choose multiple. Use commas to separate choices. [profserv2 (default)]: - '10,27', + '10,27', ]; $this->executeCommand([ - '--multiple-dbs' => true, - '--no-scripts' => true, + '--multiple-dbs' => true, + '--no-scripts' => true, ], $inputs); } @@ -191,8 +191,8 @@ public function testPullDatabasesOnDemand(): void $inputs = self::inputChooseEnvironment(); $this->executeCommand([ - '--no-scripts' => true, - '--on-demand' => true, + '--no-scripts' => true, + '--on-demand' => true, ], $inputs); $output = $this->getDisplay(); @@ -211,7 +211,7 @@ public function testPullDatabasesNoExistingBackup(): void $inputs = self::inputChooseEnvironment(); $this->executeCommand([ - '--no-scripts' => true, + '--no-scripts' => true, ], $inputs); $output = $this->getDisplay(); @@ -231,8 +231,8 @@ public function testPullDatabasesSiteArgument(): void $inputs = self::inputChooseEnvironment(); $this->executeCommand([ - '--no-scripts' => true, - 'site' => 'jxr5000596dev', + '--no-scripts' => true, + 'site' => 'jxr5000596dev', ], $inputs); $output = $this->getDisplay(); @@ -260,7 +260,7 @@ public function testPullDatabaseWithMySqlDropError(): void $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('Unable to drop tables from database'); $this->executeCommand([ - '--no-scripts' => true, + '--no-scripts' => true, ], self::inputChooseEnvironment()); } @@ -281,7 +281,7 @@ public function testPullDatabaseWithMySqlImportError(): void $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('Unable to import local database'); $this->executeCommand([ - '--no-scripts' => true, + '--no-scripts' => true, ], self::inputChooseEnvironment()); } @@ -388,16 +388,16 @@ public function testPullNode(): void $this->expectException(AcquiaCliException::class); $this->expectExceptionMessage('No compatible environments found'); $this->executeCommand([ - '--no-scripts' => true, + '--no-scripts' => true, ], [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, // Would you like to link the project at ... ? - 'n', + 'n', // Choose an Acquia environment: - 1, + 1, ]); } } diff --git a/tests/phpunit/src/Commands/Pull/PullFilesCommandTest.php b/tests/phpunit/src/Commands/Pull/PullFilesCommandTest.php index f1acadef2..eab9c305b 100644 --- a/tests/phpunit/src/Commands/Pull/PullFilesCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullFilesCommandTest.php @@ -47,15 +47,15 @@ public function testRefreshAcsfFiles(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'n', + 'n', // Choose an Acquia environment: - 0, + 0, // Choose site from which to copy files: - 0, + 0, ]; $this->executeCommand([], $inputs); @@ -86,15 +86,15 @@ public function testRefreshCloudFiles(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'n', + 'n', // Choose an Acquia environment: - 0, + 0, // Choose site from which to copy files: - 0, + 0, ]; $this->executeCommand([], $inputs); diff --git a/tests/phpunit/src/Commands/Pull/PullScriptsCommandTest.php b/tests/phpunit/src/Commands/Pull/PullScriptsCommandTest.php index ccd4602a2..1e0bcaef2 100644 --- a/tests/phpunit/src/Commands/Pull/PullScriptsCommandTest.php +++ b/tests/phpunit/src/Commands/Pull/PullScriptsCommandTest.php @@ -36,17 +36,17 @@ public function testRefreshScripts(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'n', + 'n', // Choose an Acquia environment: - 0, + 0, ]; $this->executeCommand([ - '--dir' => $this->projectDir, + '--dir' => $this->projectDir, ], $inputs); $this->getDisplay(); diff --git a/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php b/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php index 4b2b62ded..ada794d0f 100644 --- a/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php +++ b/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php @@ -36,8 +36,8 @@ public function testNoAuthenticationRequired(): void public function providerTestPushArtifact(): array { return [ - [OutputInterface::VERBOSITY_NORMAL, false], - [OutputInterface::VERBOSITY_VERY_VERBOSE, true], + [OutputInterface::VERBOSITY_NORMAL, false], + [OutputInterface::VERBOSITY_VERY_VERBOSE, true], ]; } @@ -53,13 +53,13 @@ public function testPushArtifact(int $verbosity, bool $printOutput): void $this->setUpPushArtifact($localMachineHelper, $environments[0]->vcs->path, [$environments[0]->vcs->url], 'master:master', true, true, true, $printOutput); $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'y', + 'y', // Choose an Acquia environment: - 0, + 0, ]; $this->executeCommand([], $inputs, $verbosity); @@ -101,15 +101,15 @@ public function testPushTagArtifact(): void $this->mockGitTag($localMachineHelper, $gitTag, $artifactDir); $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'n', + 'n', ]; $this->executeCommand([ - '--destination-git-tag' => $gitTag, - '--source-git-tag' => '1.2.0', + '--destination-git-tag' => $gitTag, + '--source-git-tag' => '1.2.0', ], $inputs); $output = $this->getDisplay(); @@ -126,13 +126,13 @@ public function testPushArtifactWithAcquiaCliFile(): void $this->mockRequest('getApplicationByUuid', $applications[0]->uuid); $this->mockRequest('getApplicationEnvironments', $applications[0]->uuid); $this->datastoreAcli->set('push.artifact.destination-git-urls', [ - 'https://github.com/example1/cli.git', - 'https://github.com/example2/cli.git', + 'https://github.com/example1/cli.git', + 'https://github.com/example2/cli.git', ]); $localMachineHelper = $this->mockLocalMachineHelper(); $this->setUpPushArtifact($localMachineHelper, 'master', $this->datastoreAcli->get('push.artifact.destination-git-urls')); $this->executeCommand([ - '--destination-git-branch' => 'master', + '--destination-git-branch' => 'master', ]); $output = $this->getDisplay(); @@ -147,14 +147,14 @@ public function testPushArtifactWithArgs(): void $this->mockRequest('getApplicationByUuid', $applications[0]->uuid); $this->mockRequest('getApplicationEnvironments', $applications[0]->uuid); $destinationGitUrls = [ - 'https://github.com/example1/cli.git', - 'https://github.com/example2/cli.git', + 'https://github.com/example1/cli.git', + 'https://github.com/example2/cli.git', ]; $localMachineHelper = $this->mockLocalMachineHelper(); $this->setUpPushArtifact($localMachineHelper, 'master', $destinationGitUrls); $this->executeCommand([ - '--destination-git-branch' => 'master', - '--destination-git-urls' => $destinationGitUrls, + '--destination-git-branch' => 'master', + '--destination-git-urls' => $destinationGitUrls, ]); $output = $this->getDisplay(); @@ -172,13 +172,13 @@ public function testPushArtifactNoPush(): void $this->setUpPushArtifact($localMachineHelper, $environments[0]->vcs->path, [$environments[0]->vcs->url], 'master:master', true, true, false); $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'y', + 'y', // Choose an Acquia environment: - 0, + 0, ]; $this->executeCommand(['--no-push' => true], $inputs); @@ -198,13 +198,13 @@ public function testPushArtifactNoCommit(): void $this->setUpPushArtifact($localMachineHelper, $environments[0]->vcs->path, [$environments[0]->vcs->url], 'master:master', true, false, false); $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'y', + 'y', // Choose an Acquia environment: - 0, + 0, ]; $this->executeCommand(['--no-commit' => true], $inputs); @@ -221,13 +221,13 @@ public function testPushArtifactNoClone(): void $this->setUpPushArtifact($localMachineHelper, 'nothing', [], 'something', false, false, false); $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'y', + 'y', // Choose an Acquia environment: - 0, + 0, ]; $this->executeCommand(['--no-clone' => true], $inputs); @@ -318,16 +318,16 @@ protected function mockGitAddCommit(ObjectProphecy $localMachineHelper, string $ protected function mockReadComposerJson(ObjectProphecy $localMachineHelper, string $artifactDir): void { $composerJson = json_encode([ - 'extra' => [ - 'drupal-scaffold' => [ - 'file-mapping' => [ - '[web-root]/index.php' => [], - ], - ], - 'installer-paths' => [ - 'docroot/core' => [], - ], - ], + 'extra' => [ + 'drupal-scaffold' => [ + 'file-mapping' => [ + '[web-root]/index.php' => [], + ], + ], + 'installer-paths' => [ + 'docroot/core' => [], + ], + ], ]); $localMachineHelper->readFile(Path::join($this->projectDir, 'composer.json')) ->willReturn($composerJson); @@ -348,9 +348,9 @@ protected function mockGitTag(ObjectProphecy $localMachineHelper, string $gitTag { $process = $this->mockProcess(); $localMachineHelper->execute([ - 'git', - 'tag', - $gitTag, + 'git', + 'tag', + $gitTag, ], Argument::type('callable'), $artifactDir, true) ->willReturn($process->reveal())->shouldBeCalled(); } diff --git a/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php b/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php index 605dbbf70..ec295d15c 100644 --- a/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php +++ b/tests/phpunit/src/Commands/Push/PushDatabaseCommandTest.php @@ -26,8 +26,8 @@ class PushDatabaseCommandTest extends CommandTestBase public function providerTestPushDatabase(): array { return [ - [OutputInterface::VERBOSITY_NORMAL, false], - [OutputInterface::VERBOSITY_VERY_VERBOSE, true], + [OutputInterface::VERBOSITY_NORMAL, false], + [OutputInterface::VERBOSITY_VERY_VERBOSE, true], ]; } @@ -75,17 +75,17 @@ public function testPushDatabase(int $verbosity, bool $printOutput): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'n', + 'n', // Choose a Cloud Platform environment. - 0, + 0, // Choose a database. - 0, + 0, // Overwrite the profserv2 database on dev with a copy of the database from the current machine? - 'y', + 'y', ]; $this->executeCommand([], $inputs, $verbosity); @@ -109,11 +109,11 @@ protected function mockUploadDatabaseDump( ): void { $localMachineHelper->checkRequiredBinariesExist(['rsync'])->shouldBeCalled(); $command = [ - 'rsync', - '-tDvPhe', - 'ssh -o StrictHostKeyChecking=no', - sys_get_temp_dir() . '/acli-mysql-dump-drupal.sql.gz', - 'profserv2.01dev@profserv201dev.ssh.enterprise-g1.acquia-sites.com:/mnt/tmp/profserv2.01dev/acli-mysql-dump-drupal.sql.gz', + 'rsync', + '-tDvPhe', + 'ssh -o StrictHostKeyChecking=no', + sys_get_temp_dir() . '/acli-mysql-dump-drupal.sql.gz', + 'profserv2.01dev@profserv201dev.ssh.enterprise-g1.acquia-sites.com:/mnt/tmp/profserv2.01dev/acli-mysql-dump-drupal.sql.gz', ]; $localMachineHelper->execute($command, Argument::type('callable'), null, $printOutput, null) ->willReturn($process->reveal()) @@ -143,14 +143,14 @@ protected function mockGetAcsfSitesLMH(ObjectProphecy $localMachineHelper): void $multisiteConfig = file_get_contents(Path::join($this->realFixtureDir, '/multisite-config.json')); $acsfMultisiteFetchProcess->getOutput()->willReturn($multisiteConfig)->shouldBeCalled(); $cmd = [ - 0 => 'ssh', - 1 => 'profserv2.01dev@profserv201dev.ssh.enterprise-g1.acquia-sites.com', - 2 => '-t', - 3 => '-o StrictHostKeyChecking=no', - 4 => '-o AddressFamily inet', - 5 => '-o LogLevel=ERROR', - 6 => 'cat', - 7 => '/var/www/site-php/profserv2.01dev/multisite-config.json', + 0 => 'ssh', + 1 => 'profserv2.01dev@profserv201dev.ssh.enterprise-g1.acquia-sites.com', + 2 => '-t', + 3 => '-o StrictHostKeyChecking=no', + 4 => '-o AddressFamily inet', + 5 => '-o LogLevel=ERROR', + 6 => 'cat', + 7 => '/var/www/site-php/profserv2.01dev/multisite-config.json', ]; $localMachineHelper->execute($cmd, Argument::type('callable'), null, false, null)->willReturn($acsfMultisiteFetchProcess->reveal())->shouldBeCalled(); } @@ -158,13 +158,13 @@ protected function mockGetAcsfSitesLMH(ObjectProphecy $localMachineHelper): void private function mockImportDatabaseDumpOnRemote(ObjectProphecy|LocalMachineHelper $localMachineHelper, Process|ObjectProphecy $process, bool $printOutput = true): void { $cmd = [ - 0 => 'ssh', - 1 => 'profserv2.01dev@profserv201dev.ssh.enterprise-g1.acquia-sites.com', - 2 => '-t', - 3 => '-o StrictHostKeyChecking=no', - 4 => '-o AddressFamily inet', - 5 => '-o LogLevel=ERROR', - 6 => 'pv /mnt/tmp/profserv2.01dev/acli-mysql-dump-drupal.sql.gz --bytes --rate | gunzip | MYSQL_PWD=password mysql --host=fsdb-74.enterprise-g1.hosting.acquia.com.enterprise-g1.hosting.acquia.com --user=s164 profserv2db14390', + 0 => 'ssh', + 1 => 'profserv2.01dev@profserv201dev.ssh.enterprise-g1.acquia-sites.com', + 2 => '-t', + 3 => '-o StrictHostKeyChecking=no', + 4 => '-o AddressFamily inet', + 5 => '-o LogLevel=ERROR', + 6 => 'pv /mnt/tmp/profserv2.01dev/acli-mysql-dump-drupal.sql.gz --bytes --rate | gunzip | MYSQL_PWD=password mysql --host=fsdb-74.enterprise-g1.hosting.acquia.com.enterprise-g1.hosting.acquia.com --user=s164 profserv2db14390', ]; $localMachineHelper->execute($cmd, Argument::type('callable'), null, $printOutput, null) ->willReturn($process->reveal()) diff --git a/tests/phpunit/src/Commands/Push/PushFilesCommandTest.php b/tests/phpunit/src/Commands/Push/PushFilesCommandTest.php index 6bb9e5d34..f238e8f8a 100644 --- a/tests/phpunit/src/Commands/Push/PushFilesCommandTest.php +++ b/tests/phpunit/src/Commands/Push/PushFilesCommandTest.php @@ -32,17 +32,17 @@ public function testPushFilesAcsf(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'n', + 'n', // Choose a Cloud Platform environment. - 0, + 0, // Choose a site. - 0, + 0, // Overwrite the public files directory. - 'y', + 'y', ]; $this->executeCommand([], $inputs); @@ -71,17 +71,17 @@ public function testPushFilesCloud(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'n', + 'n', // Choose a Cloud Platform environment. - 0, + 0, // Choose a site. - 0, + 0, // Overwrite the public files directory. - 'y', + 'y', ]; $this->executeCommand([], $inputs); @@ -108,17 +108,17 @@ public function testPushFilesNoOverwrite(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - 0, + 0, // Would you like to link the project at ... ? - 'n', + 'n', // Choose a Cloud Platform environment. - 0, + 0, // Choose a site. - 0, + 0, // Overwrite the public files directory. - 'n', + 'n', ]; $this->executeCommand([], $inputs); @@ -141,11 +141,11 @@ protected function mockExecuteCloudRsync( $parts = explode('.', $environment->ssh_url); $sitegroup = reset($parts); $command = [ - 'rsync', - '-avPhze', - 'ssh -o StrictHostKeyChecking=no', - $this->projectDir . '/docroot/sites/bar/files/', - $environment->ssh_url . ':/mnt/files/' . $sitegroup . '.' . $environment->name . '/sites/bar/files', + 'rsync', + '-avPhze', + 'ssh -o StrictHostKeyChecking=no', + $this->projectDir . '/docroot/sites/bar/files/', + $environment->ssh_url . ':/mnt/files/' . $sitegroup . '.' . $environment->name . '/sites/bar/files', ]; $localMachineHelper->execute($command, Argument::type('callable'), null, true) ->willReturn($process->reveal()) @@ -159,11 +159,11 @@ protected function mockExecuteAcsfRsync( ): void { $localMachineHelper->checkRequiredBinariesExist(['rsync'])->shouldBeCalled(); $command = [ - 'rsync', - '-avPhze', - 'ssh -o StrictHostKeyChecking=no', - $this->projectDir . '/docroot/sites/' . $site . '/files/', - 'profserv2.01dev@profserv201dev.ssh.enterprise-g1.acquia-sites.com:/mnt/files/profserv2.01dev/sites/g/files/' . $site . '/files', + 'rsync', + '-avPhze', + 'ssh -o StrictHostKeyChecking=no', + $this->projectDir . '/docroot/sites/' . $site . '/files/', + 'profserv2.01dev@profserv201dev.ssh.enterprise-g1.acquia-sites.com:/mnt/files/profserv2.01dev/sites/g/files/' . $site . '/files', ]; $localMachineHelper->execute($command, Argument::type('callable'), null, true) ->willReturn($process->reveal()) diff --git a/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php b/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php index 62c479b2f..ffccdb5cc 100644 --- a/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php +++ b/tests/phpunit/src/Commands/Remote/AliasesDownloadCommandTest.php @@ -38,10 +38,10 @@ public function setUp(): void public function providerTestRemoteAliasesDownloadCommand(): array { return [ - [['9'], []], - [['9'], ['--destination-dir' => 'testdir'], 'testdir'], - [['9'], ['--all' => true], null, true], - [['8'], []], + [['9'], []], + [['9'], ['--destination-dir' => 'testdir'], 'testdir'], + [['9'], ['--all' => true], null, true], + [['8'], []], ]; } diff --git a/tests/phpunit/src/Commands/Remote/AliasesListCommandTest.php b/tests/phpunit/src/Commands/Remote/AliasesListCommandTest.php index 41fd60534..79358c209 100644 --- a/tests/phpunit/src/Commands/Remote/AliasesListCommandTest.php +++ b/tests/phpunit/src/Commands/Remote/AliasesListCommandTest.php @@ -26,11 +26,11 @@ public function testRemoteAliasesListCommand(): void $inputs = [ // Would you like Acquia CLI to search for a Cloud application that matches your local git config? - 'n', + 'n', // Select a Cloud Platform application: - '0', + '0', // Would you like to link the project at ... - 'n', + 'n', ]; $this->executeCommand([], $inputs); diff --git a/tests/phpunit/src/Commands/Remote/DrushCommandTest.php b/tests/phpunit/src/Commands/Remote/DrushCommandTest.php index 8eeef3751..7e7614525 100644 --- a/tests/phpunit/src/Commands/Remote/DrushCommandTest.php +++ b/tests/phpunit/src/Commands/Remote/DrushCommandTest.php @@ -25,18 +25,18 @@ protected function createCommand(): CommandBase public function providerTestRemoteDrushCommand(): array { return [ - [ - [ - '-vvv' => '', - 'drush_command' => 'status --fields=db-status', - ], - ], - [ - [ - '-vvv' => '', - 'drush_command' => 'status --fields=db-status', - ], - ], + [ + [ + '-vvv' => '', + 'drush_command' => 'status --fields=db-status', + ], + ], + [ + [ + '-vvv' => '', + 'drush_command' => 'status --fields=db-status', + ], + ], ]; } @@ -50,15 +50,15 @@ public function testRemoteDrushCommand(array $args): void [$process, $localMachineHelper] = $this->mockForExecuteCommand(); $localMachineHelper->checkRequiredBinariesExist(['ssh'])->shouldBeCalled(); $sshCommand = [ - 'ssh', - 'site.dev@sitedev.ssh.hosted.acquia-sites.com', - '-t', - '-o StrictHostKeyChecking=no', - '-o AddressFamily inet', - '-o LogLevel=ERROR', - 'cd /var/www/html/site.dev/docroot; ', - 'drush', - '--uri=http://sitedev.hosted.acquia-sites.com status --fields=db-status', + 'ssh', + 'site.dev@sitedev.ssh.hosted.acquia-sites.com', + '-t', + '-o StrictHostKeyChecking=no', + '-o AddressFamily inet', + '-o LogLevel=ERROR', + 'cd /var/www/html/site.dev/docroot; ', + 'drush', + '--uri=http://sitedev.hosted.acquia-sites.com status --fields=db-status', ]; $localMachineHelper ->execute($sshCommand, Argument::type('callable'), null, true, null) diff --git a/tests/phpunit/src/Commands/Remote/SshCommandTest.php b/tests/phpunit/src/Commands/Remote/SshCommandTest.php index 6d21e03ec..a6c50048b 100644 --- a/tests/phpunit/src/Commands/Remote/SshCommandTest.php +++ b/tests/phpunit/src/Commands/Remote/SshCommandTest.php @@ -30,13 +30,13 @@ public function testRemoteAliasesDownloadCommand(): void [$process, $localMachineHelper] = $this->mockForExecuteCommand(); $localMachineHelper->checkRequiredBinariesExist(['ssh'])->shouldBeCalled(); $sshCommand = [ - 'ssh', - 'site.dev@sitedev.ssh.hosted.acquia-sites.com', - '-t', - '-o StrictHostKeyChecking=no', - '-o AddressFamily inet', - '-o LogLevel=ERROR', - 'cd /var/www/html/devcloud2.dev; exec $SHELL -l', + 'ssh', + 'site.dev@sitedev.ssh.hosted.acquia-sites.com', + '-t', + '-o StrictHostKeyChecking=no', + '-o AddressFamily inet', + '-o LogLevel=ERROR', + 'cd /var/www/html/devcloud2.dev; exec $SHELL -l', ]; $localMachineHelper ->execute($sshCommand, Argument::type('callable'), null, true, null) @@ -46,7 +46,7 @@ public function testRemoteAliasesDownloadCommand(): void $this->command->sshHelper = new SshHelper($this->output, $localMachineHelper->reveal(), $this->logger); $args = [ - 'alias' => 'devcloud2.dev', + 'alias' => 'devcloud2.dev', ]; $this->executeCommand($args); diff --git a/tests/phpunit/src/Commands/Ssh/SshKeyCreateCommandTest.php b/tests/phpunit/src/Commands/Ssh/SshKeyCreateCommandTest.php index 8c856d7a4..b4536da83 100644 --- a/tests/phpunit/src/Commands/Ssh/SshKeyCreateCommandTest.php +++ b/tests/phpunit/src/Commands/Ssh/SshKeyCreateCommandTest.php @@ -28,40 +28,40 @@ protected function createCommand(): CommandBase public function providerTestCreate(): array { return [ - [ - true, + [ + true, // Args. - [ - '--filename' => $this->filename, - '--password' => 'acli123', - ], - // Inputs. - [], - ], - [ - true, - // Args. - [], - // Inputs. - [ - // Enter a filename for your new local SSH key: - $this->filename, - // Enter a password for your SSH key: - 'acli123', - ], - ], - [ - false, - // Args. - [], - // Inputs. - [ - // Enter a filename for your new local SSH key: - $this->filename, - // Enter a password for your SSH key: - 'acli123', - ], - ], + [ + '--filename' => $this->filename, + '--password' => 'acli123', + ], + // Inputs. + [], + ], + [ + true, + // Args. + [], + // Inputs. + [ + // Enter a filename for your new local SSH key: + $this->filename, + // Enter a password for your SSH key: + 'acli123', + ], + ], + [ + false, + // Args. + [], + // Inputs. + [ + // Enter a filename for your new local SSH key: + $this->filename, + // Enter a password for your SSH key: + 'acli123', + ], + ], ]; } diff --git a/tests/phpunit/src/Commands/Ssh/SshKeyCreateUploadCommandTest.php b/tests/phpunit/src/Commands/Ssh/SshKeyCreateUploadCommandTest.php index 8c11bf4c8..14f6aa555 100644 --- a/tests/phpunit/src/Commands/Ssh/SshKeyCreateUploadCommandTest.php +++ b/tests/phpunit/src/Commands/Ssh/SshKeyCreateUploadCommandTest.php @@ -22,8 +22,8 @@ public function setUp(mixed $output = null): void $this->getCommandTester(); $this->application->addCommands([ - $this->injectCommand(SshKeyCreateCommand::class), - $this->injectCommand(SshKeyUploadCommand::class), + $this->injectCommand(SshKeyCreateCommand::class), + $this->injectCommand(SshKeyUploadCommand::class), ]); } @@ -45,10 +45,10 @@ public function testCreateUpload(): void $this->mockGenerateSshKey($localMachineHelper, $mockRequestArgs['public_key']); $body = [ - 'json' => [ - 'label' => $mockRequestArgs['label'], - 'public_key' => $mockRequestArgs['public_key'], - ], + 'json' => [ + 'label' => $mockRequestArgs['label'], + 'public_key' => $mockRequestArgs['public_key'], + ], ]; $this->mockRequest('postAccountSshKeys', null, $body); $this->mockGetLocalSshKey($localMachineHelper, $fileSystem, $mockRequestArgs['public_key']); @@ -64,11 +64,11 @@ public function testCreateUpload(): void $inputs = [ // Enter a filename for your new local SSH key: - $sshKeyFilename, + $sshKeyFilename, // Enter a password for your SSH key: - 'acli123', + 'acli123', // Label. - $mockRequestArgs['label'], + $mockRequestArgs['label'], ]; $this->executeCommand(['--no-wait' => ''], $inputs); diff --git a/tests/phpunit/src/Commands/Ssh/SshKeyDeleteCommandTest.php b/tests/phpunit/src/Commands/Ssh/SshKeyDeleteCommandTest.php index 7df5b9621..7be735fd0 100644 --- a/tests/phpunit/src/Commands/Ssh/SshKeyDeleteCommandTest.php +++ b/tests/phpunit/src/Commands/Ssh/SshKeyDeleteCommandTest.php @@ -25,9 +25,9 @@ public function testDelete(): void $inputs = [ // Choose key. - self::$INPUT_DEFAULT_CHOICE, + self::$INPUT_DEFAULT_CHOICE, // Do you also want to delete the corresponding local key files? - 'n', + 'n', ]; $this->executeCommand([], $inputs); diff --git a/tests/phpunit/src/Commands/Ssh/SshKeyInfoCommandTest.php b/tests/phpunit/src/Commands/Ssh/SshKeyInfoCommandTest.php index 5f8fcf7eb..1289da0c9 100644 --- a/tests/phpunit/src/Commands/Ssh/SshKeyInfoCommandTest.php +++ b/tests/phpunit/src/Commands/Ssh/SshKeyInfoCommandTest.php @@ -28,7 +28,7 @@ public function testInfo(): void $inputs = [ // Choose key. - '0', + '0', ]; $this->executeCommand([], $inputs); diff --git a/tests/phpunit/src/Commands/Ssh/SshKeyUploadCommandTest.php b/tests/phpunit/src/Commands/Ssh/SshKeyUploadCommandTest.php index 7c8726054..4a2f25d22 100644 --- a/tests/phpunit/src/Commands/Ssh/SshKeyUploadCommandTest.php +++ b/tests/phpunit/src/Commands/Ssh/SshKeyUploadCommandTest.php @@ -26,39 +26,39 @@ public function providerTestUpload(): array { $sshKeysRequestBody = $this->getMockRequestBodyFromSpec('/account/ssh-keys'); return [ - [ + [ // Args. - [], + [], // Inputs. - [ + [ // Choose key. - '0', + '0', // Enter a Cloud Platform label for this SSH key: - $sshKeysRequestBody['label'], + $sshKeysRequestBody['label'], // Would you like to wait until Cloud Platform is ready? (yes/no) - 'y', + 'y', // Would you like Acquia CLI to search for a Cloud application that matches your local git config? (yes/no) - 'n', - ], - // Perms. - true, - ], - [ - // Args. - [ - '--filepath' => 'id_rsa.pub', - '--label' => $sshKeysRequestBody['label'], - ], - // Inputs. - [ - // Would you like to wait until Cloud Platform is ready? (yes/no) - 'y', - // Would you like Acquia CLI to search for a Cloud application that matches your local git config? (yes/no) - 'n', - ], - // Perms. - false, - ], + 'n', + ], + // Perms. + true, + ], + [ + // Args. + [ + '--filepath' => 'id_rsa.pub', + '--label' => $sshKeysRequestBody['label'], + ], + // Inputs. + [ + // Would you like to wait until Cloud Platform is ready? (yes/no) + 'y', + // Would you like Acquia CLI to search for a Cloud application that matches your local git config? (yes/no) + 'n', + ], + // Perms. + false, + ], ]; } @@ -69,10 +69,10 @@ public function testUpload(array $args, array $inputs, bool $perms): void { $sshKeysRequestBody = $this->getMockRequestBodyFromSpec('/account/ssh-keys'); $body = [ - 'json' => [ - 'label' => $sshKeysRequestBody['label'], - 'public_key' => $sshKeysRequestBody['public_key'], - ], + 'json' => [ + 'label' => $sshKeysRequestBody['label'], + 'public_key' => $sshKeysRequestBody['public_key'], + ], ]; $this->mockRequest('postAccountSshKeys', null, $body); $this->mockListSshKeyRequestWithUploadedKey($sshKeysRequestBody); @@ -111,10 +111,10 @@ public function testUploadNode(): void { $sshKeysRequestBody = $this->getMockRequestBodyFromSpec('/account/ssh-keys'); $body = [ - 'json' => [ - 'label' => $sshKeysRequestBody['label'], - 'public_key' => $sshKeysRequestBody['public_key'], - ], + 'json' => [ + 'label' => $sshKeysRequestBody['label'], + 'public_key' => $sshKeysRequestBody['public_key'], + ], ]; $this->mockRequest('postAccountSshKeys', null, $body); $this->mockListSshKeyRequestWithUploadedKey($sshKeysRequestBody); @@ -144,13 +144,13 @@ public function testUploadNode(): void // Choose a local SSH key to upload to the Cloud Platform. $inputs = [ // Choose key. - '0', + '0', // Enter a Cloud Platform label for this SSH key: - $sshKeysRequestBody['label'], + $sshKeysRequestBody['label'], // Would you like to wait until Cloud Platform is ready? (yes/no) - 'y', + 'y', // Would you like Acquia CLI to search for a Cloud application that matches your local git config? (yes/no) - 'n', + 'n', ]; $this->executeCommand([], $inputs); @@ -165,9 +165,9 @@ public function testInvalidFilepath(): void { $inputs = [ // Choose key. - '0', + '0', // Label. - 'Test', + 'Test', ]; $filepath = Path::join(sys_get_temp_dir(), 'notarealfile'); $args = ['--filepath' => $filepath]; diff --git a/tests/phpunit/src/Commands/TelemetryCommandTest.php b/tests/phpunit/src/Commands/TelemetryCommandTest.php index 3b94f8fe4..6df390c61 100644 --- a/tests/phpunit/src/Commands/TelemetryCommandTest.php +++ b/tests/phpunit/src/Commands/TelemetryCommandTest.php @@ -52,11 +52,11 @@ public function testTelemetryCommand(): void public function providerTestTelemetryPrompt(): array { return [ - [ + [ // Would you like to share anonymous performance usage and data? - ['n'], - 'Ok, no data will be collected and shared with us.', - ], + ['n'], + 'Ok, no data will be collected and shared with us.', + ], ]; } diff --git a/tests/phpunit/src/Commands/WizardTestBase.php b/tests/phpunit/src/Commands/WizardTestBase.php index 63f39ecd8..34cab7360 100644 --- a/tests/phpunit/src/Commands/WizardTestBase.php +++ b/tests/phpunit/src/Commands/WizardTestBase.php @@ -29,9 +29,9 @@ public function setUp(): void parent::setUp(); $this->getCommandTester(); $this->application->addCommands([ - $this->injectCommand(SshKeyCreateCommand::class), - $this->injectCommand(SshKeyDeleteCommand::class), - $this->injectCommand(SshKeyUploadCommand::class), + $this->injectCommand(SshKeyCreateCommand::class), + $this->injectCommand(SshKeyDeleteCommand::class), + $this->injectCommand(SshKeyUploadCommand::class), ]); } @@ -47,7 +47,7 @@ protected function tearDown(): void public static function getEnvVars(): array { return [ - 'ACQUIA_APPLICATION_UUID' => self::$applicationUuid, + 'ACQUIA_APPLICATION_UUID' => self::$applicationUuid, ]; } @@ -58,10 +58,10 @@ protected function runTestCreate(): void $request = $this->getMockRequestBodyFromSpec('/account/ssh-keys'); $body = [ - 'json' => [ - 'label' => 'IDE_ExampleIDE_215824ff272a4a8c9027df32ed1d68a9', - 'public_key' => $request['public_key'], - ], + 'json' => [ + 'label' => 'IDE_ExampleIDE_215824ff272a4a8c9027df32ed1d68a9', + 'public_key' => $request['public_key'], + ], ]; $this->mockRequest('postAccountSshKeys', null, $body); @@ -95,7 +95,7 @@ protected function runTestCreate(): void // Set properties and execute. $this->executeCommand([], [ // Would you like to link the project at ... ? - 'y', + 'y', ]); // Assertions. @@ -129,10 +129,10 @@ protected function runTestSshKeyAlreadyUploaded(): void $localMachineHelper = $this->mockLocalMachineHelper(); $body = [ - 'json' => [ - 'label' => 'IDE_ExampleIDE_215824ff272a4a8c9027df32ed1d68a9', - 'public_key' => $mockRequestArgs['public_key'], - ], + 'json' => [ + 'label' => 'IDE_ExampleIDE_215824ff272a4a8c9027df32ed1d68a9', + 'public_key' => $mockRequestArgs['public_key'], + ], ]; $this->mockRequest('postAccountSshKeys', null, $body); @@ -164,7 +164,7 @@ protected function runTestSshKeyAlreadyUploaded(): void protected function getOutputStrings(): array { return [ - "Setting GitLab CI/CD variables for", + "Setting GitLab CI/CD variables for", ]; } } diff --git a/tests/phpunit/src/Misc/EnvDbCredsTest.php b/tests/phpunit/src/Misc/EnvDbCredsTest.php index 3bbff0c8b..4444804a7 100644 --- a/tests/phpunit/src/Misc/EnvDbCredsTest.php +++ b/tests/phpunit/src/Misc/EnvDbCredsTest.php @@ -41,10 +41,10 @@ public function tearDown(): void protected function getEnvVars(): array { return [ - 'ACLI_DB_HOST' => $this->dbHost, - 'ACLI_DB_NAME' => $this->dbName, - 'ACLI_DB_PASSWORD' => $this->dbPassword, - 'ACLI_DB_USER' => $this->dbUser, + 'ACLI_DB_HOST' => $this->dbHost, + 'ACLI_DB_NAME' => $this->dbName, + 'ACLI_DB_PASSWORD' => $this->dbPassword, + 'ACLI_DB_USER' => $this->dbUser, ]; } diff --git a/tests/phpunit/src/Misc/ExceptionListenerTest.php b/tests/phpunit/src/Misc/ExceptionListenerTest.php index 95517e376..b38af09d9 100644 --- a/tests/phpunit/src/Misc/ExceptionListenerTest.php +++ b/tests/phpunit/src/Misc/ExceptionListenerTest.php @@ -49,66 +49,66 @@ public function testHelp(Throwable $error, string|array $helpText): void public function providerTestHelp(): array { return [ - [ - new IdentityProviderException('invalid_client', 0, ''), - 'Run acli auth:login to reset your API credentials.', - ], - [ - new RuntimeException('Not enough arguments (missing: "environmentId").'), - self::$siteAliasHelp, - ], - [ - new RuntimeException('Not enough arguments (missing: "environmentUuid").'), - self::$siteAliasHelp, - ], - [ - new AcquiaCliException('No applications match the alias {applicationAlias}'), - self::$appAliasHelp, - ], - [ - new AcquiaCliException('Multiple applications match the alias {applicationAlias}'), - self::$appAliasHelp, - ], - [ - new AcquiaCliException('{environmentId} must be a valid UUID or site alias.'), - self::$siteAliasHelp, - ], - [ - new AcquiaCliException('{environmentUuid} must be a valid UUID or site alias.'), - self::$siteAliasHelp, - ], - [ - new AcquiaCliException('Access token file not found at {file}'), - 'Get help for this error at https://docs.acquia.com/ide/known-issues/#the-automated-cloud-platform-api-authentication-might-fail', - ], - [ - new AcquiaCliException('Access token expiry file not found at {file}'), - 'Get help for this error at https://docs.acquia.com/ide/known-issues/#the-automated-cloud-platform-api-authentication-might-fail', - ], - [ - new AcquiaCliException('This machine is not yet authenticated with the Cloud Platform.'), - 'Run `acli auth:login` to re-authenticated with the Cloud Platform.', - ], - [ - new AcquiaCliException('This machine is not yet authenticated with Site Factory.'), - 'Run `acli auth:acsf-login` to re-authenticate with Site Factory.', - ], - [ - new AcquiaCliException('Could not extract aliases to {destination}'), - 'Check that you have write access to the directory', - ], - [ - new ApiErrorException((object) ['error' => '', 'message' => "There are no available Cloud IDEs for this application.\n"]), - 'Delete an existing IDE via acli ide:delete or contact your Account Manager or Acquia Sales to purchase additional IDEs.', - ], - [ - new ApiErrorException((object) ['error' => '', 'message' => 'This resource requires additional authentication.']), - ['This is likely because you have Federated Authentication required for your organization.', 'Run `acli login` to authenticate via API token and then try again.'], - ], - [ - new ApiErrorException((object) ['error' => 'asdf', 'message' => 'fdsa']), - 'You can learn more about Cloud Platform API at https://docs.acquia.com/cloud-platform/develop/api/', - ], + [ + new IdentityProviderException('invalid_client', 0, ''), + 'Run acli auth:login to reset your API credentials.', + ], + [ + new RuntimeException('Not enough arguments (missing: "environmentId").'), + self::$siteAliasHelp, + ], + [ + new RuntimeException('Not enough arguments (missing: "environmentUuid").'), + self::$siteAliasHelp, + ], + [ + new AcquiaCliException('No applications match the alias {applicationAlias}'), + self::$appAliasHelp, + ], + [ + new AcquiaCliException('Multiple applications match the alias {applicationAlias}'), + self::$appAliasHelp, + ], + [ + new AcquiaCliException('{environmentId} must be a valid UUID or site alias.'), + self::$siteAliasHelp, + ], + [ + new AcquiaCliException('{environmentUuid} must be a valid UUID or site alias.'), + self::$siteAliasHelp, + ], + [ + new AcquiaCliException('Access token file not found at {file}'), + 'Get help for this error at https://docs.acquia.com/ide/known-issues/#the-automated-cloud-platform-api-authentication-might-fail', + ], + [ + new AcquiaCliException('Access token expiry file not found at {file}'), + 'Get help for this error at https://docs.acquia.com/ide/known-issues/#the-automated-cloud-platform-api-authentication-might-fail', + ], + [ + new AcquiaCliException('This machine is not yet authenticated with the Cloud Platform.'), + 'Run `acli auth:login` to re-authenticated with the Cloud Platform.', + ], + [ + new AcquiaCliException('This machine is not yet authenticated with Site Factory.'), + 'Run `acli auth:acsf-login` to re-authenticate with Site Factory.', + ], + [ + new AcquiaCliException('Could not extract aliases to {destination}'), + 'Check that you have write access to the directory', + ], + [ + new ApiErrorException((object) ['error' => '', 'message' => "There are no available Cloud IDEs for this application.\n"]), + 'Delete an existing IDE via acli ide:delete or contact your Account Manager or Acquia Sales to purchase additional IDEs.', + ], + [ + new ApiErrorException((object) ['error' => '', 'message' => 'This resource requires additional authentication.']), + ['This is likely because you have Federated Authentication required for your organization.', 'Run `acli login` to authenticate via API token and then try again.'], + ], + [ + new ApiErrorException((object) ['error' => 'asdf', 'message' => 'fdsa']), + 'You can learn more about Cloud Platform API at https://docs.acquia.com/cloud-platform/develop/api/', + ], ]; } } diff --git a/tests/phpunit/src/Misc/LocalMachineHelperTest.php b/tests/phpunit/src/Misc/LocalMachineHelperTest.php index a9ac9b51d..18d97bb50 100644 --- a/tests/phpunit/src/Misc/LocalMachineHelperTest.php +++ b/tests/phpunit/src/Misc/LocalMachineHelperTest.php @@ -26,9 +26,9 @@ public function testStartBrowser(): void public function providerTestExecuteFromCmd(): array { return [ - [false, null, null], - [false, false, false], - [true, false, false], + [false, null, null], + [false, false, false], + [true, false, false], ]; } @@ -70,11 +70,11 @@ public function testCommandExists(): void public function testHomeDirWindowsCmd(): void { self::setEnvVars([ - 'HOMEPATH' => 'something', + 'HOMEPATH' => 'something', ]); self::unsetEnvVars([ - 'MSYSTEM', - 'HOME', + 'MSYSTEM', + 'HOME', ]); $home = LocalMachineHelper::getHomeDir(); $this->assertEquals('something', $home); @@ -83,8 +83,8 @@ public function testHomeDirWindowsCmd(): void public function testHomeDirWindowsMsys2(): void { self::setEnvVars([ - 'HOMEPATH' => 'something', - 'MSYSTEM' => 'MSYS2', + 'HOMEPATH' => 'something', + 'MSYSTEM' => 'MSYS2', ]); self::unsetEnvVars(['HOME']); $home = LocalMachineHelper::getHomeDir(); diff --git a/tests/phpunit/src/Misc/TelemetryHelperTest.php b/tests/phpunit/src/Misc/TelemetryHelperTest.php index 709ba842b..7e4c2d57d 100644 --- a/tests/phpunit/src/Misc/TelemetryHelperTest.php +++ b/tests/phpunit/src/Misc/TelemetryHelperTest.php @@ -80,14 +80,14 @@ public function testGetEnvironmentProviderWithoutAnyEnvSet(): void public function providerTestAhEnvNormalization(): array { return [ - ['prod', 'prod'], - ['01live', 'prod'], - ['stage', 'stage'], - ['stg', 'stage'], - ['dev1', 'dev'], - ['ode1', 'ode'], - ['ide', 'ide'], - ['fake', 'fake'], + ['prod', 'prod'], + ['01live', 'prod'], + ['stage', 'stage'], + ['stg', 'stage'], + ['dev1', 'dev'], + ['ode1', 'ode'], + ['ide', 'ide'], + ['fake', 'fake'], ]; } diff --git a/tests/phpunit/src/TestBase.php b/tests/phpunit/src/TestBase.php index efe15ed6c..a51ec15d2 100644 --- a/tests/phpunit/src/TestBase.php +++ b/tests/phpunit/src/TestBase.php @@ -162,8 +162,8 @@ public function setupFsFixture(): void protected function setUp(): void { self::setEnvVars([ - 'COLUMNS' => '85', - 'HOME' => '/home/test', + 'COLUMNS' => '85', + 'HOME' => '/home/test', ]); $this->output = new BufferedOutput(); $this->input = new ArrayInput([]); @@ -423,15 +423,15 @@ protected function createMockCloudConfigFile(mixed $defaultValues = []): void { if (!$defaultValues) { $defaultValues = [ - 'acli_key' => $this->key, - 'keys' => [ - (string) ($this->key) => [ - 'label' => 'Test Key', - 'secret' => $this->secret, - 'uuid' => $this->key, - ], - ], - DataStoreContract::SEND_TELEMETRY => false, + 'acli_key' => $this->key, + 'keys' => [ + (string) ($this->key) => [ + 'label' => 'Test Key', + 'secret' => $this->secret, + 'uuid' => $this->key, + ], + ], + DataStoreContract::SEND_TELEMETRY => false, ]; } $cloudConfig = array_merge($defaultValues, $this->cloudConfig); @@ -504,8 +504,8 @@ public function mockApplicationsRequest(int $count = 2, bool $unique = true): ob public function mockUnauthorizedRequest(): void { $response = [ - 'error' => 'invalid_client', - 'error_description' => 'Client credentials were not found in the headers or body', + 'error' => 'invalid_client', + 'error_description' => 'Client credentials were not found in the headers or body', ]; $this->clientProphecy->request('get', Argument::type('string')) ->willThrow(new IdentityProviderException($response['error'], 0, $response)); @@ -514,8 +514,8 @@ public function mockUnauthorizedRequest(): void public function mockApiError(): void { $response = (object) [ - 'error' => 'some error', - 'message' => 'some error', + 'error' => 'some error', + 'message' => 'some error', ]; $this->clientProphecy->request('get', Argument::type('string')) ->willThrow(new ApiErrorException($response, $response->message)); @@ -524,8 +524,8 @@ public function mockApiError(): void public function mockNoAvailableIdes(): void { $response = (object) [ - 'error' => "There are no available Cloud IDEs for this application.\n", - 'message' => "There are no available Cloud IDEs for this application.\n", + 'error' => "There are no available Cloud IDEs for this application.\n", + 'message' => "There are no available Cloud IDEs for this application.\n", ]; $this->clientProphecy->request('get', Argument::type('string')) ->willThrow(new ApiErrorException($response, $response->message)); @@ -558,9 +558,9 @@ protected function mockPermissionsRequest(mixed $applicationResponse, mixed $per ); if (!$perms) { $deletePerms = [ - 'add ssh key to git', - 'add ssh key to non-prod', - 'add ssh key to prod', + 'add ssh key to git', + 'add ssh key to non-prod', + 'add ssh key to prod', ]; foreach ($permissionsResponse->_embedded->items as $index => $item) { if (in_array($item->name, $deletePerms, true)) { @@ -663,8 +663,8 @@ protected function mockSshAgentList(ObjectProphecy|LocalMachineHelper $localMach $localMachineHelper->getLocalFilepath($this->passphraseFilepath) ->willReturn('/tmp/.passphrase'); $localMachineHelper->execute([ - 'ssh-add', - '-L', + 'ssh-add', + '-L', ], null, null, false)->shouldBeCalled()->willReturn($process->reveal()); } @@ -694,9 +694,9 @@ protected function mockStartPhp(ObjectProphecy|LocalMachineHelper $localMachineH $process->isSuccessful()->willReturn(true); $process->getExitCode()->willReturn(0); $localMachineHelper->execute([ - 'supervisorctl', - 'start', - 'php-fpm', + 'supervisorctl', + 'start', + 'php-fpm', ], null, null, false)->willReturn($process->reveal())->shouldBeCalled(); return $process; } @@ -707,9 +707,9 @@ protected function mockStopPhp(ObjectProphecy|LocalMachineHelper $localMachineHe $process->isSuccessful()->willReturn(true); $process->getExitCode()->willReturn(0); $localMachineHelper->execute([ - 'supervisorctl', - 'stop', - 'php-fpm', + 'supervisorctl', + 'stop', + 'php-fpm', ], null, null, false)->willReturn($process->reveal())->shouldBeCalled(); return $process; } @@ -720,9 +720,9 @@ protected function mockRestartPhp(ObjectProphecy|LocalMachineHelper $localMachin $process->isSuccessful()->willReturn(true); $process->getExitCode()->willReturn(0); $localMachineHelper->execute([ - 'supervisorctl', - 'restart', - 'php-fpm', + 'supervisorctl', + 'restart', + 'php-fpm', ], null, null, false)->willReturn($process->reveal())->shouldBeCalled(); return $process; }