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-1435: PHP error - undefined array key handled in pull command #1844

Merged
merged 9 commits into from
Jan 23, 2025
4 changes: 4 additions & 0 deletions src/Command/CommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,10 @@
foreach ($acsfSites['sites'] as $domain => $acsfSite) {
$choices[] = "{$acsfSite['name']} ($domain)";
}
if (!count($choices)) {
throw new AcquiaCliException("Could not get ACSF sites");

Check warning on line 1521 in src/Command/CommandBase.php

View check run for this annotation

Codecov / codecov/patch

src/Command/CommandBase.php#L1521

Added line #L1521 was not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll need to add a test case to cover this line. I'd suggest copying testRefreshAcsfFiles from PullFilesCommandTest.php and modify it to expect this exception. You'll need to modify mockGetAcsfSites() to return 0 sites to trigger the exception.

}

$choice = $this->io->choice('Choose a site', $choices, $choices[0]);
$key = array_search($choice, $choices, true);
$sites = array_values($acsfSites['sites']);
Expand Down
Loading