MCPcopy Create free account
hub / github.com/z7zmey/php-parser / TestInclude

Function TestInclude

node/expr/t_include_test.go:17–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestInclude(t *testing.T) {
18 src := `<? include $a;`
19
20 expected := &node.Root{
21 Position: &position.Position{
22 StartLine: 1,
23 EndLine: 1,
24 StartPos: 3,
25 EndPos: 14,
26 },
27 Stmts: []node.Node{
28 &stmt.Expression{
29 Position: &position.Position{
30 StartLine: 1,
31 EndLine: 1,
32 StartPos: 3,
33 EndPos: 14,
34 },
35 Expr: &expr.Include{
36 Position: &position.Position{
37 StartLine: 1,
38 EndLine: 1,
39 StartPos: 3,
40 EndPos: 13,
41 },
42 Expr: &expr.Variable{
43 Position: &position.Position{
44 StartLine: 1,
45 EndLine: 1,
46 StartPos: 11,
47 EndPos: 13,
48 },
49 VarName: &node.Identifier{
50 Position: &position.Position{
51 StartLine: 1,
52 EndLine: 1,
53 StartPos: 11,
54 EndPos: 13,
55 },
56 Value: "a",
57 },
58 },
59 },
60 },
61 },
62 }
63
64 php7parser := php7.NewParser([]byte(src), "7.4")
65 php7parser.Parse()
66 actual := php7parser.GetRootNode()
67 assert.DeepEqual(t, expected, actual)
68
69 php5parser := php5.NewParser([]byte(src), "5.6")
70 php5parser.Parse()
71 actual = php5parser.GetRootNode()
72 assert.DeepEqual(t, expected, actual)
73}
74

Callers

nothing calls this directly

Calls 4

ParseMethod · 0.95
GetRootNodeMethod · 0.95
NewParserFunction · 0.92
NewParserFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…