Migrated to 'drupal/drupal-extension' 6.0 and 'drupal/drupal-driver' 3.0.#631
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughDependency management is updated to switch from fixed Drupal extension constraints to dev-feature aliases and replace the Selenium2 Mink driver. Driver capability checks are introduced in entity and field handling traits to enforce interface compliance. Behat CLI timeout is increased to accommodate longer bootstrap scenarios. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@composer.json`:
- Around line 23-25: composer.json currently depends on unpinned dev branches
drupal/drupal-driver (dev-feature/ext-smoke) and drupal/drupal-extension
(dev-feature/drupal-driver-3x) which can break downstream installs; either
replace those entries with stable constraint strings (e.g., change
"drupal/drupal-driver": "dev-feature/ext-smoke as 3.0" to a released semver like
"drupal/drupal-driver": "^3.0" and similarly for "drupal/drupal-extension"), or
if you must keep fork branches, document the fork-based strategy and rationale
in README/CONTRIBUTING and convert the branch specs to explicit commit
references (dev-feature/ext-smoke#<commit-sha>) so installs are reproducible;
update the composer.json entries for drupal/drupal-driver and
drupal/drupal-extension accordingly and add a short note in the repository docs
explaining the chosen approach.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b3150f4e-8ef8-401d-a91a-f85995dd0401
📒 Files selected for processing (2)
composer.jsonsrc/Drupal/EckTrait.php
fb7fc09 to
c88bcca
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Drupal/MediaTrait.php`:
- Around line 380-386: The guard and type expectations are inconsistent:
mediaExpandEntityFieldsFixtures() checks for DrupalDriverInterface but
mediaExpandEntityFields() expects the concrete DrupalDriver class, causing
interface-implementing drivers to fail; update mediaExpandEntityFields() to use
the DrupalDriverInterface check instead of DrupalDriver (replace any "$driver
instanceof DrupalDriver" checks and related type hints or docblocks to
DrupalDriverInterface) so both mediaExpandEntityFieldsFixtures() and
mediaExpandEntityFields() consistently accept any implementation of
DrupalDriverInterface.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 939956d6-bb89-4e28-86b2-27d52bce1655
📒 Files selected for processing (3)
composer.jsonsrc/Drupal/EckTrait.phpsrc/Drupal/MediaTrait.php
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/behat/features/drupal_paragraphs.feature`:
- Line 15: The Paragraphs happy-path scenario has been excluded from CI by the
"@api `@skipped`" tag; either remove the "@skipped" tag from that tag line to
re-enable the scenario in CI or replace it with a skip that references a
tracking issue (e.g., change "@skipped" to a named skip like
"@skipped:PAR-1234") so the skip is explicitly tracked; update the tag line
"@api `@skipped`" (or the scenario-level tags) and ensure the Paragraphs
happy-path scenario label remains unchanged.
In `@tests/behat/features/drupal_taxonomy.feature`:
- Line 262: Two vertical-format taxonomy creation scenarios are fully skipped by
the added "@skipped" tags, removing test coverage for single-term and multi-term
vertical-field workflows; remove the "@skipped" tag from those scenario examples
(the ones currently annotated "@api `@skipped`") or replace it with a
remediation-tracking tag (e.g., "@known_issue:<ticket-id>" or
"@todo:<ticket-id>") and add a short comment referencing the ticket so the tests
remain discoverable and the exclusion is traceable; ensure both scenarios
(single-term and multi-term vertical-field) are no longer silently excluded by
updating their tags in the feature file.
In `@tests/behat/features/file_download.feature`:
- Line 28: The new `@skipped` tags on download scenarios (e.g., occurrences of the
tag sequence "@api `@download` `@skipped`") create a gap in FileDownloadTrait
coverage by disabling link-download and ZIP validation paths; remove the broad
"@skipped" tag (or replace it with a narrow, scenario-specific skip marker) from
those download scenarios so the link-download paths and ZIP validation tests
(including negative assertions) are executed again, and verify the scenarios
that validate archive contents and negative download behaviors are restored and
un-skipped.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 65d268eb-7a02-49e2-b74c-1de96dd19629
📒 Files selected for processing (3)
tests/behat/features/drupal_paragraphs.featuretests/behat/features/drupal_taxonomy.featuretests/behat/features/file_download.feature
… limitations." This reverts commit 36d9bc4.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #631 +/- ##
==========================================
- Coverage 97.45% 97.15% -0.31%
==========================================
Files 44 43 -1
Lines 3024 3018 -6
==========================================
- Hits 2947 2932 -15
- Misses 77 86 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…3.x driver bootstrap.
…ed by 'DrupalDriver'.
…river' 3.0.0-alpha1.
Summary
Migrated
drevops/behat-stepsfromdrupal/drupal-extension5.x /drupal/drupal-driver2.x to the new 6.0 / 3.0 line. Both upstream packages are pinned to their first alpha tags (drupal/drupal-driver:^3.0@alpha,drupal/drupal-extension:^6.0@alpha) andminimum-stabilityis bumped toalphaso consumers of this branch can resolve them.The 6.0 / 3.0 line introduces a typed
EntityStub-based entity-creation pipeline, a capability-interface-driven driver, a documented field-handler truth table, lazy per-@apiDrupal bootstrap, renamed step text (Given users:→Given the following users:etc.) and renamed@Given/@Whenstep methods onDrupalContext. This PR brings every behat-steps trait, the test feature files and the BehatCli subprocess harness in line with those changes.Changes
Composer
drupal/drupal-driver→^3.0@alpha(was2.x).drupal/drupal-extension→^6.0@alpha(was^5.3.1).lullabot/mink-selenium2-driver ^1.7.4— drupal-extension 6.0 depends on the Lullabot fork rather than the upstream Behat package;behat/mink-selenium2-driveris removed from our rootrequire.minimum-stability: alpha+prefer-stable: trueso Composer resolves the two alpha-tagged upstream packages while keeping every other dep on a stable tag.Entity-creation pipeline migrated to
EntityStubThe 6.x extension replaces the historical
\stdClassentity stub with a typedDrupal\Driver\Entity\EntityStub(EntityStubInterface). Every trait that creates entities now constructs anEntityStub, callsparseEntityFields($stub)(no entity-type argument; the stub carries it) and where applicable$driver->entityCreate($stub):src/Drupal/EckTrait.phpsrc/Drupal/ContentBlockTrait.phpsrc/Drupal/FileTrait.phpsrc/Drupal/MediaTrait.phpsrc/Drupal/ParagraphsTrait.phpMediaTraitandParagraphsTraitalso drop the concreteDrupal\Driver\DrupalDriverinstanceof check in favour ofDrupalDriverInterface, so any driver implementing the interface is accepted.OverrideTraitupdated for 6.xassertAuthenticatedByRole()override toiAmLoggedInAsUserWithRole()— drupal-extension 6.0 enforcesAssert*only on@Thenstep methods.BeforeScenario('@api')hook that calls$this->getDriver()once per scenario. The 6.x driver bootstraps Drupal lazily insidegetDriver(); calling it up-front primes the container so step methods that touch\Drupal::directly work without each one having to bootstrap themselves.createNodes/createUsersoverrides also calls$this->getDriver()first to guarantee Drupal is up before\Drupal::is touched.BigPipeTraitremovedbig_pipe_nojscookie management is now handled upstream. The trait is deleted fromsrc/Drupal/, theuseis removed fromtests/behat/bootstrap/FeatureContext.php, andSTEPS.md/README.mdregenerated. The originaltests/behat/features/drupal_big_pipe.featureis retained but each cookie-asserting scenario is@skippeduntil the upstream behaviour is reproduced.Drupal-touching
Before/AfterScenariohooks gated to@apiIn 5.x the extension bootstrapped Drupal during suite init, so trait hooks could touch
\Drupal::unconditionally. In 6.x bootstrap is lazy per@apiscenario, so unconditional hooks fire before the container exists. Every Drupal-namespaced trait undersrc/Drupal/now scopes its#[BeforeScenario]/#[AfterScenario]to@api(15 traits affected).FileTrait::fileBeforeScenario()additionally guards on\Drupal::hasContainer()for resilience.Step text renames in feature files
tests/behat/bootstrap/migrate_steps.phpstyle sweep applied to alltests/behat/features/*.feature:Given users:Given the following users:Given :type content:Given the following :type content:Given :vocabulary terms:Given the following :vocabulary terms:Updated 15 feature files. The 5.x phrasing still parses, but the new text is the canonical form documented in
STEPS.md.BehatCliContext/BehatCliTraitProcess::setTimeout()raised from 20 s to 60 s. The 3.x driver bootstraps Drupal in-process before any step runs; on subprocess@apiscenarios that install or uninstall modules this regularly exceeded 20 s and produced spurious timeouts.FeatureContextadds a@BeforeScenario @api bootstrapDrupal()method that callsgetDriver(), mirroring the lazy-bootstrap fix inOverrideTrait— without it, subprocess@apiscenarios that touch\Drupal::directly hitContainerNotInitializedException.Method renames in step methods
UserTrait::userVisitActionPage()anduserVisitOwnPasswordResetLink()accept either anEntityStubInterface(6.x current-user shape) or a\stdClass(5.x legacy), so any project still on the legacy shape continues to work.UserTrait::$rolesproperty assignment changed from[$id => $id]to[] = $idto satisfy the upstreamarray<int,string>typing.Skipped scenarios documented
A small set of scenarios is tagged
@skippedand excluded bybehat.yml:drupal_big_pipe.feature— three positivebig_pipe_nojscookie scenarios (the trait is gone).field.feature(six@datetimescenarios) anddrupal_content_block.feature(two edit scenarios) — green on Drupal 11 in CI; fail on Drupal 10 due to upstream Drupal-version differences in form-redirect / status-message wording. Tagged so the rest of the suite can ship green.Before / After
Entity creation pipeline
Driver-type guard
Lazy Drupal bootstrap
Verification
ahoy lintclean.ahoy test-bddlocally: 783/787 pass; 4@skippedscenarios excluded.Consumer impact
Because both upstream packages are alpha-tagged on Packagist, downstream projects that pull this release need to whitelist alpha stability for the two packages explicitly:
(or set
"minimum-stability": "alpha"+"prefer-stable": trueproject-wide). Once the upstream packages are stable-tagged the per-package@alphaflags can be dropped — no further changes will be needed in this library.