Make WordPress Core


Ignore:
Timestamp:
10/14/2024 01:05:09 AM (22 months ago)
Author:
peterwilsoncc
Message:

Bundled Themes: Test new themes are added to new bundled files.

Introduces a test to ensure that new bundled themes are included in the $_new_bundled_files array. Modifies previous theme related tests added during the 6.7 release cycle to include the correct annotations.

Props peterwilsoncc, mukesh27, costdev.
See #61530, #62103.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme.php

    r59186 r59227  
    215215        /**
    216216         * Tests the default themes list in the test suite matches the runtime default themes.
     217         *
     218         * @ticket 62103
     219         *
     220         * @coversNothing
    217221         */
    218222        public function test_default_default_theme_list_match_in_test_suite_and_at_runtime() {
     
    234238        /**
    235239         * Test the default theme in WP_Theme matches the WP_DEFAULT_THEME constant.
     240         *
     241         * @ticket 62103
     242         *
     243         * @covers WP_Theme::get_core_default_theme
    236244         */
    237245        public function test_default_theme_matches_constant() {
     
    249257
    250258                $this->assertSame( $wp_default_theme_constant, $latest_default_theme->get_stylesheet(), 'WP_DEFAULT_THEME should match the latest default theme.' );
     259        }
     260
     261        /**
     262         * Ensure that the default themes are included in the new bundled files.
     263         *
     264         * @ticket 62103
     265         *
     266         * @coversNothing
     267         *
     268         * @runInSeparateProcess
     269         * @preserveGlobalState disabled
     270         */
     271        public function test_default_themes_are_included_in_new_files() {
     272                require_once ABSPATH . 'wp-admin/includes/update-core.php';
     273                global $_new_bundled_files;
     274                // Limit new bundled files to the default themes.
     275                $new_theme_files = array_keys( $_new_bundled_files );
     276                $new_theme_files = array_filter(
     277                        $new_theme_files,
     278                        static function ( $file ) {
     279                                return str_starts_with( $file, 'themes/' );
     280                        }
     281                );
     282
     283                $tested_themes = $this->default_themes;
     284                // Convert the tested themes to directory names.
     285                $tested_themes = array_map(
     286                        static function ( $theme ) {
     287                                return "themes/{$theme}/";
     288                        },
     289                        $tested_themes
     290                );
     291
     292                $this->assertSameSets( $tested_themes, $new_theme_files, 'New bundled files should include the default themes.' );
    251293        }
    252294
Note: See TracChangeset for help on using the changeset viewer.