Skip to content

Commit 546114e

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53347 602fd350-edb4-49c9-b593-d223f7449a82
1 parent ad83514 commit 546114e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tests/phpunit/tests/basic.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public function test_security_md() {
2424
$security = file_get_contents( dirname( ABSPATH ) . '/SECURITY.md' );
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

3131
public function test_package_json() {

0 commit comments

Comments
 (0)