(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestModuleWorkerDuplicateFilenamesFail(t *testing.T) { |
| 11 | // Create a test configuration with duplicate worker filenames |
| 12 | configWithDuplicateFilenames := ` |
| 13 | { |
| 14 | php { |
| 15 | worker { |
| 16 | file worker-with-env.php |
| 17 | num 1 |
| 18 | } |
| 19 | worker { |
| 20 | file worker-with-env.php |
| 21 | num 2 |
| 22 | } |
| 23 | } |
| 24 | }` |
| 25 | |
| 26 | // Parse the configuration |
| 27 | d := caddyfile.NewTestDispenser(configWithDuplicateFilenames) |
| 28 | module := &FrankenPHPModule{} |
| 29 | |
| 30 | // Unmarshal the configuration |
| 31 | err := module.UnmarshalCaddyfile(d) |
| 32 | |
| 33 | // Verify that an error was returned |
| 34 | require.Error(t, err, "Expected an error when two workers in the same module have the same filename") |
| 35 | require.Contains(t, err.Error(), "must not have duplicate filenames", "Error message should mention duplicate filenames") |
| 36 | } |
| 37 | |
| 38 | func TestModuleWorkersWithDifferentFilenames(t *testing.T) { |
| 39 | // Create a test configuration with different worker filenames |
nothing calls this directly
no test coverage detected