Make toReadableSize tests tolerant of CakePHP 5.4 SI unit default - #340
Conversation
CakePHP 5.4 changed Number::toReadableSize() to divide by 1000 and label KB/MB/GB/TB, moving the previous 1024-based behavior behind the new IEC units switch (KiB/MiB/...). The plugin still supports cakephp/cakephp ^5.1.1, so the expectations now branch on whether the core exposes setUseIecUnits(), and a separate case covers the explicit IEC output.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe readable-size tests now support CakePHP decimal-unit defaults, preserve binary expectations on older versions, and add conditional IEC-unit coverage for KiB and GiB output. ChangesReadable-size test coverage
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #340 +/- ##
============================================
- Coverage 80.67% 80.65% -0.02%
Complexity 2162 2162
============================================
Files 85 85
Lines 5934 5934
============================================
- Hits 4787 4786 -1
- Misses 1147 1148 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
CakePHP 5.4.0 changed
Number::toReadableSize()to divide by 1000 and label the resultKB/MB/GB/TB. The previous 1024-based behavior is still available, but only behind the new IEC units switch, which rendersKiB/MiB/GiB/TiB.That flipped
NumberHelperTest::testToReadableSizered on every testsuite job (e.g.1206bytes now renders as1,21 KBinstead of1,18 KB).Since the plugin still supports
cakephp/cakephp: ^5.1.1, the expectations cannot be hardcoded to either scheme. They now branch on whether the core exposessetUseIecUnits(), which is the 5.4 marker. A second case asserts the explicit IEC output and is skipped on older cores.No
src/change - this is purely the core default shifting under the helper.Summary by CodeRabbit