MCPcopy Index your code
hub / github.com/php/frankenphp / TestModuleWorkerDuplicateFilenamesFail

Function TestModuleWorkerDuplicateFilenamesFail

caddy/config_test.go:10–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func 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
38func TestModuleWorkersWithDifferentFilenames(t *testing.T) {
39 // Create a test configuration with different worker filenames

Callers

nothing calls this directly

Calls 2

UnmarshalCaddyfileMethod · 0.95
ErrorMethod · 0.45

Tested by

no test coverage detected