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

Function TestStaticClassConstFetch

node/expr/t_class_const_fetch_test.go:88–145  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

86}
87
88func TestStaticClassConstFetch(t *testing.T) {
89 src := `<? static::bar;`
90
91 expected := &node.Root{
92 Position: &position.Position{
93 StartLine: 1,
94 EndLine: 1,
95 StartPos: 3,
96 EndPos: 15,
97 },
98 Stmts: []node.Node{
99 &stmt.Expression{
100 Position: &position.Position{
101 StartLine: 1,
102 EndLine: 1,
103 StartPos: 3,
104 EndPos: 15,
105 },
106 Expr: &expr.ClassConstFetch{
107 Position: &position.Position{
108 StartLine: 1,
109 EndLine: 1,
110 StartPos: 3,
111 EndPos: 14,
112 },
113 Class: &node.Identifier{
114 Position: &position.Position{
115 StartLine: 1,
116 EndLine: 1,
117 StartPos: 3,
118 EndPos: 9,
119 },
120 Value: "static",
121 },
122 ConstantName: &node.Identifier{
123 Position: &position.Position{
124 StartLine: 1,
125 EndLine: 1,
126 StartPos: 11,
127 EndPos: 14,
128 },
129 Value: "bar",
130 },
131 },
132 },
133 },
134 }
135
136 php7parser := php7.NewParser([]byte(src), "7.4")
137 php7parser.Parse()
138 actual := php7parser.GetRootNode()
139 assert.DeepEqual(t, expected, actual)
140
141 php5parser := php5.NewParser([]byte(src), "5.6")
142 php5parser.Parse()
143 actual = php5parser.GetRootNode()
144 assert.DeepEqual(t, expected, actual)
145}

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…