CPTP_Module_Rewrite_Test::test_cpt_author_archive PHP Method

test_cpt_author_archive() public method

    public function test_cpt_author_archive()
    {
        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);
        $user_id = $this->factory->user->create();
        $this->factory->post->create_many(10, array('post_type' => $this->post_type, "post_date" => "2012-12-12", "post_author" => $user_id));
        $user = get_userdata($user_id);
        $user->user_nicename;
        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"] . "/author/" . $user->user_nicename));
        $this->assertQueryTrue("is_archive", "is_post_type_archive", "is_author");
        $this->go_to(next_posts(0, false));
        $this->assertQueryTrue("is_archive", "is_post_type_archive", "is_author", "is_paged");
    }