Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Test filter_get_post_status
Browse files Browse the repository at this point in the history
  • Loading branch information
lgedeon committed Jul 3, 2016
1 parent 35ee1b0 commit e0f02c6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/php/test-class-wp-customize-posts-preview.php
Expand Up @@ -699,4 +699,29 @@ public function test_export_registered_settings() {
$this->assertEquals( 'postmeta', $results['customize_post_settings'][ $postmeta_setting_id ]['type'] );
$this->assertEquals( 'post', $results['customize_post_settings'][ $post_setting_id ]['type'] );
}

/**
* Test filter_get_post_status().
*
* @see WP_Customize_Posts_Preview::filter_get_post_status()
*/
public function test_filter_get_post_status() {
global $post;
$post = get_post( $this->post_id );
$setting_id = WP_Customize_Post_Setting::get_post_setting_id( $post );
$override_status = 'draft';
$this->wp_customize->set_post_value( $setting_id, array_merge(
$post->to_array(),
array(
'post_status' => $override_status,
)
) );
$this->wp_customize->register_dynamic_settings();
$post_setting = $this->wp_customize->get_setting( $setting_id );
$post_setting->preview();
setup_postdata( $post );
$this->assertEquals( $override_status, $post->post_status );
$this->assertEquals( $override_status, get_post_status( $post ) );
}

}

0 comments on commit e0f02c6

Please sign in to comment.