@@ -716,10 +716,12 @@ public function test_wp_maybe_inline_styles_multiple_runs() {
716716
717717 /**
718718 * @ticket 58394
719+ * @ticket 64447
719720 *
720721 * @covers ::wp_maybe_inline_styles
722+ * @expectedIncorrectUsage wp_maybe_inline_styles
721723 */
722- public function test_test_wp_maybe_inline_styles_missing_file () {
724+ public function test_wp_maybe_inline_styles_missing_file () {
723725 $ filter = new MockAction ();
724726 add_filter ( 'pre_wp_filesize ' , array ( $ filter , 'filter ' ) );
725727 $ url = '/ ' . WPINC . '/css/invalid.css ' ;
@@ -768,39 +770,20 @@ public function test_wp_maybe_inline_styles_no_path() {
768770 $ this ->assertSame ( $ GLOBALS ['wp_styles ' ]->registered ['test-handle ' ]->src , $ url );
769771 }
770772
771- /**
772- * @ticket 64447
773- *
774- * @covers ::wp_maybe_inline_styles
775- * @expectedIncorrectUsage wp_maybe_inline_styles
776- */
777- public function test_wp_maybe_inline_styles_bad_path_at_file_size_check () {
778- $ handle = 'test-handle ' ;
779- $ inc_path = '/css/ancient-themes.css ' ; // Does not exist.
780- $ url = '/ ' . WPINC . $ inc_path ;
781- wp_register_style ( $ handle , $ url );
782- wp_style_add_data ( $ handle , 'path ' , ABSPATH . WPINC . $ inc_path );
783- wp_enqueue_style ( $ handle );
784-
785- wp_maybe_inline_styles ();
786-
787- $ this ->assertSame ( $ GLOBALS ['wp_styles ' ]->registered [ $ handle ]->src , $ url );
788- }
789-
790773 /**
791774 * @ticket 64447
792775 *
793776 * @covers ::wp_maybe_inline_styles
794777 * @expectedIncorrectUsage wp_maybe_inline_styles
795778 */
796779 public function test_wp_maybe_inline_styles_bad_path_with_file_size_provided () {
797- $ inc_path = '/css/ancient-themes .css ' ; // Does not exist.
780+ $ style_path = '/css/invalid .css ' ; // Does not exist.
798781
799782 // This ensures the initial file size check is bypassed.
800783 add_filter (
801784 'pre_wp_filesize ' ,
802- static function ( $ size , $ path ) use ( $ inc_path ) {
803- if ( str_contains ( $ path , $ inc_path ) ) {
785+ static function ( $ size , $ path ) use ( $ style_path ) {
786+ if ( str_contains ( $ path , $ style_path ) ) {
804787 $ size = 1000 ;
805788 }
806789 return $ size ;
@@ -810,9 +793,9 @@ static function ( $size, $path ) use ( $inc_path ) {
810793 );
811794
812795 $ handle = 'test-handle ' ;
813- $ url = '/ ' . WPINC . $ inc_path ;
796+ $ url = '/ ' . WPINC . $ style_path ;
814797 wp_register_style ( $ handle , $ url );
815- wp_style_add_data ( $ handle , 'path ' , ABSPATH . WPINC . $ inc_path );
798+ wp_style_add_data ( $ handle , 'path ' , ABSPATH . WPINC . $ style_path );
816799 wp_enqueue_style ( $ handle );
817800
818801 wp_maybe_inline_styles ();
@@ -826,13 +809,13 @@ static function ( $size, $path ) use ( $inc_path ) {
826809 * @covers ::wp_maybe_inline_styles
827810 */
828811 public function test_wp_maybe_inline_styles_good_path_with_zero_file_size_provided () {
829- $ inc_path = '/css/classic-themes.css ' ;
812+ $ style_path = '/css/classic-themes.css ' ;
830813
831814 // This simulates the file having a zero size.
832815 add_filter (
833816 'pre_wp_filesize ' ,
834- static function ( $ size , $ path ) use ( $ inc_path ) {
835- if ( str_contains ( $ path , $ inc_path ) ) {
817+ static function ( $ size , $ path ) use ( $ style_path ) {
818+ if ( str_contains ( $ path , $ style_path ) ) {
836819 $ size = 0 ;
837820 }
838821 return $ size ;
@@ -842,8 +825,8 @@ static function ( $size, $path ) use ( $inc_path ) {
842825 );
843826
844827 $ handle = 'test-handle ' ;
845- wp_register_style ( $ handle , '/ ' . WPINC . $ inc_path );
846- wp_style_add_data ( $ handle , 'path ' , ABSPATH . WPINC . $ inc_path );
828+ wp_register_style ( $ handle , '/ ' . WPINC . $ style_path );
829+ wp_style_add_data ( $ handle , 'path ' , ABSPATH . WPINC . $ style_path );
847830 wp_enqueue_style ( $ handle );
848831
849832 wp_maybe_inline_styles ();
0 commit comments