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

Conversation

rahulgupta-acquia
Copy link
Contributor

@rahulgupta-acquia rahulgupta-acquia commented Jan 18, 2025

Motivation

Fixes CLI-1435

Proposed changes

Alternatives considered

Testing steps

  1. Follow the contribution guide to set up your development environment or download a pre-built acli.phar for this PR.
  2. If running from source, clear the kernel cache to pick up new and changed commands: ./bin/acli ckc
  3. Run pull:files and select an ACSF environment with no sites deployed
  4. Observe that the command exits gracefully instead of throwing an undefined array error.

Copy link

codecov bot commented Jan 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.92%. Comparing base (304cc82) to head (81d261d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1844   +/-   ##
=========================================
  Coverage     92.92%   92.92%           
- Complexity     1846     1847    +1     
=========================================
  Files           123      123           
  Lines          6964     6966    +2     
=========================================
+ Hits           6471     6473    +2     
  Misses          493      493           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Try the dev build for this PR: https://acquia-cli.s3.amazonaws.com/build/pr/1844/acli.phar

curl -OL https://acquia-cli.s3.amazonaws.com/build/pr/1844/acli.phar
chmod +x acli.phar

@@ -1517,6 +1517,10 @@ private function promptChooseAcsfSite(EnvironmentResponse $cloudEnvironment): mi
foreach ($acsfSites['sites'] as $domain => $acsfSite) {
$choices[] = "{$acsfSite['name']} ($domain)";
}
if (!count($choices)) {
throw new AcquiaCliException("Could not get ACSF sites");
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.

@rahulgupta-acquia rahulgupta-acquia added the bug Something isn't working label Jan 22, 2025
@danepowell danepowell marked this pull request as ready for review January 23, 2025 20:29
@danepowell danepowell merged commit 4d64180 into main Jan 23, 2025
22 checks passed
@danepowell danepowell deleted the CLI-1435 branch January 23, 2025 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants