[#2975] Registered the Drupal Rector set provider so the composer-based sets load. - #2979
Conversation
…4 test attribute. 'withComposerBased(drupal: TRUE)' only enables the 'drupal' set group; the sets themselves come from 'DrupalRector\Set\DrupalSetProvider', which must be registered with 'withSetProviders()'. Without it Rector loaded no Drupal rules at all and still exited 0, so lint passed while silently covering nothing. 'rector list-rules' reports 98 'DrupalRector' rules with the provider registered and 0 without it. Loading the Drupal 11 sets newly enables 'PhpUnitAddRunTestsInSeparateProcessesAttributeRector' from the 11.4 set, which adds '#[RunTestsInSeparateProcesses]' to Kernel and Functional test classes. The attribute and its import are applied to the example tests so Rector runs clean. PHPUnit runs each of those classes in its own process.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (64)
WalkthroughThe pull request updates Drupal Rector configuration, adjusts fixture paths and rules, removes obsolete PHPCS suppressions, and applies PHPUnit process isolation to functional, functional JavaScript, and kernel test fixtures. ChangesRector configuration and fixture updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: ⚪ Minimal · up to The change enables the intended Drupal Rector rules and updates the affected example tests and fixtures; no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Code coverage (threshold: 90%) Per-class coverage |
This comment has been minimized.
This comment has been minimized.
1 similar comment
|
Code coverage (threshold: 90%) Per-class coverage |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 2.x #2979 +/- ##
=======================================
Coverage 87.66% 87.66%
=======================================
Files 104 104
Lines 5563 5563
Branches 3 3
=======================================
Hits 4877 4877
Misses 686 686 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
📖 Documentation preview for this pull request has been deployed to Netlify: https://6a7d25d15b22a2147ac4ca6c--vortex-docs.netlify.app This preview is rebuilt on every commit and is not the production documentation site. |
Closes #2975
Summary
Follow-up to #2977. That pull request stopped Rector aborting on the removed
PHPUnitSetList::PHPUNIT_90constant, but the replacement it landed was incomplete:->withComposerBased(drupal: TRUE)only enables thedrupalset group, it does not supply the sets. The sets come fromDrupalRector\Set\DrupalSetProvider, which has to be registered with->withSetProviders(), exactly as the drupal-rector README documents.With only
withComposerBased(), Rector loads no Drupal rules at all and still exits 0, solintpasses while covering nothing.vendor/bin/rector list-rulesreports 0DrupalRectorrules on the current2.xand 98 with the provider registered. The failure mode is silent, which is why the merged pull request looked green.Registering the provider loads the Drupal 11.0 to 11.4 sets for the installed
drupal/core11.4.5. That newly enablesPhpUnitAddRunTestsInSeparateProcessesAttributeRectorfrom the 11.4 set, which adds#[RunTestsInSeparateProcesses]to Kernel and Functional test classes, tracking Drupal core issue 3445240. The attribute and its import are applied to the example tests so Rector runs clean. Note that PHPUnit then runs each of those test classes in its own process, which drupal-rector flags as a change to test execution on PHPUnit 10 and 11, not only on Drupal 12.Changes
DrupalRector\Set\DrupalSetProvidervia->withSetProviders()in the rootrector.php, alongside the existing->withComposerBased(drupal: TRUE). Both calls are required: the provider supplies the sets,withComposerBased()enables the group.#[RunTestsInSeparateProcesses]and itsPHPUnit\Framework\Attributes\RunTestsInSeparateProcessesimport to the 8 example Kernel, Functional and FunctionalJavascript test classes underweb/modules/custom/andweb/themes/custom/. Rector emits the attribute fully qualified because the config setswithImportNames(importNames: FALSE); the import is added by hand so the template's example code does not mix an importedGroupattribute with a fully qualified one.composer update-snapshots, covering therector.phpbaseline and the example test files across the scenario fixtures.Before / After
Summary by CodeRabbit
Bug Fixes
Refactor
Style