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

Function TestDocumentationGenerator_Generate

internal/extgen/docs_test.go:12–142  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestDocumentationGenerator_Generate(t *testing.T) {
13 tests := []struct {
14 name string
15 generator *Generator
16 expectError bool
17 }{
18 {
19 name: "simple extension with functions",
20 generator: &Generator{
21 BaseName: "testextension",
22 BuildDir: "",
23 Functions: []phpFunction{
24 {
25 Name: "greet",
26 ReturnType: phpString,
27 Params: []phpParameter{
28 {Name: "name", PhpType: phpString},
29 },
30 Signature: "greet(string $name): string",
31 },
32 },
33 Classes: []phpClass{},
34 },
35 expectError: false,
36 },
37 {
38 name: "extension with classes",
39 generator: &Generator{
40 BaseName: "classextension",
41 BuildDir: "",
42 Functions: []phpFunction{},
43 Classes: []phpClass{
44 {
45 Name: "TestClass",
46 Properties: []phpClassProperty{
47 {Name: "name", PhpType: phpString},
48 {Name: "count", PhpType: phpInt, IsNullable: true},
49 },
50 },
51 },
52 },
53 expectError: false,
54 },
55 {
56 name: "extension with both functions and classes",
57 generator: &Generator{
58 BaseName: "fullextension",
59 BuildDir: "",
60 Functions: []phpFunction{
61 {
62 Name: "calculate",
63 ReturnType: phpInt,
64 IsReturnNullable: true,
65 Params: []phpParameter{
66 {Name: "base", PhpType: phpInt},
67 {Name: "multiplier", PhpType: phpInt, HasDefault: true, DefaultValue: "2", IsNullable: true},
68 },
69 Signature: "calculate(int $base, ?int $multiplier = 2): ?int",

Callers

nothing calls this directly

Calls 2

generateMethod · 0.95
ErrorMethod · 0.45

Tested by

no test coverage detected