mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Tests: Use delta comparison in test_site_dates_are_gmt()
to avoid race conditions.
Merges [47313] to the 5.1 branch. See #40364. git-svn-id: https://develop.svn.wordpress.org/branches/5.1@47316 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b6a2c29473
commit
c3011a9ba5
@ -391,11 +391,11 @@ if ( is_multisite() ) :
|
||||
|
||||
wpmu_update_blogs_date();
|
||||
|
||||
// compare the update time with the current time, allow delta < 2
|
||||
$blog = get_site( get_current_blog_id() );
|
||||
$current_time = time();
|
||||
$time_difference = $current_time - strtotime( $blog->last_updated );
|
||||
$this->assertLessThan( 2, $time_difference );
|
||||
$blog = get_site( get_current_blog_id() );
|
||||
$current_time = time();
|
||||
|
||||
// Compare the update time with the current time, allow delta < 2.
|
||||
$this->assertEquals( $current_time, strtotime( $blog->last_updated ), 'The dates should be equal', 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1754,16 +1754,16 @@ if ( is_multisite() ) :
|
||||
$this->assertInternalType( 'integer', $site_id );
|
||||
|
||||
$site = get_site( $site_id );
|
||||
$this->assertSame( $first_date, $site->registered );
|
||||
$this->assertSame( $first_date, $site->last_updated );
|
||||
$this->assertSame( strtotime( $first_date ), strtotime( $site->registered ), 'The dates should be equal', 2 );
|
||||
$this->assertSame( strtotime( $first_date ), strtotime( $site->last_updated ), 'The dates should be equal', 2 );
|
||||
|
||||
$second_date = current_time( 'mysql', true );
|
||||
$site_id = wp_update_site( $site_id, array() );
|
||||
$this->assertInternalType( 'integer', $site_id );
|
||||
|
||||
$site = get_site( $site_id );
|
||||
$this->assertSame( $first_date, $site->registered );
|
||||
$this->assertSame( $second_date, $site->last_updated );
|
||||
$this->assertSame( strtotime( $first_date ), strtotime( $site->registered ), 'The dates should be equal', 2 );
|
||||
$this->assertSame( strtotime( $second_date ), strtotime( $site->last_updated ), 'The dates should be equal', 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user