(sourceFile string)
| 60 | } |
| 61 | |
| 62 | func (s *IntegrationTestSuite) createGoModule(sourceFile string) (string, error) { |
| 63 | s.t.Helper() |
| 64 | |
| 65 | moduleDir := filepath.Join(s.tempDir, "module") |
| 66 | if err := os.MkdirAll(moduleDir, 0o755); err != nil { |
| 67 | return "", fmt.Errorf("failed to create module directory: %w", err) |
| 68 | } |
| 69 | |
| 70 | // Get project root for replace directive |
| 71 | projectRoot, err := filepath.Abs(filepath.Join("..", "..")) |
| 72 | if err != nil { |
| 73 | return "", fmt.Errorf("failed to get project root: %w", err) |
| 74 | } |
| 75 | |
| 76 | goModContent := fmt.Sprintf(`module %s |
| 77 | |
| 78 | go 1.26 |
| 79 | |
| 80 | require github.com/dunglas/frankenphp v0.0.0 |
| 81 | |
| 82 | replace github.com/dunglas/frankenphp => %s |
| 83 | `, testModuleName, projectRoot) |
| 84 | |
| 85 | if err := os.WriteFile(filepath.Join(moduleDir, "go.mod"), []byte(goModContent), 0o644); err != nil { |
| 86 | return "", fmt.Errorf("failed to create go.mod: %w", err) |
| 87 | } |
| 88 | |
| 89 | sourceContent, err := os.ReadFile(sourceFile) |
| 90 | if err != nil { |
| 91 | return "", fmt.Errorf("failed to read source file: %w", err) |
| 92 | } |
| 93 | |
| 94 | targetFile := filepath.Join(moduleDir, filepath.Base(sourceFile)) |
| 95 | if err := os.WriteFile(targetFile, sourceContent, 0o644); err != nil { |
| 96 | return "", fmt.Errorf("failed to write source file: %w", err) |
| 97 | } |
| 98 | |
| 99 | return targetFile, nil |
| 100 | } |
| 101 | |
| 102 | func (s *IntegrationTestSuite) runExtensionInit(sourceFile string) error { |
| 103 | s.t.Helper() |
no outgoing calls
no test coverage detected