Automattic\WP\Cron_Control\Tests\Cron_Options_CPT_Tests::test_filter_cron_option_get PHP Метод

test_filter_cron_option_get() публичный Метод

Check format of filtered array returned from CPT
    function test_filter_cron_option_get()
    {
        $event = Utils::create_test_event();
        $cron = get_option('cron');
        // Core versions the cron option (see `_upgrade_cron_array()`)
        // Without this in the filtered result, all events continually requeue as Core tries to "upgrade" the option
        $this->assertArrayHasKey('version', $cron);
        $this->assertEquals($cron['version'], 2);
        // Validate the remaining structure
        $cron = \Automattic\WP\Cron_Control\collapse_events_array($cron);
        foreach ($cron as $single_cron) {
            $this->assertEquals($single_cron['timestamp'], $event['timestamp']);
            $this->assertEquals($single_cron['action'], $event['action']);
            $this->assertArrayHasKey('args', $single_cron);
            $this->assertArrayHasKey('schedule', $single_cron['args']);
            $this->assertArrayHasKey('args', $single_cron['args']);
            $this->assertEquals($single_cron['args']['args'], $event['args']);
        }
    }