Skip to content

feat: [SUB-786] Add WithEvents function#1234

Merged
hwbrzzl merged 3 commits intomasterfrom
bowen/#791
Oct 19, 2025
Merged

feat: [SUB-786] Add WithEvents function#1234
hwbrzzl merged 3 commits intomasterfrom
bowen/#791

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Oct 18, 2025

📑 Description

Closes goravel/goravel#791

This pull request introduces support for registering event listeners during application setup by adding a new WithEvents method to the ApplicationBuilder interface and its implementation. The changes also update related tests and mocks to ensure correct behavior and coverage for the new functionality.

Event system integration:

  • Added a WithEvents method to the ApplicationBuilder interface, allowing event listeners to be registered during application configuration. (contracts/foundation/application.go)
  • Implemented the WithEvents method in ApplicationBuilder, storing the event-to-listener mapping and registering them during application creation. (foundation/application_builder.go) [1] [2] [3]
  • Updated imports to include the event contracts required for the new functionality. (foundation/application_builder.go)

Testing and mocks:

  • Enhanced the test suite to verify that event listeners are correctly registered when using the new WithEvents method. (foundation/application_builder_test.go) [1] [2]
  • Added mock support for the new WithEvents method in the ApplicationBuilder mock, including expectation helpers. (mocks/foundation/ApplicationBuilder.go) [1] [2]

✅ Checks

  • Added test cases for my code

@codecov
Copy link

codecov bot commented Oct 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.35%. Comparing base (2d07c62) to head (ee48c51).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1234      +/-   ##
==========================================
- Coverage   66.35%   66.35%   -0.01%     
==========================================
  Files         245      245              
  Lines       16914    16933      +19     
==========================================
+ Hits        11224    11236      +12     
- Misses       5308     5315       +7     
  Partials      382      382              

☔ 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

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: 2c95b91 Previous: 2d07c62 Ratio
Benchmark_EncryptString 5292 ns/op 2152 B/op 14 allocs/op 1610 ns/op 2152 B/op 14 allocs/op 3.29
Benchmark_EncryptString - ns/op 5292 ns/op 1610 ns/op 3.29

This comment was automatically generated by workflow using github-action-benchmark.

@hwbrzzl hwbrzzl marked this pull request as ready for review October 18, 2025 12:56
@hwbrzzl hwbrzzl requested a review from a team as a code owner October 18, 2025 12:56
Copilot AI review requested due to automatic review settings October 18, 2025 12:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Introduces a new WithEvents method to the ApplicationBuilder interface and implementation, enabling event listener registration during application setup. This extends the existing fluent API pattern for application configuration.

  • Added WithEvents method to register event listeners during application building
  • Updated imports and implementation to support event system integration
  • Enhanced test coverage and mock support for the new functionality

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
contracts/foundation/application.go Adds WithEvents method signature to ApplicationBuilder interface
foundation/application_builder.go Implements WithEvents method with event registration logic
foundation/application_builder_test.go Updates tests to verify event listener registration functionality
mocks/foundation/ApplicationBuilder.go Adds mock implementation and expectation helpers for WithEvents method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@hwbrzzl hwbrzzl merged commit 74dc501 into master Oct 19, 2025
14 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#791 branch October 19, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SUB-786] Add WithEvents function

2 participants