(t *testing.T)
| 261 | } |
| 262 | |
| 263 | func TestRefFunction(t *testing.T) { |
| 264 | src := `<? function &foo() {return 1;}` |
| 265 | |
| 266 | expected := &node.Root{ |
| 267 | Position: &position.Position{ |
| 268 | StartLine: 1, |
| 269 | EndLine: 1, |
| 270 | StartPos: 3, |
| 271 | EndPos: 30, |
| 272 | }, |
| 273 | Stmts: []node.Node{ |
| 274 | &stmt.Function{ |
| 275 | Position: &position.Position{ |
| 276 | StartLine: 1, |
| 277 | EndLine: 1, |
| 278 | StartPos: 3, |
| 279 | EndPos: 30, |
| 280 | }, |
| 281 | ReturnsRef: true, |
| 282 | PhpDocComment: "", |
| 283 | FunctionName: &node.Identifier{ |
| 284 | Position: &position.Position{ |
| 285 | StartLine: 1, |
| 286 | EndLine: 1, |
| 287 | StartPos: 13, |
| 288 | EndPos: 16, |
| 289 | }, |
| 290 | Value: "foo", |
| 291 | }, |
| 292 | Stmts: []node.Node{ |
| 293 | &stmt.Return{ |
| 294 | Position: &position.Position{ |
| 295 | StartLine: 1, |
| 296 | EndLine: 1, |
| 297 | StartPos: 20, |
| 298 | EndPos: 29, |
| 299 | }, |
| 300 | Expr: &scalar.Lnumber{ |
| 301 | Position: &position.Position{ |
| 302 | StartLine: 1, |
| 303 | EndLine: 1, |
| 304 | StartPos: 27, |
| 305 | EndPos: 28, |
| 306 | }, |
| 307 | Value: "1", |
| 308 | }, |
| 309 | }, |
| 310 | }, |
| 311 | }, |
| 312 | }, |
| 313 | } |
| 314 | |
| 315 | php7parser := php7.NewParser([]byte(src), "7.4") |
| 316 | php7parser.Parse() |
| 317 | actual := php7parser.GetRootNode() |
| 318 | assert.DeepEqual(t, expected, actual) |
| 319 | |
| 320 | php5parser := php5.NewParser([]byte(src), "5.6") |
nothing calls this directly
no test coverage detected
searching dependent graphs…