createDocumentFragment(); $fragment->appendXML( trim( $html ) ); $expected = self::getJson( $expectedPath ); $actual = []; CommentUtils::linearWalk( $fragment, function ( $event, $node ) use ( &$actual ) { $actual[] = "$event {$node->nodeName}({$node->nodeType})"; } ); // Optionally write updated content to the JSON files if ( getenv( 'DISCUSSIONTOOLS_OVERWRITE_TESTS' ) ) { self::overwriteJsonFile( $expectedPath, $actual ); } self::assertEquals( $expected, $actual, $name ); } public function provideLinearWalk() : array { return self::getJson( '../cases/linearWalk.json' ); } }