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

Function TestPrinterPrintStmtTraitUseAlias

printer/printer_test.go:4239–4258  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

4237}
4238
4239func TestPrinterPrintStmtTraitUseAlias(t *testing.T) {
4240 o := bytes.NewBufferString("")
4241
4242 p := printer.NewPrinter(o)
4243 p.Print(&stmt.TraitUseAlias{
4244 Ref: &stmt.TraitMethodRef{
4245 Trait: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
4246 Method: &node.Identifier{Value: "a"},
4247 },
4248 Modifier: &node.Identifier{Value: "public"},
4249 Alias: &node.Identifier{Value: "b"},
4250 })
4251
4252 expected := `Foo::a as public b;`
4253 actual := o.String()
4254
4255 if expected != actual {
4256 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
4257 }
4258}
4259
4260func TestPrinterPrintStmtTraitUsePrecedence(t *testing.T) {
4261 o := bytes.NewBufferString("")

Callers

nothing calls this directly

Calls 3

PrintMethod · 0.95
NewPrinterFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…