Skip to content

test: validate provider routes survive engine rebuild with global middleware#132

Merged
hwbrzzl merged 1 commit into
masterfrom
feat/pr1508-route-boot-order
Jun 27, 2026
Merged

test: validate provider routes survive engine rebuild with global middleware#132
hwbrzzl merged 1 commit into
masterfrom
feat/pr1508-route-boot-order

Conversation

@goravel-coder

Copy link
Copy Markdown
Contributor

Summary

Why

goravel/framework#1508 fixed a bug where configureMiddleware ran after Boot(), causing SetGlobalMiddleware to rebuild the route engine and silently discard routes registered by service providers during boot. The fix reorders configureMiddleware to run between Register() and Boot(), so the engine is set up with global middleware before providers register their routes.

The example repo had no coverage for this ordering — a provider that registers routes in Boot() would have returned 404 without the fix. The new RouteProvider and test ensure this contract is preserved.

// bootstrap/provider_route.go — registers a route during Boot()
type RouteProvider struct{}

func (r *RouteProvider) Boot(app foundation.Application) {
	facades.Route().Get("/provider-route", func(ctx http.Context) http.Response {
		return ctx.Response().Success().String("Hello from provider route")
	})
}
// tests/feature/http_test.go — validates the route survives
func (s *HttpTestSuite) TestProviderRoute() {
	resp, err := s.Http(s.T()).Get("/provider-route")
	s.NoError(err)
	resp.AssertSuccessful()

	content, err := resp.Content()
	s.NoError(err)
	s.Equal("Hello from provider route", content)
}

…dleware

Add a RouteProvider that registers GET /provider-route in its Boot()
method and a test asserting it returns 200. This validates the fix
from goravel/framework#1508 where configureMiddleware was moved
between Register() and Boot() to prevent route loss.
@goravel-coder
goravel-coder requested a review from a team as a code owner June 27, 2026 05:46
@hwbrzzl
hwbrzzl merged commit 2e9bbd4 into master Jun 27, 2026
7 of 11 checks passed
@hwbrzzl
hwbrzzl deleted the feat/pr1508-route-boot-order branch June 27, 2026 07:37
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.

2 participants