public function testPrintWithBrackets()
    {
        $parser = new Parser(new Lexer());
        $printer = new BracketingPrinter();
        $stmts = $parser->parse(<<<EOF
<?php
namespace foo;
class Bar
{
}
EOF
);
        $expected = <<<EOF
namespace foo {
    class Bar
    {
    }
}
EOF;
        $this->assertEquals($expected, $printer->prettyPrint($stmts));
    }
Exemplo n.º 2
0
    public function testPrintWithBrackets()
    {
        $parserFactory = new ParserFactory();
        $parser = $parserFactory->create(ParserFactory::PREFER_PHP5);
        $printer = new BracketingPrinter();
        $stmts = $parser->parse(<<<EOF
<?php namespace foo;
class Bar
{
}
EOF
);
        $expected = <<<EOF
namespace foo {
    class Bar
    {
    }
}
EOF;
        $this->assertEquals($expected, $printer->prettyPrint($stmts));
    }