mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
When asserting microtime output as a number, make it a number
microtime is by default a string. Doing a greater then or less than check of that string is a bad idea since it uses the first part (the micro part of microtime) rather then the actual time. This adds a helper to convert microtime output into a float which we can then use to properly compare the output of microtime. This fixes an intermittent test failure. fixes #30336 git-svn-id: https://develop.svn.wordpress.org/trunk@30337 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -79,7 +79,9 @@ class Tests_Post_getPages extends WP_UnitTestCase {
|
||||
|
||||
// This should bump last_changed.
|
||||
wp_delete_post( $pages[0]->ID );
|
||||
$this->assertGreaterThan( $last_changed, wp_cache_get( 'last_changed', 'posts' ) );
|
||||
$old_changed_float = $this->_microtime_to_float( $last_changed );
|
||||
$new_changed_float = $this->_microtime_to_float( wp_cache_get( 'last_changed', 'posts' ) );
|
||||
$this->assertGreaterThan( $old_changed_float, $new_changed_float );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
$last_changed = wp_cache_get( 'last_changed', 'posts' );
|
||||
@@ -282,4 +284,4 @@ class Tests_Post_getPages extends WP_UnitTestCase {
|
||||
$pages = get_pages( array( 'child_of' => $page1, 'meta_key' => 'color', 'meta_value' => 'blue' ) );
|
||||
$this->assertEqualSets( array( $page3 ), wp_list_pluck( $pages, 'ID' ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user