[#629] Use fixture path for file fields#630
Conversation
WalkthroughThe mediaExpandEntityFieldsFixtures() method in MediaTrait was changed to treat fields of type 'file' the same as 'image' when converting fixture values into absolute file paths; related Behat scenarios were simplified to remove separate managed-file seeding steps. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/behat/features/drupal_media.feature (1)
260-269:⚠️ Potential issue | 🟠 MajorTag the generated nested scenario with
api.The inner scenario creates media via Drupal API setup. With plain
scenario steps:, the generated scenario may run without theapitag and fail during setup instead of testing the intended negative assertion.Proposed fix
`@api` `@trait`:Drupal\MediaTrait Scenario: Assert that negative assertion for "Then the :media_type media with the name :name should not exist" fails with an error Given some behat configuration - And scenario steps: + And scenario steps tagged with "api": """ Given the following media "image" exist: | name | field_media_image | | Test media image | image.png | Then the "image" media with the name "Test media image" should not exist """Based on learnings, in
tests/behat/features/**/*.feature, nested content-creation steps in negativetrait:*scenarios should be placed insidescenario steps tagged with "api"so DrupalContext/API setup is available.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/behat/features/drupal_media.feature` around lines 260 - 269, The nested scenario's content-creation steps run without the Drupal API setup because they lack the api tag; update the inner block by changing "And scenario steps:" to "And scenario steps tagged with \"api\":" (i.e., use the scenario steps variant that adds the api tag to the generated nested scenario) so the media creation uses DrupalContext/API during setup for the negative assertion scenario.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@tests/behat/features/drupal_media.feature`:
- Around line 260-269: The nested scenario's content-creation steps run without
the Drupal API setup because they lack the api tag; update the inner block by
changing "And scenario steps:" to "And scenario steps tagged with \"api\":"
(i.e., use the scenario steps variant that adds the api tag to the generated
nested scenario) so the media creation uses DrupalContext/API during setup for
the negative assertion scenario.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c6b7e72e-c16f-4ab7-8e63-b99c7a79a59c
📒 Files selected for processing (1)
tests/behat/features/drupal_media.feature
|
Test failures appear inconsistent to what I'm seeing locally - end of day here and I don't work Friday so I'll pick this back up after the weekend |
|
@ericgsmith Please feel free to leave this with me. Could you please check that Alternatively, I can spin another PR and work there. The credit will be passed to that PR. |
|
Thanks Alex, have checked the allow access option |
Summary
This PR extends fixture-based file path expansion in MediaTrait so media fields of type 'file' are treated the same as 'image' fields when resolving fixture file names to absolute fixture paths.
Changes
File: src/Drupal/MediaTrait.php
File: tests/behat/features/drupal_media.feature
Impact
Tests / Documentation
CONTRIBUTING.md step-definition rules