-
Notifications
You must be signed in to change notification settings - Fork 55
CLI-1671 : Attempt to assign property "site" on null fix #1952
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1952 +/- ##
============================================
+ Coverage 92.05% 92.31% +0.26%
- Complexity 1894 1895 +1
============================================
Files 122 122
Lines 6959 6961 +2
============================================
+ Hits 6406 6426 +20
+ Misses 553 535 -18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Try the dev build for this PR: https://acquia-cli.s3.amazonaws.com/build/pr/1952/acli.phar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a null pointer exception (CLI-1671) by adding a null check before attempting to assign a property to a potentially null site instance object. The fix prevents the error "Attempt to assign property 'site' on null" by throwing an appropriate exception when getSiteInstance() returns null.
Key Changes:
- Added null check for site instance in
determineSiteInstance()method before property assignment - Added comprehensive test coverage for the null check scenario
- Added tests for visibility and successful path scenarios
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/Command/CommandBase.php | Added null check (lines 885-887) to prevent assignment to null object |
| tests/phpunit/src/Commands/CommandBaseTest.php | Added 5 new tests covering the null check fix, successful path, and method visibility |
| tests/phpunit/src/Commands/Api/ApiCommandTest.php | Added 3 tests for API command help text (appears unrelated to main fix) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
danepowell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, but why do we need 300 lines of test cases for a three-line code change? I would expect to see just a single new test case.
d40d374 to
b89a840
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Motivation
Fixes #NNN
Proposed changes
Alternatives considered
Testing steps
./bin/acli ckc