Changeset 59579
- Timestamp:
- 01/06/2025 03:58:50 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme.php
r59227 r59579 303 303 /** 304 304 * @ticket 48566 305 */ 306 public function test_year_in_readme() { 305 * 306 * @dataProvider data_year_in_readme 307 */ 308 public function test_year_in_readme( $theme ) { 307 309 // This test is designed to only run on trunk. 308 310 $this->skipOnAutomatedBranches(); 309 311 310 foreach ( $this->default_themes as $theme ) { 311 $wp_theme = wp_get_theme( $theme ); 312 313 $path_to_readme_txt = $wp_theme->get_theme_root() . '/' . $wp_theme->get_stylesheet() . '/readme.txt'; 314 $this->assertFileExists( $path_to_readme_txt ); 315 316 $readme = file_get_contents( $path_to_readme_txt ); 317 $this_year = gmdate( 'Y' ); 318 319 preg_match( '#Copyright (\d+) WordPress.org#', $readme, $matches ); 320 if ( $matches ) { 321 $readme_year = trim( $matches[1] ); 322 323 $this->assertSame( $this_year, $readme_year, "Bundled themes readme.txt's year needs to be updated to $this_year." ); 324 } 325 326 preg_match( '#Copyright 20\d\d-(\d+) WordPress.org#', $readme, $matches ); 327 if ( $matches ) { 328 $readme_year = trim( $matches[1] ); 329 330 $this->assertSame( $this_year, $readme_year, "Bundled themes readme.txt's year needs to be updated to $this_year." ); 331 } 312 $wp_theme = wp_get_theme( $theme ); 313 314 $path_to_readme_txt = $wp_theme->get_theme_root() . '/' . $wp_theme->get_stylesheet() . '/readme.txt'; 315 $this->assertFileExists( $path_to_readme_txt ); 316 317 $readme = file_get_contents( $path_to_readme_txt ); 318 $this_year = gmdate( 'Y' ); 319 320 preg_match( '#(Copyright|\(C\)) (20\d\d-)?(\d+) WordPress.org#i', $readme, $matches ); 321 if ( $matches ) { 322 $readme_year = trim( $matches[3] ); 323 324 $this->assertSame( $this_year, $readme_year, "$theme readme.txt's year needs to be updated to $this_year." ); 332 325 } 326 } 327 328 public function data_year_in_readme() { 329 return array_map( 330 static function ( $theme ) { 331 return array( $theme ); 332 }, 333 $this->default_themes 334 ); 333 335 } 334 336
Note: See TracChangeset
for help on using the changeset viewer.