-
-
Notifications
You must be signed in to change notification settings - Fork 0
test(http): Refactor memory threshold tests in StatelessApplicationProvider and update ApplicationMemoryTest class for improved validation scenarios.
#129
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
…rovider` and update `ApplicationMemoryTest` class for improved validation scenarios.
WalkthroughConsolidates three specialized memory-threshold tests into a single data-driven test using a new provider method, annotates an existing positive-limit test with a data provider and docblock, and adds the Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor PHPUnit as PHPUnit
participant Provider as StatelessApplicationProvider
participant Test as ApplicationMemoryTest
participant App as StatelessApplication
PHPUnit->>Provider: memoryThreshold()
Provider-->>PHPUnit: scenarios [memoryLimit, shouldTriggerSpecialTest, message]
loop for each scenario
PHPUnit->>Test: testCleanBehaviorWithDifferentMemoryLimits(limit, flag, message)
Test->>App: ini_set('memory_limit', limit) / setMemoryLimit(limit)
alt flag == false
Test->>App: call clean()
App-->>Test: return false
Test-->>PHPUnit: assert false with message
else flag == true
Test->>App: compute artificial threshold from current usage
Test->>App: setMemoryLimit(artificialThreshold)
Test->>App: call clean()
App-->>Test: return true
Test-->>PHPUnit: assert true with message
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
✨ Finishing Touches
🧪 Generate unit tests
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. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #129 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 318 318
===========================================
Files 12 12
Lines 808 808
===========================================
Hits 808 808 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/provider/StatelessApplicationProvider.php (1)
228-255: Clarify the 2G scenario message and align it with the expected outcomeGreat addition. Small nit: the dataset message for the '2G' case doesn’t state the expected result, while the test asserts true. Make the message explicit to improve failure diagnostics.
Apply this diff to clarify the message:
- 'high memory setup - 2G' => [ + 'high memory setup - 2G' => [ '2G', true, - "Memory configuration with '2G' for exact threshold testing.", + "'clean()' should return 'true' when memory usage equals the calculated '90%' threshold (using adjusted limit).", ],
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
tests/http/stateless/ApplicationMemoryTest.php(3 hunks)tests/provider/StatelessApplicationProvider.php(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/http/stateless/ApplicationMemoryTest.php (4)
tests/provider/StatelessApplicationProvider.php (1)
StatelessApplicationProvider(11-256)tests/TestCase.php (1)
statelessApplication(134-197)src/http/StatelessApplication.php (3)
handle(269-295)clean(141-152)setMemoryLimit(326-335)tests/support/FactoryHelper.php (2)
FactoryHelper(46-268)createServerRequestCreator(154-161)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: phpunit / PHP 8.3-ubuntu-latest
- GitHub Check: mutation / PHP 8.3-ubuntu-latest
- GitHub Check: mutation / PHP 8.3-ubuntu-latest
🔇 Additional comments (3)
tests/http/stateless/ApplicationMemoryTest.php (3)
33-38: Good consolidation into a data-driven testSwitching to a single provider-driven test improves readability and reduces duplication across threshold scenarios. Looks good.
247-247: No action neededMinor comment wording tweak only; nothing to change.
265-267: Docblock addition is appropriateAdding the throws annotation improves clarity without changing behavior.
Summary by CodeRabbit
Tests
Chores