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
This commit is contained in:
Tonya Mork
2022-05-03 18:55:45 +00:00
parent ad835148ff
commit 546114eca8

View File

@@ -24,8 +24,8 @@ class Tests_Basic extends WP_UnitTestCase {
$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->assertSame( $latest_stable, trim( $matches[0] ), "SECURITY.md's version needs to be updated to $latest_stable." );
$latest_stable = number_format( (float) $current_version - 0.1, 1 ) . '.x';
$this->assertSame( $latest_stable, trim( $matches[0] ), "SECURITY.md's version needs to be updated to $latest_stable." );
}
public function test_package_json() {