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

Function TestCFileGenerator_BuildContent

internal/extgen/cfile_test.go:62–145  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func TestCFileGenerator_BuildContent(t *testing.T) {
63 tests := []struct {
64 name string
65 baseName string
66 functions []phpFunction
67 classes []phpClass
68 contains []string
69 notContains []string
70 }{
71 {
72 name: "empty extension",
73 baseName: "empty",
74 contains: []string{
75 "#include <php.h>",
76 "#include <Zend/zend_API.h>",
77 `#include "empty.h"`,
78 "PHP_MINIT_FUNCTION(empty)",
79 "empty_module_entry",
80 "return SUCCESS;",
81 },
82 },
83 {
84 name: "extension with functions only",
85 baseName: "func_only",
86 functions: []phpFunction{
87 {Name: "testFunc", ReturnType: phpString},
88 },
89 contains: []string{
90 "PHP_FUNCTION(testFunc)",
91 `#include "func_only.h"`,
92 "func_only_module_entry",
93 "PHP_MINIT_FUNCTION(func_only)",
94 },
95 },
96 {
97 name: "extension with classes only",
98 baseName: "class_only",
99 classes: []phpClass{
100 {Name: "MyClass", GoStruct: "MyStruct"},
101 },
102 contains: []string{
103 "register_all_classes()",
104 "register_class_MyClass();",
105 "PHP_METHOD(MyClass, __construct)",
106 `#include "class_only.h"`,
107 },
108 },
109 {
110 name: "extension with functions and classes",
111 baseName: "full",
112 functions: []phpFunction{
113 {Name: "doSomething", ReturnType: phpVoid},
114 },
115 classes: []phpClass{
116 {Name: "FullClass", GoStruct: "FullStruct"},
117 },
118 contains: []string{
119 "PHP_FUNCTION(doSomething)",

Callers

nothing calls this directly

Calls 1

buildContentMethod · 0.95

Tested by

no test coverage detected