Bundled Themes: Update copyright year in readme.txt.

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

Props dkarfa, SergeyBiryukov.
Fixes #48566.

git-svn-id: https://develop.svn.wordpress.org/trunk@46719 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2019-11-12 17:34:05 +00:00
parent eabc288f67
commit 6c776ea07b
12 changed files with 39 additions and 12 deletions

View File

@@ -210,6 +210,33 @@ class Tests_Theme extends WP_UnitTestCase {
}
}
/**
* @ticket 48566
*/
function test_year_in_readme() {
// This test is designed to only run on trunk/master.
$this->skipOnAutomatedBranches();
foreach ( $this->default_themes as $theme ) {
$wp_theme = wp_get_theme( $theme );
$path_to_readme_txt = $wp_theme->get_theme_root() . '/' . $wp_theme->get_stylesheet() . '/readme.txt';
$this->assertFileExists( $path_to_readme_txt );
$readme = file_get_contents( $path_to_readme_txt );
$this_year = gmdate( 'Y' );
preg_match( '#Copyright (\d+) WordPress.org#', $readme, $matches );
if ( $matches ) {
$this->assertEquals( $this_year, trim( $matches[1] ), "Bundled themes readme.txt's year needs to be updated to $this_year." );
}
preg_match( '#Copyright 20\d\d-(\d+) WordPress.org#', $readme, $matches );
if ( $matches ) {
$this->assertEquals( $this_year, trim( $matches[1] ), "Bundled themes readme.txt's year needs to be updated to $this_year." );
}
}
}
/**
* @ticket 20897
* @expectedDeprecated get_theme_data