| @@ 157-174 (lines=18) @@ | ||
| 154 | $this->assertEquals( $wp_version, $this->server_replica_storage->get_callable( 'wp_version' ) ); |
|
| 155 | } |
|
| 156 | ||
| 157 | function test_sync_post_filtered_content_was_filtered_when_syncing_all() { |
|
| 158 | $post_id = $this->factory->post->create(); |
|
| 159 | $post = get_post( $post_id ); |
|
| 160 | add_shortcode( 'foo', array( $this, 'foo_shortcode' ) ); |
|
| 161 | $post->post_content = "[foo]"; |
|
| 162 | wp_update_post( $post ); |
|
| 163 | $this->server_replica_storage->reset(); |
|
| 164 | $this->sender->reset_data(); |
|
| 165 | // this only applies to rendered content, which is off by default |
|
| 166 | Settings::update_settings( array( 'render_filtered_content' => 1 ) ); |
|
| 167 | ||
| 168 | $this->full_sync->start(); |
|
| 169 | $this->sender->do_full_sync(); |
|
| 170 | ||
| 171 | $post_on_server = $this->server_replica_storage->get_post( $post->ID ); |
|
| 172 | $this->assertEquals( $post_on_server->post_content, '[foo]' ); |
|
| 173 | $this->assertEquals( trim( $post_on_server->post_content_filtered ), 'bar' ); |
|
| 174 | } |
|
| 175 | ||
| 176 | function foo_shortcode() { |
|
| 177 | return 'bar'; |
|
| @@ 183-200 (lines=18) @@ | ||
| 180 | $this->assertEquals( $wp_version, $this->server_replica_storage->get_callable( 'wp_version' ) ); |
|
| 181 | } |
|
| 182 | ||
| 183 | function test_sync_post_filtered_content_was_filtered_when_syncing_all() { |
|
| 184 | $post_id = $this->factory->post->create(); |
|
| 185 | $post = get_post( $post_id ); |
|
| 186 | add_shortcode( 'foo', array( $this, 'foo_shortcode' ) ); |
|
| 187 | $post->post_content = "[foo]"; |
|
| 188 | wp_update_post( $post ); |
|
| 189 | $this->server_replica_storage->reset(); |
|
| 190 | $this->sender->reset_data(); |
|
| 191 | // this only applies to rendered content, which is off by default |
|
| 192 | Settings::update_settings( array( 'render_filtered_content' => 1 ) ); |
|
| 193 | ||
| 194 | $this->full_sync->start(); |
|
| 195 | $this->sender->do_full_sync(); |
|
| 196 | ||
| 197 | $post_on_server = $this->server_replica_storage->get_post( $post->ID ); |
|
| 198 | $this->assertEquals( $post_on_server->post_content, '[foo]' ); |
|
| 199 | $this->assertEquals( trim( $post_on_server->post_content_filtered ), 'bar' ); |
|
| 200 | } |
|
| 201 | ||
| 202 | function foo_shortcode() { |
|
| 203 | return 'bar'; |
|