Changeset 53357 for trunk/tests/phpunit/tests/basic.php
- Timestamp:
- 05/06/2022 11:09:54 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/basic.php
r53349 r53357 14 14 $license = file_get_contents( ABSPATH . 'license.txt' ); 15 15 preg_match( '#Copyright 2011-(\d+) by the contributors#', $license, $matches ); 16 $this_year = gmdate( 'Y' ); 17 $this->assertSame( $this_year, trim( $matches[1] ), "license.txt's year needs to be updated to $this_year." ); 16 $license_year = trim( $matches[1] ); 17 $this_year = gmdate( 'Y' ); 18 19 $this->assertSame( $this_year, $license_year, "license.txt's year needs to be updated to $this_year." ); 18 20 } 19 21 … … 23 25 24 26 $security = file_get_contents( dirname( ABSPATH ) . '/SECURITY.md' ); 25 preg_match( '#\d.\d.x#', $security, $matches ); 26 $current_version = substr( $GLOBALS['wp_version'], 0, 3 ); 27 $latest_stable = number_format( (float) $current_version - 0.1, 1 ) . '.x'; 28 $this->assertSame( $latest_stable, trim( $matches[0] ), "SECURITY.md's version needs to be updated to $latest_stable." ); 27 preg_match_all( '#\d.\d.x#', $security, $matches ); 28 $supported_versions = $matches[0]; 29 $current_version = substr( $GLOBALS['wp_version'], 0, 3 ); 30 $latest_stable = number_format( (float) $current_version - 0.1, 1 ) . '.x'; 31 32 $this->assertContains( $latest_stable, $supported_versions, "SECURITY.md's version needs to be updated to $latest_stable." ); 29 33 } 30 34 … … 33 37 $package_json = json_decode( $package_json, true ); 34 38 list( $version ) = explode( '-', $GLOBALS['wp_version'] ); 39 35 40 // package.json uses x.y.z, so fill cleaned $wp_version for .0 releases. 36 41 if ( 1 === substr_count( $version, '.' ) ) { 37 42 $version .= '.0'; 38 43 } 44 39 45 $this->assertSame( $version, $package_json['version'], "package.json's version needs to be updated to $version." ); 46 40 47 return $package_json; 41 48 }
Note: See TracChangeset
for help on using the changeset viewer.