MCPcopy Create free account
hub / github.com/php/frankenphp / TestGetNamespacedFunctionName

Function TestGetNamespacedFunctionName

internal/extgen/phpfunc_namespace_test.go:56–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func TestGetNamespacedFunctionName(t *testing.T) {
57 tests := []struct {
58 name string
59 namespace string
60 functionName string
61 expected string
62 }{
63 {
64 name: "no namespace",
65 namespace: "",
66 functionName: "test_func",
67 expected: "test_func",
68 },
69 {
70 name: "single level namespace",
71 namespace: "MyNamespace",
72 functionName: "test_func",
73 expected: "MyNamespace_test_func",
74 },
75 {
76 name: "multi level namespace",
77 namespace: `Go\Extension`,
78 functionName: "multiply",
79 expected: "Go_Extension_multiply",
80 },
81 }
82
83 for _, tt := range tests {
84 t.Run(tt.name, func(t *testing.T) {
85 result := NamespacedName(tt.namespace, tt.functionName)
86
87 require.Equal(t, tt.expected, result, "Expected %q, got %q", tt.expected, result)
88 })
89 }
90}
91
92func TestCFileWithNamespacedPHPFunctions(t *testing.T) {
93 generator := &Generator{

Callers

nothing calls this directly

Calls 1

NamespacedNameFunction · 0.85

Tested by

no test coverage detected