From 98003a7546ce47065b7c3f567ce9b42d21aaf066 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 2 Mar 2020 01:11:29 +0000 Subject: [PATCH] Tests: Add a unit test to ensure the "Supported Versions" section of GitHub Security Policy always includes the latest stable branch. See #48667, #48521. git-svn-id: https://develop.svn.wordpress.org/trunk@47403 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/basic.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/phpunit/tests/basic.php b/tests/phpunit/tests/basic.php index 8c19d2047b..4facb8454b 100644 --- a/tests/phpunit/tests/basic.php +++ b/tests/phpunit/tests/basic.php @@ -17,6 +17,17 @@ class Tests_Basic extends WP_UnitTestCase { $this->assertEquals( $this_year, trim( $matches[1] ), "license.txt's year needs to be updated to $this_year." ); } + function test_security_md() { + // This test is designed to only run on trunk/master. + $this->skipOnAutomatedBranches(); + + $security = file_get_contents( dirname( ABSPATH ) . '/SECURITY.md' ); + preg_match( '#\d.\d.x#', $security, $matches ); + $current_version = substr( $GLOBALS['wp_version'], 0, 3 ); + $latest_stable = sprintf( '%s.x', (float) $current_version - 0.1 ); + $this->assertEquals( $latest_stable, trim( $matches[0] ), "SECURITY.md's version needs to be updated to $latest_stable." ); + } + function test_package_json() { $package_json = file_get_contents( dirname( ABSPATH ) . '/package.json' ); $package_json = json_decode( $package_json, true );