CPTP_Module_Rewrite_Test::test_cpt_date_archive_with_date_front PHP Method

test_cpt_date_archive_with_date_front() public method

    public function test_cpt_date_archive_with_date_front()
    {
        update_option($this->post_type . "_structure", "/%year%/%post_id%/");
        register_post_type($this->post_type, array("public" => true, 'taxonomies' => array('category'), "has_archive" => true));
        $post_type_object = get_post_type_object($this->post_type);
        $this->factory->post->create_many(10, array('post_type' => $this->post_type, "post_date" => "2012-12-12"));
        do_action('wp_loaded');
        /** @var WP_Rewrite $wp_rewrite */
        global $wp_rewrite;
        $wp_rewrite->flush_rules();
        $this->go_to(home_url("/" . $post_type_object->rewrite["slug"] . CPTP_Util::get_date_front($this->post_type) . "/2012"));
        $this->assertQueryTrue("is_archive", "is_post_type_archive", "is_date", "is_year");
        $this->go_to(next_posts(0, false));
        $this->assertQueryTrue("is_archive", "is_post_type_archive", "is_date", "is_year", "is_paged");
        $this->go_to(home_url("/" . $post_type_object->rewrite["slug"] . CPTP_Util::get_date_front($this->post_type) . "/2012/12"));
        $this->assertQueryTrue("is_archive", "is_post_type_archive", "is_date", "is_month");
        $this->go_to(next_posts(0, false));
        $this->assertQueryTrue("is_archive", "is_post_type_archive", "is_date", "is_month", "is_paged");
        $this->go_to(home_url("/" . $post_type_object->rewrite["slug"] . CPTP_Util::get_date_front($this->post_type) . "/2012/12/12"));
        $this->assertQueryTrue("is_archive", "is_post_type_archive", "is_date", "is_day");
        $this->go_to(next_posts(0, false));
        $this->assertQueryTrue("is_archive", "is_post_type_archive", "is_date", "is_day", "is_paged");
    }