(t *testing.T)
| 2487 | } |
| 2488 | } |
| 2489 | func TestPrintStmtAbstractClassMethod(t *testing.T) { |
| 2490 | o := bytes.NewBufferString("") |
| 2491 | |
| 2492 | p := printer.NewPrettyPrinter(o, " ") |
| 2493 | p.Print(&stmt.ClassMethod{ |
| 2494 | Modifiers: []node.Node{&node.Identifier{Value: "public"}}, |
| 2495 | ReturnsRef: true, |
| 2496 | MethodName: &node.Identifier{Value: "foo"}, |
| 2497 | Params: []node.Node{ |
| 2498 | &node.Parameter{ |
| 2499 | ByRef: true, |
| 2500 | VariableType: &node.Nullable{Expr: &name.Name{Parts: []node.Node{&name.NamePart{Value: "int"}}}}, |
| 2501 | Variable: &expr.Variable{VarName: &node.Identifier{Value: "a"}}, |
| 2502 | DefaultValue: &expr.ConstFetch{Constant: &name.Name{Parts: []node.Node{&name.NamePart{Value: "null"}}}}, |
| 2503 | }, |
| 2504 | &node.Parameter{ |
| 2505 | Variadic: true, |
| 2506 | Variable: &expr.Variable{VarName: &node.Identifier{Value: "b"}}, |
| 2507 | }, |
| 2508 | }, |
| 2509 | ReturnType: &name.Name{Parts: []node.Node{&name.NamePart{Value: "void"}}}, |
| 2510 | Stmt: &stmt.Nop{}, |
| 2511 | }) |
| 2512 | |
| 2513 | expected := `public function &foo(?int &$a = null, ...$b): void;` |
| 2514 | actual := o.String() |
| 2515 | |
| 2516 | if expected != actual { |
| 2517 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 2518 | } |
| 2519 | } |
| 2520 | |
| 2521 | func TestPrintStmtClass(t *testing.T) { |
| 2522 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…