You appear to be a bot. Output may be restricted
Description
Test update filter on WP_Customize_Custom_CSS_Setting.
Usage
Test_WP_Customize_Custom_CSS_Setting::test_update_filter();
Parameters
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/customize/custom-css-setting.php
Lines:
1 to 28 of 28
public function test_update_filter() { $original_css = 'body { color:red; }'; $post_id = $this->factory()->post->create( array( 'post_title' => $this->setting->stylesheet, 'post_name' => $this->setting->stylesheet, 'post_content' => $original_css, 'post_status' => 'publish', 'post_type' => 'custom_css', ) ); $overridden_css = 'body { color:green; }'; $this->wp_customize->set_post_value( $this->setting->id, $overridden_css ); $post = get_post( $post_id ); $original_title = $post->post_title; add_filter( 'update_custom_css_data', array( $this, 'filter_update_custom_css_data' ), 10, 3 ); $this->setting->save(); $post = get_post( $post_id ); $this->assertSame( $original_title, $post->post_title ); $this->assertStringContainsString( $overridden_css, $post->post_content ); $this->assertStringContainsString( '/* filtered post_content */', $post->post_content ); $this->assertStringContainsString( '/* filtered post_content_filtered */', $post->post_content_filtered ); }