Fix status check in `PackageProxyContainer`
Please check if the PR fulfills these requirements
- [x] The commit message follows our guidelines
- [x] Tests for the changes have been added (for bug fixes/features)
- [x] Docs have been added/updated (for bug fixes/features)
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix.
What is the current behavior? (You can also link to an open issue here)
A connected package's services can not be accessed if the package is "built"
What is the new behavior (if this is a feature change)?
A connected package's services can be accessed if the package is "built".
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No.
Other information:
The implementation of Package::connect() predates the implementation of Package::built().
Before Package::built() was introduced in 1.7.0 it was only safe to access a Package's container after having called Package::boot().
Now, we can do $package->build()->container() without issues.
The implementation of PackageProxyContainer was not updated when we introduced Package::built(), so we can still not access services from connected packages if they are not booted.
This means using built() early and boot() later, which is the reason why we introduced built() in the first place is "dangerous" because if someone connects a built package and tries to access its services they will get an exception.
I committed a test to master that tests there the bug, and this test is merged back into this branch to prove this is now solved.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 98.42%. Comparing base (
bd65297) to head (5c6b990). Report is 6 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #49 +/- ##
============================================
- Coverage 98.93% 98.42% -0.52%
- Complexity 234 238 +4
============================================
Files 10 10
Lines 566 570 +4
============================================
+ Hits 560 561 +1
- Misses 6 9 +3
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 98.42% <100.00%> (-0.52%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.