*/ public function testSerialize() { $code = << // comment /** doc comment */ 4 6 functionName 4 4 a 4 10 4 0 4 4 b 4 4 1 5 5 5 5 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)); } }