Make WordPress Core

Changeset 53347


Ignore:
Timestamp:
05/03/2022 06:55:45 PM (4 years ago)
Author:
hellofromTonya
Message:

Build/Test Tools: Ensure version number is in 'X.X' format after float math: Tests_Basic::test_security_md().

After subtracing 0.1 from a X.1 current version, the result was a single digit without the .0 decimal. Using number_format() ensures each current version has a decimal before appending the .x before the test.

This commit also reverts [55346] which was a temporary workaround.

Follow-up to [55346], [47403].
Fixes #55667.

File:
1 edited

Legend:

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

    r53346 r53347  
    2525        preg_match( '#\d.\d.x#', $security, $matches );
    2626        $current_version = substr( $GLOBALS['wp_version'], 0, 3 );
    27         $latest_stable   = sprintf( '%s.x', (float) $current_version - 0.1 );
    28         // $this->assertSame( $latest_stable, trim( $matches[0] ), "SECURITY.md's version needs to be updated to $latest_stable." );
     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." );
    2929    }
    3030
Note: See TracChangeset for help on using the changeset viewer.