Make WordPress Core


Ignore:
Timestamp:
11/12/2019 06:04:34 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Bundled Themes: Update copyright year in readme.txt.

Add a unit test to ensure the year stays up to date.

Props dkarfa, SergeyBiryukov.
Merges [46719] and [46720] to the 5.3 branch.
Fixes #48566.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/tests/phpunit/tests/theme.php

    r46278 r46721  
    212212
    213213        /**
     214         * @ticket 48566
     215         */
     216        function test_year_in_readme() {
     217                // This test is designed to only run on trunk/master.
     218                $this->skipOnAutomatedBranches();
     219
     220                foreach ( $this->default_themes as $theme ) {
     221                        $wp_theme = wp_get_theme( $theme );
     222
     223                        $path_to_readme_txt = $wp_theme->get_theme_root() . '/' . $wp_theme->get_stylesheet() . '/readme.txt';
     224                        $this->assertFileExists( $path_to_readme_txt );
     225                        $readme    = file_get_contents( $path_to_readme_txt );
     226                        $this_year = gmdate( 'Y' );
     227
     228                        preg_match( '#Copyright (\d+) WordPress.org#', $readme, $matches );
     229                        if ( $matches ) {
     230                                $this->assertEquals( $this_year, trim( $matches[1] ), "Bundled themes readme.txt's year needs to be updated to $this_year." );
     231                        }
     232
     233                        preg_match( '#Copyright 20\d\d-(\d+) WordPress.org#', $readme, $matches );
     234                        if ( $matches ) {
     235                                $this->assertEquals( $this_year, trim( $matches[1] ), "Bundled themes readme.txt's year needs to be updated to $this_year." );
     236                        }
     237                }
     238        }
     239
     240        /**
    214241         * @ticket 20897
    215242         * @expectedDeprecated get_theme_data
Note: See TracChangeset for help on using the changeset viewer.