Tests: In Tests_Site_Health
, create a WP_Site_Health
instance before clearing the cron array, as the constructor schedules its own task now.
See #47606. git-svn-id: https://develop.svn.wordpress.org/trunk@47064 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
396cc8205b
commit
2daa4b6c82
@ -15,9 +15,11 @@ class Tests_Site_Health extends WP_UnitTestCase {
|
|||||||
* @ticket 47223
|
* @ticket 47223
|
||||||
*/
|
*/
|
||||||
function test_cron_health_checks_critical() {
|
function test_cron_health_checks_critical() {
|
||||||
|
$wp_site_health = new WP_Site_Health();
|
||||||
|
|
||||||
// Clear the cron array.
|
// Clear the cron array.
|
||||||
_set_cron_array( array() );
|
_set_cron_array( array() );
|
||||||
$wp_site_health = new WP_Site_Health();
|
|
||||||
$cron_health = $wp_site_health->get_test_scheduled_events();
|
$cron_health = $wp_site_health->get_test_scheduled_events();
|
||||||
|
|
||||||
$this->assertSame( 'critical', $cron_health['status'] );
|
$this->assertSame( 'critical', $cron_health['status'] );
|
||||||
@ -33,6 +35,8 @@ class Tests_Site_Health extends WP_UnitTestCase {
|
|||||||
* @ticket 47223
|
* @ticket 47223
|
||||||
*/
|
*/
|
||||||
function test_cron_health_checks( $times, $expected_status, $expected_label, $expected_late, $expected_missed ) {
|
function test_cron_health_checks( $times, $expected_status, $expected_label, $expected_late, $expected_missed ) {
|
||||||
|
$wp_site_health = new WP_Site_Health();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear the cron array.
|
* Clear the cron array.
|
||||||
*
|
*
|
||||||
@ -47,7 +51,6 @@ class Tests_Site_Health extends WP_UnitTestCase {
|
|||||||
wp_schedule_event( $timestamp, 'daily', __FUNCTION__ . "_{$job}" );
|
wp_schedule_event( $timestamp, 'daily', __FUNCTION__ . "_{$job}" );
|
||||||
}
|
}
|
||||||
|
|
||||||
$wp_site_health = new WP_Site_Health();
|
|
||||||
$cron_health = $wp_site_health->get_test_scheduled_events();
|
$cron_health = $wp_site_health->get_test_scheduled_events();
|
||||||
|
|
||||||
$this->assertSame( $expected_status, $cron_health['status'] );
|
$this->assertSame( $expected_status, $cron_health['status'] );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user