Make WordPress Core

Changeset 47403


Ignore:
Timestamp:
03/02/2020 01:11:29 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Tests: Add a unit test to ensure the "Supported Versions" section of GitHub Security Policy always includes the latest stable branch.

See #48667, #48521.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/basic.php

    r47122 r47403  
    1616                $this_year = gmdate( 'Y' );
    1717                $this->assertEquals( $this_year, trim( $matches[1] ), "license.txt's year needs to be updated to $this_year." );
     18        }
     19
     20        function test_security_md() {
     21                // This test is designed to only run on trunk/master.
     22                $this->skipOnAutomatedBranches();
     23
     24                $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   = sprintf( '%s.x', (float) $current_version - 0.1 );
     28                $this->assertEquals( $latest_stable, trim( $matches[0] ), "SECURITY.md's version needs to be updated to $latest_stable." );
    1829        }
    1930
Note: See TracChangeset for help on using the changeset viewer.