test: add Kernel coverage for JsonapiViews display extender - #9
Conversation
JsonapiViewsResourceTest (Functional) exercises ViewsResource thoroughly but makes real HTTP requests against a PHP subprocess, so PHPUnit's coverage driver never sees that execution - measured coverage for src/Resource/ViewsResource.php was 6.32% (5/79 lines) despite the functional coverage. Adds a Kernel test that dispatches requests through the HTTP kernel in-process (Symfony\Component\HttpKernel\HttpKernelInterface::handle(), reusing jsonapi_resources' own RequestTrait pattern), so the same request/response cycle is now visible to coverage tooling. Covers: - Page display pagination (both the 'next' and 'prev' link branches in ViewsResource::getViewsPager()) - The unexposed-display 403 early-return branch (feed_1's display_extenders.jsonapi_views.enabled=false) - The attachment display's hard-coded filter - Exposed filter and sort query parameters Kernel-test module enabling skips module install hooks, so jsonapi_views_install()'s registration of the jsonapi_views display extender into views.settings.display_extenders never runs; the test sets that config directly in setUp() to compensate.
|
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 (3)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe pull request adds kernel tests for JSON:API Views pagination, access control, attachments, exposed filters, sorting, and display extender forms. It also updates PHPStan path matching and removes one skipped Rector rule. ChangesJSON:API Views kernel tests
Tooling configuration
Estimated code review effort: 3 (Moderate) | ~20 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 @@
## 8.x-1.x #9 +/- ##
============================================
+ Coverage 30.14% 94.11% +63.97%
============================================
Files 3 3
Lines 136 136
============================================
+ Hits 41 128 +87
+ Misses 95 8 -87 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
testDisplayExtenderOptionsForm()toJsonapiViewsResourceKernelTest, coveringJsonapiViews::buildOptionsForm(),submitOptionsForm(), andoptionsSummary()(previously untested admin-form methods).phpstan.neon'srector.phpexclusion glob, which never matched the nested build path, and drops a now-deprecated Rector rule fromrector.php'swithSkip()that PHPStan started flagging as a result.Test plan
make lintclean on bothDRUPAL_VERSION=10andDRUPAL_VERSION=11Summary by CodeRabbit
Bug Fixes
Tests