-
-
Notifications
You must be signed in to change notification settings - Fork 0
test: Update root nodes order verification in NestedSetsQueryBehaviorTest
to reflect new sorting logic.
#39
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
Conversation
…rTest` to reflect new sorting logic.
WalkthroughThe ordering logic in the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant NestedSetsQueryBehavior
participant ActiveQuery
Client->>NestedSetsQueryBehavior: roots()
NestedSetsQueryBehavior->>ActiveQuery: where(leftAttribute = 1)
alt treeAttribute enabled
NestedSetsQueryBehavior->>ActiveQuery: orderBy(treeAttribute ASC, leftAttribute ASC)
else treeAttribute disabled
NestedSetsQueryBehavior->>ActiveQuery: orderBy(leftAttribute ASC)
end
ActiveQuery-->>Client: Root nodes in specified order
Possibly related PRs
Suggested labels
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 phpcs (3.7.2)src/NestedSetsQueryBehavior.phpWarning: PHP Startup: Invalid date.timezone value 'UTC', using 'UTC' instead in Unknown on line 0 Fatal error: Uncaught Error: Class "Phar" not found in /usr/local/bin/phpcs:3 tests/NestedSetsQueryBehaviorTest.phpWarning: PHP Startup: Invalid date.timezone value 'UTC', using 'UTC' instead in Unknown on line 0 Fatal error: Uncaught Error: Class "Phar" not found in /usr/local/bin/phpcs:3 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings
🧬 Code Graph Analysis (2)src/NestedSetsQueryBehavior.php (1)
tests/NestedSetsQueryBehaviorTest.php (3)
🔇 Additional comments (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #39 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 90 90
===========================================
Files 2 2
Lines 469 470 +1
===========================================
+ Hits 469 470 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 updates the verification of root nodes ordering in NestedSetsQueryBehaviorTest to reflect the new sorting logic based on the tree attribute and left attribute.
- Updated the test creation order and expectation for root node order in tests/NestedSetsQueryBehaviorTest.php
- Modified the roots() method in src/NestedSetsQueryBehavior.php to sort by the tree attribute (if enabled) before the left attribute
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/NestedSetsQueryBehaviorTest.php | Adjusted test data creation and expected root order to match new sorting logic |
src/NestedSetsQueryBehavior.php | Updated query ordering in roots() to prioritize the tree attribute over primary key |
Comments suppressed due to low confidence (1)
tests/NestedSetsQueryBehaviorTest.php:95
- Consider adding a brief comment to explain why the tree attribute values are being manually updated in this test, to clarify the purpose of enforcing the new sort order.
$command->update('multiple_tree', ['tree' => 1], ['name' => 'Root A'])->execute();
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary by CodeRabbit
Bug Fixes
Tests