From 13531cc3bdcdc912f4025089f14f6ac33469fc32 Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Thu, 31 Aug 2023 22:16:05 +0000 Subject: [PATCH] Tests: Remove webfonts tests. Removes the test file and `webfonts` directory for the stopgap code that was deprecated by [56500]. Follow-up to [56500], [53282]. Fixes #59165. git-svn-id: https://develop.svn.wordpress.org/trunk@56501 602fd350-edb4-49c9-b593-d223f7449a82 --- .../webfonts/wpThemeJsonWebfontsHandler.php | 138 ------------------ 1 file changed, 138 deletions(-) delete mode 100644 tests/phpunit/tests/webfonts/wpThemeJsonWebfontsHandler.php diff --git a/tests/phpunit/tests/webfonts/wpThemeJsonWebfontsHandler.php b/tests/phpunit/tests/webfonts/wpThemeJsonWebfontsHandler.php deleted file mode 100644 index 7202417dde..0000000000 --- a/tests/phpunit/tests/webfonts/wpThemeJsonWebfontsHandler.php +++ /dev/null @@ -1,138 +0,0 @@ -orig_wp_styles = $wp_styles; - $wp_styles = null; - - $this->theme_root = realpath( DIR_TESTDATA . '/themedir1' ); - $this->orig_theme_dir = $GLOBALS['wp_theme_directories']; - - // /themes is necessary as theme.php functions assume /themes is the root if there is only one root. - $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this->theme_root ); - - $theme_root_callback = function () { - return $this->theme_root; - }; - - add_filter( 'theme_root', $theme_root_callback ); - add_filter( 'stylesheet_root', $theme_root_callback ); - add_filter( 'template_root', $theme_root_callback ); - - // Clear caches. - wp_clean_themes_cache(); - unset( $GLOBALS['wp_themes'] ); - } - - public function tear_down() { - global $wp_styles; - $wp_styles = $this->orig_wp_styles; - - // Restore the original theme directory setup. - $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; - wp_clean_themes_cache(); - unset( $GLOBALS['wp_themes'] ); - - parent::tear_down(); - } - - /** - * @ticket 55567 - * @ticket 46370 - * @ticket 57430 - */ - public function test_font_face_generated_from_themejson() { - $this->setup_theme_and_test( 'webfonts-theme' ); - - $expected = << -@font-face{font-family:"Source Serif Pro";font-style:normal;font-weight:200 900;font-display:fallback;src:url('THEME_ROOT_URL/assets/fonts/SourceSerif4Variable-Roman.ttf.woff2') format('woff2');font-stretch:normal;}@font-face{font-family:"Source Serif Pro";font-style:italic;font-weight:200 900;font-display:fallback;src:url('THEME_ROOT_URL/assets/fonts/SourceSerif4Variable-Italic.ttf.woff2') format('woff2');font-stretch:normal;} - -EOF; - $expected = str_replace( 'THEME_ROOT_URL', get_stylesheet_directory_uri(), $expected ); - $expected = str_replace( "\r\n", "\n", $expected ); - - $this->assertStringContainsString( - $expected, - get_echo( 'wp_print_styles' ) - ); - } - - /** - * @dataProvider data_font_face_not_generated - * - * @ticket 55567 - * @ticket 46370 - */ - public function test_font_face_not_generated( $theme_name ) { - $this->setup_theme_and_test( $theme_name ); - - $actual = get_echo( 'wp_print_styles' ); - $this->assertStringNotContainsString( "