*/ public function testSerialize() { $code = << 4 // comment /** doc comment */ 6 functionName 4 4 a 4 4 10 0 4 4 b 4 4 1 5 5 5 5 1 Foo XML; $parser = new PhpParser\Parser\Php7(new PhpParser\Lexer); $serializer = new XML; $code = str_replace("\r\n", "\n", $code); $stmts = $parser->parse($code); $this->assertXmlStringEqualsXmlString($xml, $serializer->serialize($stmts)); } /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Unexpected node type */ public function testError() { $serializer = new XML; $serializer->serialize(array(new \stdClass)); } }