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

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

Check that an event is stored properly in a CPT entry
public test_events_exist ( )
    function test_events_exist()
    {
        global $wpdb;
        $event = \Automattic\WP\Cron_Control\Tests\Utils::create_test_event();
        $post_name = sprintf('%s-%s-%s', $event['timestamp'], md5($event['action']), md5(maybe_serialize($event['args'])));
        $entry = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->posts} WHERE post_type = %s AND post_status = %s AND post_name = %s LIMIT 1", \Automattic\WP\Cron_Control\Cron_Options_CPT::POST_TYPE, \Automattic\WP\Cron_Control\Cron_Options_CPT::POST_STATUS_PENDING, $post_name));
        $this->assertEquals(count($entry), 1);
        $entry = array_shift($entry);
        $instance = maybe_unserialize($entry->post_content_filtered);
        $this->assertEquals($event['action'], $instance['action']);
        $this->assertEquals(md5(maybe_serialize($event['args'])), $instance['instance']);
        Utils::compare_arrays($event['args'], $instance['args'], $this);
    }