Skip to content

test: add LoadViewsFrom named-template rendering coverage (framework#989) - #148

Open
goravel-coder wants to merge 1 commit into
masterfrom
bowen/test-pr-989-load-views-from
Open

test: add LoadViewsFrom named-template rendering coverage (framework#989)#148
goravel-coder wants to merge 1 commit into
masterfrom
bowen/test-pr-989-load-views-from

Conversation

@goravel-coder

Copy link
Copy Markdown
Contributor

Summary

Closes goravel/goravel#989

Why

View().LoadViewsFrom() lets packages register their own view directories, but the gin and fiber drivers were silently dropping named templates ({{ define "auth.tmpl" }}) loaded from those directories. This change pins the fixing driver commits and adds an end-to-end test proving the behavior under both drivers.

// packages/viewtest/service_provider.go — register a package view directory
func (r *ServiceProvider) Boot(app foundation.Application) {
	facades.View().LoadViewsFrom(path.Base("packages", "viewtest", "views"))
}

// routes/web.go — render a named template loaded from that directory
facades.Route().Get("package-auth", func(ctx http.Context) http.Response {
	return ctx.Response().View().Make("auth.tmpl", map[string]any{
		"name": "Goravel",
	})
})

The template auth.tmpl exists only in the LoadViewsFrom-registered directory, so before the driver fixes /package-auth returned nothing; with the pinned fixes it renders under both drivers, and the test locks that behavior in.

@goravel-coder
goravel-coder requested a review from a team as a code owner September 1, 2026 10:49
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