Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI-1175: [app:new:from:drupal7] argument path must be of type string #1632

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/Command/App/NewFromDrupal7Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

protected function configure(): void {
$this->setDescription('Generate a new Drupal 9+ project from a Drupal 7 application using the default Acquia Migrate Accelerate recommendations.')
->addOption('drupal7-directory', 'source', InputOption::VALUE_OPTIONAL, 'The root of the Drupal 7 application.')
->addOption('drupal7-directory', 'source', InputOption::VALUE_OPTIONAL, 'The root of the Drupal 7 application')
->addOption('drupal7-uri', 'uri', InputOption::VALUE_OPTIONAL, 'Only necessary in case of a multisite. If a single site, this will be computed automatically.')
->addOption('stored-analysis', 'analysis', InputOption::VALUE_OPTIONAL, 'As an alternative to drupal7-directory, it is possible to pass a stored analysis.')
->addOption('recommendations', 'recommendations', InputOption::VALUE_OPTIONAL, 'Overrides the default recommendations.')
Expand All @@ -66,15 +66,7 @@
}

// First: Determine the Drupal 7 root.
if ($input->getOption('drupal7-directory') === NULL) {
$answer = $this->io->ask(
'What is the root of the Drupal 7 application you want to generate a new Drupal project for?',
NULL,
[Drupal7SiteInspector::class, 'validateDrupal7Root'],
);
$input->setOption('drupal7-directory', $answer);
}
$d7_root = $input->getOption('drupal7-directory');
$d7_root = $this->determineOption('drupal7-directory', FALSE, Drupal7SiteInspector::validateDrupal7Root(...), NULL, '.');

Check warning on line 69 in src/Command/App/NewFromDrupal7Command.php

View check run for this annotation

Codecov / codecov/patch

src/Command/App/NewFromDrupal7Command.php#L69

Added line #L69 was not covered by tests
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't covered in the first place. I wish it was...


// Second, determine which "sites" subdirectory is being assessed.
$uri = Drupal7SiteInspector::getSiteUri($input, $d7_root);
Expand Down
4 changes: 2 additions & 2 deletions src/Command/CommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ protected function promptOpenBrowserToCreateToken(
}

protected function determineApiKey(): string {
return $this->determineOption('key', FALSE, Closure::fromCallable([$this, 'validateApiKey']));
return $this->determineOption('key', FALSE, $this->validateApiKey(...));
}

private function validateApiKey(mixed $key): string {
Expand All @@ -1343,7 +1343,7 @@ private function validateApiKey(mixed $key): string {
}

protected function determineApiSecret(): string {
return $this->determineOption('secret', TRUE, Closure::fromCallable([$this, 'validateApiKey']));
return $this->determineOption('secret', TRUE, $this->validateApiKey(...));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Ide/IdeCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$accountResource = new Account($acquiaCloudClient);
$account = $accountResource->get();
$default = "$account->first_name $account->last_name's IDE";
$ideLabel = $this->determineOption('label', FALSE, \Closure::fromCallable([$this, 'validateIdeLabel']), NULL, $default);
$ideLabel = $this->determineOption('label', FALSE, $this->validateIdeLabel(...), NULL, $default);

// Create it.
$checklist->addItem('Creating your Cloud IDE');
Expand Down
7 changes: 3 additions & 4 deletions src/Command/Ssh/SshKeyCommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use AcquiaCloudApi\Connector\Client;
use AcquiaCloudApi\Endpoints\SshKeys;
use AcquiaCloudApi\Response\IdeResponse;
use Closure;
use React\EventLoop\Loop;
use RuntimeException;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -247,7 +246,7 @@ protected function determineFilename(): string {
return $this->determineOption(
'filename',
FALSE,
Closure::fromCallable([$this, 'validateFilename']),
$this->validateFilename(...),
static function (mixed $value) {
return $value ? trim($value) : '';},
'id_rsa_acquia'
Expand All @@ -271,7 +270,7 @@ protected function determinePassword(): string {
return $this->determineOption(
'password',
TRUE,
Closure::fromCallable([$this, 'validatePassword']),
$this->validatePassword(...),
static function (mixed $value) {
return $value ? trim($value) : '';
}
Expand Down Expand Up @@ -344,7 +343,7 @@ private function promptChooseLocalSshKey(array $localKeys): string {
}

protected function determineSshKeyLabel(): string {
return $this->determineOption('label', FALSE, Closure::fromCallable([$this, 'validateSshKeyLabel']), Closure::fromCallable([$this, 'normalizeSshKeyLabel']));
return $this->determineOption('label', FALSE, $this->validateSshKeyLabel(...), $this->normalizeSshKeyLabel(...));
}

private function validateSshKeyLabel(mixed $label): mixed {
Expand Down