Make WordPress Core


Ignore:
Timestamp:
01/12/2020 02:16:57 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/site-health.php

    r46586 r47064  
    1616     */
    1717    function test_cron_health_checks_critical() {
     18        $wp_site_health = new WP_Site_Health();
     19
    1820        // Clear the cron array.
    1921        _set_cron_array( array() );
    20         $wp_site_health = new WP_Site_Health();
    21         $cron_health    = $wp_site_health->get_test_scheduled_events();
     22
     23        $cron_health = $wp_site_health->get_test_scheduled_events();
    2224
    2325        $this->assertSame( 'critical', $cron_health['status'] );
     
    3436     */
    3537    function test_cron_health_checks( $times, $expected_status, $expected_label, $expected_late, $expected_missed ) {
     38        $wp_site_health = new WP_Site_Health();
     39
    3640        /*
    3741         * Clear the cron array.
     
    4852        }
    4953
    50         $wp_site_health = new WP_Site_Health();
    51         $cron_health    = $wp_site_health->get_test_scheduled_events();
     54        $cron_health = $wp_site_health->get_test_scheduled_events();
    5255
    5356        $this->assertSame( $expected_status, $cron_health['status'] );
Note: See TracChangeset for help on using the changeset viewer.