@@ -666,5 +666,62 @@ function test_edit_post_sticky_false() {
666666
667667 $ this ->assertFalse ( is_sticky ( $ this ->post_id ) );
668668 }
669+
670+
671+ function test_check_read_permission () {
672+ $ publicstatusargs = array (
673+ 'label ' => _x ( 'testpublicstatus ' , 'Status General Name ' , 'wp-api ' ),
674+ 'label_count ' => _n_noop ( 'Testpublicstatus (%s) ' , 'Testpublicstatuses (%s) ' , 'wp-api ' ),
675+ 'public ' => true ,
676+ 'show_in_admin_all_list ' => true ,
677+ 'show_in_admin_status_list ' => true ,
678+ 'exclude_from_search ' => false ,
679+ );
680+ register_post_status ( 'testpublicstatus ' , $ publicstatusargs );
681+
682+ $ privatestatusargs = array (
683+ 'label ' => _x ( 'testprivatestatus ' , 'Status General Name ' , 'wp-api ' ),
684+ 'label_count ' => _n_noop ( 'Testprivatestatus (%s) ' , 'Testprivatestatuses (%s) ' , 'wp-api ' ),
685+ 'public ' => false ,
686+ 'show_in_admin_all_list ' => true ,
687+ 'show_in_admin_status_list ' => true ,
688+ 'exclude_from_search ' => false ,
689+ );
690+ register_post_status ( 'testprivatestatus ' , $ privatestatusargs );
691+
692+ $ publiccustom_args = array (
693+ 'post_content ' => 'this one is with a public status ' ,
694+ 'post_name ' => 'publicstatus-post ' ,
695+ 'post_title ' => 'Post with a custom public status ' ,
696+ 'post_status ' => 'testpublicstatus '
697+ );
698+
699+ $ privatecustom_args = array (
700+ 'post_content ' => 'this one is with a private status ' ,
701+ 'post_name ' => 'privatestatus-post ' ,
702+ 'post_title ' => 'Post with a custom private status ' ,
703+ 'post_status ' => 'testprivatestatus '
704+ );
705+
706+ $ publish_args = array (
707+ 'post_content ' => 'this one is with a publish status ' ,
708+ 'post_name ' => 'publish-post ' ,
709+ 'post_title ' => 'Post with publish status ' ,
710+ 'post_status ' => 'publish '
711+ );
712+
713+ $ publiccustom_pid = wp_insert_post ( $ publiccustom_args );
714+ $ privatecustom_pid = wp_insert_post ( $ privatecustom_args );
715+ $ publish_pid = wp_insert_post ( $ publish_args );
716+
717+ $ pub_cust_post = get_post ( $ publiccustom_pid , ARRAY_A );
718+ $ priv_cust_post = get_post ( $ privatecustom_pid , ARRAY_A );
719+ $ pub_post = get_post ( $ publish_pid , ARRAY_A );
720+
721+ $ this ->assertTrue ($ pub_cust_post );
722+ $ this ->assertFalse ($ priv_cust_post );
723+ $ this ->assertTrue ($ pub_post );
724+ }
725+
669726
670727}
0 commit comments