parse( $html ) ), true ); $this->assertSame( $expected_parsed, $result, "File '$parsed_json_filename' does not match expected value" ); } /** * Helper function to remove relative paths and extension from a filename, leaving just the fixture name. * * @since 5.0.0 * * @param string $filename The filename to clean. * @return string The cleaned fixture name. */ protected function clean_fixture_filename( $filename ) { $filename = wp_basename( $filename ); $filename = preg_replace( '/\..+$/', '', $filename ); return $filename; } /** * Helper function to return the filenames needed to test the parser output. * * @since 5.0.0 * * @param string $filename The cleaned fixture name. * @return array The input and expected output filenames for that fixture. */ protected function pass_parser_fixture_filenames( $filename ) { return array( "$filename.html", "$filename.parsed.json", ); } /** * Helper function to remove '\r' characters from a string. * * @since 5.0.0 * * @param string $input The string to remove '\r' from. * @return string The input string, with '\r' characters removed. */ protected function strip_r( $input ) { return str_replace( "\r", '', $input ); } }