Skip to content

[#416] Added When I visit the :vocabulary_machine_name term delete page with the name :term_name #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 31, 2025

Conversation

nsineok
Copy link
Contributor

@nsineok nsineok commented May 28, 2025

Closes #416

Summary by CodeRabbit

  • Documentation

    • Updated step descriptions for visiting and editing taxonomy term pages for improved clarity.
    • Added documentation for a new step to visit the delete page of a taxonomy term.
  • Tests

    • Standardized step phrasing in taxonomy-related test scenarios.
    • Added new test scenarios for visiting the delete page of taxonomy terms, including both successful and failure cases.

Copy link

coderabbitai bot commented May 28, 2025

"""

Walkthrough

The Drupal taxonomy trait was enhanced with new methods to visit term edit and delete pages by vocabulary and term name. Corresponding Behat steps were renamed for clarity and a new step for visiting the term delete page was added. Feature tests were updated with renamed steps and new scenarios to verify delete page access and error handling.

Changes

File(s) Change Summary
STEPS.md Renamed existing taxonomy term visit/edit step signatures; added a new step for visiting the term delete page.
src/Drupal/TaxonomyTrait.php Refactored term page visit method; added methods for visiting term edit and delete pages using a shared helper method.
tests/behat/features/drupal_taxonomy.feature Updated step phrases to new naming; added scenarios testing the term delete page for success and failure cases.

Assessment against linked issues

Objective Addressed Explanation
Add step When I visit the :vocabulary_machine_name vocabulary delete page for the :term_name (#416)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Poem

🐇 Hopping through terms with a skip and a glance,
Visiting pages, giving delete a chance.
Steps renamed clear, new paths in sight,
Testing with Behat, everything’s right!
In taxonomy fields, we dance and prance! 🌿✨
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b930fd5 and 4317b79.

📒 Files selected for processing (3)
  • STEPS.md (1 hunks)
  • src/Drupal/TaxonomyTrait.php (2 hunks)
  • tests/behat/features/drupal_taxonomy.feature (5 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
STEPS.md

2489-2489: Inline HTML
Element: summary

(MD033, no-inline-html)


2489-2489: Inline HTML
Element: code

(MD033, no-inline-html)


2491-2491: Inline HTML
Element: br

(MD033, no-inline-html)


2493-2493: Inline HTML
Element: br

(MD033, no-inline-html)


2493-2493: Inline HTML
Element: br

(MD033, no-inline-html)


2502-2502: Inline HTML
Element: details

(MD033, no-inline-html)


2503-2503: Inline HTML
Element: summary

(MD033, no-inline-html)


2503-2503: Inline HTML
Element: code

(MD033, no-inline-html)


2505-2505: Inline HTML
Element: br

(MD033, no-inline-html)


2507-2507: Inline HTML
Element: br

(MD033, no-inline-html)


2507-2507: Inline HTML
Element: br

(MD033, no-inline-html)


2516-2516: Inline HTML
Element: details

(MD033, no-inline-html)


2517-2517: Inline HTML
Element: summary

(MD033, no-inline-html)


2517-2517: Inline HTML
Element: code

(MD033, no-inline-html)


2519-2519: Inline HTML
Element: br

(MD033, no-inline-html)


2521-2521: Inline HTML
Element: br

(MD033, no-inline-html)


2521-2521: Inline HTML
Element: br

(MD033, no-inline-html)

🔇 Additional comments (5)
src/Drupal/TaxonomyTrait.php (3)

159-166: Excellent refactoring to eliminate code duplication.

The delegation to the new helper method taxonomyVisitActionPageWithName is a clean approach that maintains backward compatibility while enabling code reuse.


168-192: Well-implemented new functionality for term edit and delete pages.

Both new methods follow the established pattern and provide clear, intuitive step definitions for Behat scenarios. The delegation to the helper method with appropriate action subpaths is clean and maintainable.


194-225: Robust implementation of the helper method.

The taxonomyVisitActionPageWithName method properly addresses all previous review concerns:

  • ✅ Vocabulary existence validation (lines 205-209)
  • ✅ Consistent use of RuntimeException for error handling
  • ✅ Proper term selection logic using taxonomyLoadMultiple and ksort
  • ✅ Clean path construction with optional action subpath

This consolidation eliminates code duplication while maintaining all necessary validations and error handling.

tests/behat/features/drupal_taxonomy.feature (1)

158-261: Comprehensive test coverage with excellent consistency.

The test updates demonstrate excellent practices:

  1. Simplified step descriptions: The removal of redundant "vocabulary" wording makes the steps more readable and intuitive
  2. Complete coverage: All three new/updated methods are thoroughly tested with both positive and negative scenarios
  3. Proper error validation: The negative test scenarios correctly assert the expected exception messages that match the implementation
  4. Consistent structure: The new scenarios follow the established testing patterns used throughout the feature file

The test scenarios will ensure the new delete page functionality works correctly and handles edge cases appropriately.

STEPS.md (1)

2489-2528: Well-documented step definitions with clear examples.

The documentation updates properly reflect the new and updated step definitions:

  • ✅ Accurate step signatures that match the implementation
  • ✅ Clear, practical examples for each method
  • ✅ Consistent formatting with the rest of the documentation
  • ✅ Comprehensive coverage of all three navigation methods (view, edit, delete)

The static analysis warnings about inline HTML are false positives - HTML elements are expected and necessary in Markdown documentation files for proper formatting.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

2489-2489: Inline HTML
Element: summary

(MD033, no-inline-html)


2489-2489: Inline HTML
Element: code

(MD033, no-inline-html)


2491-2491: Inline HTML
Element: br

(MD033, no-inline-html)


2493-2493: Inline HTML
Element: br

(MD033, no-inline-html)


2493-2493: Inline HTML
Element: br

(MD033, no-inline-html)


2502-2502: Inline HTML
Element: details

(MD033, no-inline-html)


2503-2503: Inline HTML
Element: summary

(MD033, no-inline-html)


2503-2503: Inline HTML
Element: code

(MD033, no-inline-html)


2505-2505: Inline HTML
Element: br

(MD033, no-inline-html)


2507-2507: Inline HTML
Element: br

(MD033, no-inline-html)


2507-2507: Inline HTML
Element: br

(MD033, no-inline-html)


2516-2516: Inline HTML
Element: details

(MD033, no-inline-html)


2517-2517: Inline HTML
Element: summary

(MD033, no-inline-html)


2517-2517: Inline HTML
Element: code

(MD033, no-inline-html)


2519-2519: Inline HTML
Element: br

(MD033, no-inline-html)


2521-2521: Inline HTML
Element: br

(MD033, no-inline-html)


2521-2521: Inline HTML
Element: br

(MD033, no-inline-html)

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f2fa7b and fd4cb02.

📒 Files selected for processing (3)
  • STEPS.md (1 hunks)
  • src/Drupal/TaxonomyTrait.php (1 hunks)
  • tests/behat/features/drupal_taxonomy.feature (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
STEPS.md

2488-2488: Inline HTML
Element: details

(MD033, no-inline-html)


2489-2489: Inline HTML
Element: summary

(MD033, no-inline-html)


2489-2489: Inline HTML
Element: code

(MD033, no-inline-html)


2491-2491: Inline HTML
Element: br

(MD033, no-inline-html)


2493-2493: Inline HTML
Element: br

(MD033, no-inline-html)


2493-2493: Inline HTML
Element: br

(MD033, no-inline-html)

🔇 Additional comments (1)
STEPS.md (1)

2488-2500: LGTM! Well-documented step addition.

The documentation follows the established format and provides a clear example. The static analysis warnings about inline HTML can be ignored as this is the standard format used throughout this documentation file.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

2488-2488: Inline HTML
Element: details

(MD033, no-inline-html)


2489-2489: Inline HTML
Element: summary

(MD033, no-inline-html)


2489-2489: Inline HTML
Element: code

(MD033, no-inline-html)


2491-2491: Inline HTML
Element: br

(MD033, no-inline-html)


2493-2493: Inline HTML
Element: br

(MD033, no-inline-html)


2493-2493: Inline HTML
Element: br

(MD033, no-inline-html)

@nsineok
Copy link
Contributor Author

nsineok commented May 28, 2025

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
tests/behat/features/drupal_taxonomy.feature (2)

234-246: Past review suggestion has been implemented.

This negative test scenario for non-existing vocabulary was previously suggested and has now been correctly implemented.


248-260: Past review suggestion has been implemented.

This negative test scenario for non-existing term was previously suggested and has now been correctly implemented.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd4cb02 and cd301c5.

📒 Files selected for processing (2)
  • src/Drupal/TaxonomyTrait.php (1 hunks)
  • tests/behat/features/drupal_taxonomy.feature (1 hunks)
🔇 Additional comments (1)
tests/behat/features/drupal_taxonomy.feature (1)

226-232: Well-structured happy path test.

The test scenario effectively validates the delete functionality by creating a term, deleting it, and verifying it no longer exists. The implementation follows the established testing patterns in this feature file.

Copy link

codecov bot commented May 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.23%. Comparing base (b930fd5) to head (4317b79).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #420      +/-   ##
==========================================
+ Coverage   80.22%   80.23%   +0.01%     
==========================================
  Files          29       29              
  Lines        2038     2029       -9     
==========================================
- Hits         1635     1628       -7     
+ Misses        403      401       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0250106 and 15473cd.

📒 Files selected for processing (1)
  • src/Drupal/TaxonomyTrait.php (2 hunks)
🔇 Additional comments (1)
src/Drupal/TaxonomyTrait.php (1)

246-280: Excellent implementation following established patterns.

The taxonomyDeleteTerm method implementation looks great! It addresses all the previous feedback:

  • ✅ Includes vocabulary existence validation (lines 256-259)
  • ✅ Uses consistent \RuntimeException for error handling
  • ✅ Follows the same term selection pattern as other methods using taxonomyLoadMultiple() and selecting the last created term
  • ✅ Includes proper documentation with @code example and @when annotation
  • ✅ Validates both vocabulary and term existence before attempting deletion

The implementation is consistent with other methods in the trait and provides robust error handling.

@nsineok nsineok force-pushed the feature/416-delete-term branch from 15473cd to 4cb27d4 Compare May 29, 2025 10:34
@nsineok nsineok requested a review from AlexSkrypnyk May 29, 2025 23:33
@nsineok nsineok added the PR: Needs review Pull request needs a review from assigned developers label May 30, 2025
@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/416-delete-term branch from 4cb27d4 to 0220bb4 Compare May 31, 2025 00:11
@AlexSkrypnyk
Copy link
Member

@coderabbitai resolve

Copy link

coderabbitai bot commented May 31, 2025

✅ Actions performed

Comments resolved.

@AlexSkrypnyk
Copy link
Member

@coderabbitai full review

Copy link

coderabbitai bot commented May 31, 2025

✅ Actions performed

Full review triggered.

@AlexSkrypnyk AlexSkrypnyk changed the title #416: created the Delete Term step [#416] Added When I visit the :vocabulary_machine_name term delete page with the name :term_name May 31, 2025
@AlexSkrypnyk AlexSkrypnyk enabled auto-merge (squash) May 31, 2025 00:46
@AlexSkrypnyk AlexSkrypnyk merged commit 6eb3123 into main May 31, 2025
5 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/416-delete-term branch May 31, 2025 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Needs review Pull request needs a review from assigned developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add When I visit the :vocabulary_machine_name vocabulary delete page for the :term_name
3 participants