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

Function TestModuleWorkersWithDifferentFilenames

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

Source from the content-addressed store, hash-verified

36}
37
38func TestModuleWorkersWithDifferentFilenames(t *testing.T) {
39 // Create a test configuration with different worker filenames
40 configWithDifferentFilenames := `
41 {
42 php {
43 worker ../testdata/worker-with-env.php
44 worker ../testdata/worker-with-counter.php
45 }
46 }`
47
48 // Parse the configuration
49 d := caddyfile.NewTestDispenser(configWithDifferentFilenames)
50 module := &FrankenPHPModule{}
51
52 // Unmarshal the configuration
53 err := module.UnmarshalCaddyfile(d)
54
55 // Verify that no error was returned
56 require.NoError(t, err, "Expected no error when two workers in the same module have different filenames")
57
58 // Verify that both workers were added to the module
59 require.Len(t, module.Workers, 2, "Expected two workers to be added to the module")
60 require.Equal(t, "../testdata/worker-with-env.php", module.Workers[0].FileName, "First worker should have the correct filename")
61 require.Equal(t, "../testdata/worker-with-counter.php", module.Workers[1].FileName, "Second worker should have the correct filename")
62}
63
64func TestModuleWorkersDifferentNamesSucceed(t *testing.T) {
65 // Create a test configuration with a worker name

Callers

nothing calls this directly

Calls 1

UnmarshalCaddyfileMethod · 0.95

Tested by

no test coverage detected