Changeset 51287
- Timestamp:
- 06/30/2021 06:21:52 PM (4 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-sidebars-controller.php
r51235 r51287 63 63 } 64 64 65 function clean_up_global_scope() {65 public function clean_up_global_scope() { 66 66 global $wp_widget_factory, $wp_registered_sidebars, $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates; 67 67 -
trunk/tests/phpunit/tests/theme/wpTheme.php
r50967 r51287 10 10 */ 11 11 class Tests_Theme_wpTheme extends WP_UnitTestCase { 12 function setUp() { 12 13 public function setUp() { 13 14 parent::setUp(); 14 15 $this->theme_root = realpath( DIR_TESTDATA . '/themedir1' ); … … 25 26 } 26 27 27 function tearDown() {28 public function tearDown() { 28 29 $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; 29 30 wp_clean_themes_cache(); … … 33 34 34 35 // Replace the normal theme root directory with our premade test directory. 35 function _theme_root( $dir ) {36 public function _theme_root( $dir ) { 36 37 return $this->theme_root; 37 38 } 38 function test_new_WP_Theme_top_level() { 39 40 public function test_new_WP_Theme_top_level() { 39 41 $theme = new WP_Theme( 'theme1', $this->theme_root ); 40 42 … … 55 57 } 56 58 57 function test_new_WP_Theme_subdir() {59 public function test_new_WP_Theme_subdir() { 58 60 $theme = new WP_Theme( 'subdir/theme2', $this->theme_root ); 59 61 … … 77 79 * @ticket 20313 78 80 */ 79 function test_new_WP_Theme_subdir_bad_root() {81 public function test_new_WP_Theme_subdir_bad_root() { 80 82 // This is what get_theme_data() does when you pass it a style.css file for a theme in a subdirectory. 81 83 $theme = new WP_Theme( 'theme2', $this->theme_root . '/subdir' ); … … 100 102 * @ticket 21749 101 103 */ 102 function test_wp_theme_uris_with_spaces() {104 public function test_wp_theme_uris_with_spaces() { 103 105 $theme = new WP_Theme( 'theme with spaces', $this->theme_root . '/subdir' ); 104 106 // Make sure subdir/ is considered part of the stylesheet, as we must avoid encoding /'s. … … 117 119 * @ticket 21969 118 120 */ 119 function test_theme_uris_with_spaces() {121 public function test_theme_uris_with_spaces() { 120 122 $callback = array( $this, 'filter_theme_with_spaces' ); 121 123 add_filter( 'stylesheet', $callback ); … … 129 131 } 130 132 131 function filter_theme_with_spaces() {133 public function filter_theme_with_spaces() { 132 134 return 'subdir/theme with spaces'; 133 135 } … … 136 138 * @ticket 26873 137 139 */ 138 function test_display_method_on_get_method_failure() {140 public function test_display_method_on_get_method_failure() { 139 141 $theme = new WP_Theme( 'nonexistent', $this->theme_root ); 140 142 $this->assertSame( 'nonexistent', $theme->get( 'Name' ) ); … … 147 149 * @ticket 40820 148 150 */ 149 function test_child_theme_with_itself_as_parent_should_appear_as_broken() {151 public function test_child_theme_with_itself_as_parent_should_appear_as_broken() { 150 152 $theme = new WP_Theme( 'child-parent-itself', $this->theme_root ); 151 153 $errors = $theme->errors(); … … 161 163 * @group ms-required 162 164 */ 163 function test_wp_theme_network_enable_single_theme() {165 public function test_wp_theme_network_enable_single_theme() { 164 166 $theme = 'testtheme-1'; 165 167 $current_allowed_themes = get_site_option( 'allowedthemes' ); … … 178 180 * @group ms-required 179 181 */ 180 function test_wp_theme_network_enable_multiple_themes() {182 public function test_wp_theme_network_enable_multiple_themes() { 181 183 $themes = array( 'testtheme-2', 'testtheme-3' ); 182 184 $current_allowed_themes = get_site_option( 'allowedthemes' ); … … 201 203 * @group ms-required 202 204 */ 203 function test_network_disable_single_theme() {205 public function test_network_disable_single_theme() { 204 206 $current_allowed_themes = get_site_option( 'allowedthemes' ); 205 207 … … 226 228 * @group ms-required 227 229 */ 228 function test_network_disable_multiple_themes() {230 public function test_network_disable_multiple_themes() { 229 231 $current_allowed_themes = get_site_option( 'allowedthemes' ); 230 232 -
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r51281 r51287 17 17 * @ticket 52991 18 18 */ 19 function test_get_settings() {19 public function test_get_settings() { 20 20 $theme_json = new WP_Theme_JSON( 21 21 array( … … 68 68 * @ticket 53397 69 69 */ 70 function test_get_settings_presets_are_keyed_by_origin() {70 public function test_get_settings_presets_are_keyed_by_origin() { 71 71 $core_origin = new WP_Theme_JSON( 72 72 array( … … 196 196 * @ticket 53175 197 197 */ 198 function test_get_stylesheet() {198 public function test_get_stylesheet() { 199 199 $theme_json = new WP_Theme_JSON( 200 200 array( … … 317 317 * @ticket 52991 318 318 */ 319 function test_get_stylesheet_preset_classes_work_with_compounded_selectors() {319 public function test_get_stylesheet_preset_classes_work_with_compounded_selectors() { 320 320 $theme_json = new WP_Theme_JSON( 321 321 array( … … 347 347 * @ticket 53175 348 348 */ 349 function test_get_stylesheet_preset_rules_come_after_block_rules() {349 public function test_get_stylesheet_preset_rules_come_after_block_rules() { 350 350 $theme_json = new WP_Theme_JSON( 351 351 array( … … 671 671 * @ticket 52991 672 672 */ 673 function test_get_from_editor_settings() {673 public function test_get_from_editor_settings() { 674 674 $input = array( 675 675 'disableCustomColors' => true, … … 747 747 * @ticket 52991 748 748 */ 749 function test_get_editor_settings_no_theme_support() {749 public function test_get_editor_settings_no_theme_support() { 750 750 $input = array( 751 751 '__unstableEnableFullSiteEditingBlocks' => false, … … 802 802 * @ticket 52991 803 803 */ 804 function test_get_editor_settings_blank() {804 public function test_get_editor_settings_blank() { 805 805 $expected = array( 806 806 'version' => WP_Theme_JSON::LATEST_SCHEMA, … … 815 815 * @ticket 52991 816 816 */ 817 function test_get_editor_settings_custom_units_can_be_disabled() {817 public function test_get_editor_settings_custom_units_can_be_disabled() { 818 818 add_theme_support( 'custom-units', array() ); 819 819 $input = get_default_block_editor_settings(); … … 832 832 * @ticket 52991 833 833 */ 834 function test_get_editor_settings_custom_units_can_be_enabled() {834 public function test_get_editor_settings_custom_units_can_be_enabled() { 835 835 add_theme_support( 'custom-units' ); 836 836 $input = get_default_block_editor_settings(); … … 849 849 * @ticket 52991 850 850 */ 851 function test_get_editor_settings_custom_units_can_be_filtered() {851 public function test_get_editor_settings_custom_units_can_be_filtered() { 852 852 add_theme_support( 'custom-units', 'rem', 'em' ); 853 853 $input = get_default_block_editor_settings(); -
trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php
r51196 r51287 13 13 class Tests_Theme_wpThemeJsonResolver extends WP_UnitTestCase { 14 14 15 function setUp() {15 public function setUp() { 16 16 parent::setUp(); 17 17 $this->theme_root = realpath( DIR_TESTDATA . '/themedir1' ); … … 30 30 } 31 31 32 function tearDown() {32 public function tearDown() { 33 33 $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; 34 34 wp_clean_themes_cache(); … … 37 37 } 38 38 39 function filter_set_theme_root() {39 public function filter_set_theme_root() { 40 40 return $this->theme_root; 41 41 } 42 42 43 function filter_set_locale_to_polish() {43 public function filter_set_locale_to_polish() { 44 44 return 'pl_PL'; 45 45 } … … 48 48 * @ticket 52991 49 49 */ 50 function test_fields_are_extracted() {50 public function test_fields_are_extracted() { 51 51 $actual = WP_Theme_JSON_Resolver::get_fields_to_translate(); 52 52 … … 95 95 * @ticket 52991 96 96 */ 97 function test_translations_are_applied() {97 public function test_translations_are_applied() { 98 98 add_filter( 'locale', array( $this, 'filter_set_locale_to_polish' ) ); 99 99 load_textdomain( 'fse', realpath( DIR_TESTDATA . '/languages/themes/fse-pl_PL.mo' ) ); … … 149 149 * @ticket 52991 150 150 */ 151 function test_switching_themes_recalculates_data() {151 public function test_switching_themes_recalculates_data() { 152 152 // By default, the theme for unit tests is "default", 153 153 // which doesn't have theme.json support.
Note: See TracChangeset
for help on using the changeset viewer.