@@ -52,11 +52,15 @@ public function test_items_enqueue(string $type, array $args) {
5252 $ this ->assertEquals ('tangible-fields ' , wp_scripts ()->query ('tangible-fields ' )->handle );
5353
5454 if ( version_compare ($ wp_version , '6.3 ' , '> ' ) ) {
55- $ data = wp_scripts ()->get_inline_script_data ('tangible-fields ' , 'before ' , false );
55+ $ data = wp_scripts ()->get_inline_script_data ('tangible-fields ' , 'before ' );
5656 } else {
5757 $ data = wp_scripts ()->print_inline_script ('tangible-fields ' , 'before ' , false );
5858 }
59- $ this ->assertGreaterThan (0 , preg_match ('#^var TangibleFieldsConfig = (.+?);$# ' , $ data , $ matches ), 'wp_add_inline_script does not have TangibleFieldsConfig ' );
59+ $ this ->assertGreaterThan (
60+ 0 ,
61+ preg_match ('#var TangibleFieldsConfig = (.+?);# ' , $ data , $ matches ),
62+ 'wp_add_inline_script does not have TangibleFieldsConfig '
63+ );
6064 $ data = json_decode ($ matches [1 ], true );
6165
6266 $ this ->assertEquals ([
@@ -88,9 +92,17 @@ public function test_fields_enqueue_conditions(string $type, array $args) {
8892 tangible_fields ()->maybe_enqueue_scripts ();
8993
9094 if ( version_compare ($ wp_version , '6.3 ' , '> ' ) ) {
91- preg_match ('#^var TangibleFieldsConfig = (.+?);$# ' , wp_scripts ()->get_inline_script_data ('tangible-fields ' , 'before ' , false ), $ matches );
95+ preg_match (
96+ '#var TangibleFieldsConfig = (.+?);# ' ,
97+ wp_scripts ()->get_inline_script_data ('tangible-fields ' , 'before ' ),
98+ $ matches
99+ );
92100 } else {
93- preg_match ('#^var TangibleFieldsConfig = (.+?);$# ' , wp_scripts ()->print_inline_script ('tangible-fields ' , 'before ' , false ), $ matches );
101+ preg_match (
102+ '#^var TangibleFieldsConfig = (.+?);$# ' ,
103+ wp_scripts ()->print_inline_script ('tangible-fields ' , 'before ' , false ),
104+ $ matches
105+ );
94106 }
95107
96108 $ data = json_decode ($ matches [1 ], true );
0 commit comments