mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-07 14:14:36 +00:00
Abstract the shortcode attribute parsing regex into its own function, update the JavaScript counterpart, and introduce a test to ensure they do not diverge again.
Fixes #34191 Props miqrogroove, johnbillion git-svn-id: https://develop.svn.wordpress.org/trunk@34933 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -632,4 +632,18 @@ EOF;
|
||||
require_once( DIR_TESTDATA . '/formatting/whole-posts.php' );
|
||||
return data_whole_posts();
|
||||
}
|
||||
|
||||
function test_php_and_js_shortcode_attribute_regexes_match() {
|
||||
|
||||
$file = file_get_contents( ABSPATH . WPINC . '/js/shortcode.js' );
|
||||
$matched = preg_match( '|\s+pattern = (\/.+\/)g;|', $file, $matches );
|
||||
$php = get_shortcode_atts_regex();
|
||||
|
||||
$this->assertSame( 1, $matched );
|
||||
|
||||
$js = str_replace( "\'", "'", $matches[1] );
|
||||
$this->assertSame( $php, $js );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user