-
Notifications
You must be signed in to change notification settings - Fork 3
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
Adding getWorkers
method
#35
Conversation
WalkthroughThis update focuses on enhancing the encapsulation and immutability of the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- src/Informer/Workers.php (1 hunks)
- tests/Unit/Informer/WorkersTest.php (1 hunks)
Additional comments: 3
src/Informer/Workers.php (2)
- 13-13: The change to make the
$workers
property private and readonly is a good practice for encapsulation, ensuring that the property can only be modified within the class constructor and accessed through specific methods. This aligns well with the principles of object-oriented design.- 17-23: The
getWorkers
method is correctly implemented to provide access to theworkers
array. It adheres to the encapsulation principle by allowing external entities to retrieve the array without directly accessing the private property. The method signature and return type are clear and consistent with the expected functionality.tests/Unit/Informer/WorkersTest.php (1)
- 13-22: The
testGetWorkers
method is well-structured and tests two scenarios: 1) Retrieving workers from an emptyWorkers
instance, and 2) Retrieving workers from aWorkers
instance initialized with a predefined array ofWorker
objects. The use ofassertEquals
for both scenarios is appropriate, ensuring that thegetWorkers
method returns the expected results. This test method effectively validates the functionality of thegetWorkers
method under different conditions.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 3.x #35 +/- ##
============================================
+ Coverage 52.56% 52.96% +0.40%
- Complexity 99 100 +1
============================================
Files 11 11
Lines 234 236 +2
============================================
+ Hits 123 125 +2
Misses 111 111 ☔ View full report in Codecov by Sentry. |
The property with workers is hidden and a getter has been added to obtain it.
Summary by CodeRabbit