8000 Fixed hook implementation names. by AlexSkrypnyk · Pull Request #382 · drevops/behat-steps · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixed hook implementation names. #382

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 1 commit into from
May 2, 2025
Merged

Conversation

AlexSkrypnyk
Copy link
Member
@AlexSkrypnyk AlexSkrypnyk commented May 2, 2025

Summary by CodeRabbit

  • Refactor
    • Standardized method names for scenario lifecycle hooks across multiple modules to improve consistency. No changes to functionality or behavior.
  • Documentation
    • Simplified and clarified method documentation for improved readability.

Copy link
coderabbitai bot commented May 2, 2025

Walkthrough

This update standardizes the naming of Behat scenario lifecycle hook methods across multiple traits by renaming them to follow a consistent *BeforeScenario and *AfterScenario convention. The changes affect method names, associated skip tags, and relevant docblocks, but do not alter the underlying logic or control flow of the hooks. All hooks continue to perform their scenario setup or cleanup responsibilities, with execution conditional on the presence of matching skip tags. No new features or significant behavioral modifications are introduced.

Changes

File(s) Change Summary
src/BlockTrait.php Renamed blockInstanceCleanAll to blockAfterScenario; updated skip tag accordingly.
src/ContentBlockTrait.php Simplified docblock for contentBlockAfterScenario; no code or logic changes.
src/EckTrait.php Renamed eckEntitiesCleanAll to eckAfterScenario; updated skip tag accordingly.
src/FileTrait.php Renamed fileBeforeScenarioInit to fileBeforeScenario and fileCleanAll to fileAfterScenario; updated skip tags.
src/MediaTrait.php Renamed mediaClean to mediaAfterScenario; updated skip tag accordingly.
src/MenuTrait.php Renamed menuCleanAll to menuAfterScenario; updated skip tag accordingly.
src/ParagraphsTrait.php Renamed paragraphsCleanAll to paragraphsAfterScenario; updated skip tag accordingly.
src/TestmodeTrait.php Renamed testmodeBeforeScenarioEnableTestMode to testmodeBeforeScenario and testmodeBeforeScenarioDisableTestMode to testmodeAfterScenario; updated skip tags.
src/WatchdogTrait.php Renamed watchdogSetScenarioStartTime to watchdogSetScenario and watchdogAssertErrors to watchdogAfterScenario; updated skip tags.

Sequence Diagram(s)

sequenceDiagram
    participant Behat as Behat Engine
    participant Trait as Scenario Trait (e.g., BlockTrait)
    participant Scenario as Test Scenario

    Behat->>Trait: Call *BeforeScenario* method (if present)
    Trait->>Scenario: Perform setup (unless skip tag present)
    Behat->>Scenario: Execute scenario steps
    Behat->>Trait: Call *AfterScenario* method (if present)
    Trait->>Scenario: Perform cleanup (unless skip tag present)
Loading

Possibly related PRs

  • [#368] Updated BlockContentTrait. #374: Refactors AfterScenario hook method names in multiple traits, aligning with the method renaming and skip tag updates in this PR.
  • Updated language. #375: Updates method names and skip tags for AfterScenario hooks in traits related to block entities, conceptually similar to changes in this PR but affecting different traits.

Poem

Hop, hop, a naming spree,
Traits now match in harmony!
Before and after, clear as day,
Skip tags guide the Behat way.
Cleanup’s neat, confusion’s gone—
The codebase hums a tidy song.
🐇✨


📜 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 a70f426 and c528c07.

📒 Files selected for processing (9)
  • src/BlockTrait.php (1 hunks)
  • src/ContentBlockTrait.php (0 hunks)
  • src/EckTrait.php (1 hunks)
  • src/FileTrait.php (2 hunks)
  • src/MediaTrait.php (1 hunks)
  • src/MenuTrait.php (1 hunks)
  • src/ParagraphsTrait.php (1 hunks)
  • src/TestmodeTrait.php (2 hunks)
  • src/WatchdogTrait.php (2 hunks)
💤 Files with no reviewable changes (1)
  • src/ContentBlockTrait.php
🔇 Additional comments (11)
src/TestmodeTrait.php (1)

35-35: Good method renaming for consistency

The function renames from verbose names to more conventional testmodeBeforeScenario and testmodeAfterScenario improve readability while maintaining identical functionality. The new names better reflect when these hooks run in the Behat lifecycle.

Also applies to: 50-50

src/MenuTrait.php (1)

157-157: Improved method naming for consistency

Renaming from menuCleanAll to menuAfterScenario follows the standardized naming convention for Behat lifecycle hooks. The new name clearly indicates when the method runs in the test lifecycle while maintaining identical functionality.

src/EckTrait.php (1)

32-32: Standardized method naming

Renaming from eckEntitiesCleanAll to eckAfterScenario improves naming consistency across traits while maintaining identical functionality. The new name better reflects the method's role as an after-scenario hook.

src/MediaTrait.php (1)

31-31: Consistent method naming

Renaming from mediaClean to mediaAfterScenario follows the project-wide standardization of Behat hook method names. The new name clearly indicates when this hook executes in the test lifecycle.

src/ParagraphsTrait.php (1)

34-34: Method name change looks good.

The renaming from paragraphsCleanAll to paragraphsAfterScenario follows the consistent naming convention for Behat scenario hooks as described in the PR objectives.

src/BlockTrait.php (2)

75-76: Documentation correctly updated with new method name reference.

The documentation has been updated to reflect the new method name pattern, correctly changing the reference from blockInstanceCleanAll to blockAfterScenario in the skip tag documentation.


80-80: Method name change looks good.

The renaming from blockInstanceCleanAll to blockAfterScenario follows the consistent naming convention for Behat scenario hooks.

src/WatchdogTrait.php (2)

39-39: Method name change looks good.

The renaming from watchdogSetScenarioStartTime to watchdogSetScenario follows the established naming convention for BeforeScenario hooks.


83-83: Method name change looks good.

The renaming from watchdogAssertErrors to watchdogAfterScenario follows the consistent naming convention for AfterScenario hooks.

src/FileTrait.php (2)

43-43: Method name change looks good.

The renaming from fileBeforeScenarioInit to fileBeforeScenario follows the consistent naming convention for BeforeScenario hooks.


157-157: Method name change looks good.

The renaming from fileCleanAll to fileAfterScenario follows the consistent naming convention for AfterScenario hooks.

✨ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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
codecov bot commented May 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.57%. Comparing base (a70f426) to head (c528c07).
Report is 1 commits behind head on 3.x.

Additional details and impacted files
@@           Coverage Diff           @@
##              3.x     #382   +/-   ##
=======================================
  Coverage   81.57%   81.57%           
=======================================
  Files          31       31           
  Lines        1677     1677           
=======================================
  Hits         1368     1368           
  Misses        309      309           

☔ 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.

@AlexSkrypnyk AlexSkrypnyk merged commit 362f2a8 into 3.x May 2, 2025
6 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/cleanup-hooks branch May 2, 2025 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0