fix: dynamic module name in test templates#1181
Conversation
- Add DateTimes method to Blueprint interface - Implement DateTimes method to create created_at and updated_at columns - Add precision parameter support for timestamp columns - Add test coverage for DateTimes functionality
Replace hardcoded "goravel" module import in test templates with dynamic module name detection using debug.ReadBuildInfo(). - Add GetModuleName() method to Make struct - Update populateStub() to accept and replace DummyModule placeholder - Update test template stub to use DummyModule instead of hardcoded path - Add test verification for correct module import path - Fallback to "goravel" if build info unavailable This ensures generated test files use correct import paths regardless of the actual module name, improving framework reusability.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1181 +/- ##
==========================================
+ Coverage 68.83% 68.85% +0.01%
==========================================
Files 230 230
Lines 14879 14885 +6
==========================================
+ Hits 10242 10249 +7
Misses 4238 4238
+ Partials 399 398 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a hardcoded module import issue in test template generation by replacing the static "goravel" module reference with dynamic module name detection. The change ensures that generated test files use the correct import paths based on the actual module name rather than assuming "goravel".
- Added
GetModuleName()method to dynamically detect module name usingdebug.ReadBuildInfo() - Updated test template generation to replace
DummyModuleplaceholder with actual module name - Modified test stub to use dynamic module placeholder instead of hardcoded "goravel" path
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| support/console/console.go | Adds GetModuleName() method with build info detection and fallback |
| foundation/console/test_make_command.go | Updates populateStub to handle module name replacement |
| foundation/console/stubs.go | Changes hardcoded import to DummyModule placeholder |
| foundation/console/test_make_command_test.go | Adds test verification for correct module import path |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
📑 Description
Closes https://github.com/goravel/goravel/issues/
Replace hardcoded "goravel" module import in test templates with
dynamic module name detection using debug.ReadBuildInfo().
This ensures generated test files use correct import paths regardless
of the actual module name, improving framework reusability.
✅ Checks