Changeset 42009 for trunk/tests/phpunit/tests/oembed/WpEmbed.php
- Timestamp:
- 10/24/2017 11:09:43 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/oembed/WpEmbed.php
r41651 r42009 273 273 } 274 274 275 /** 276 * Test that parsing an embed shortcode should cause oembed_cache to be updated. 277 * 278 * @ticket 42310 279 */ 280 public function test_shortcode_should_update_custom_post() { 281 add_filter( 'oembed_ttl', '__return_zero' ); 282 283 $url = 'https://example.com/'; 284 $embedded = '<b>Embedded content</b>'; 285 $key_suffix = md5( $url . serialize( wp_embed_defaults( $url ) ) ); 286 287 add_filter( 'pre_oembed_result', '__return_empty_string' ); 288 $this->wp_embed->shortcode( array(), $url ); 289 remove_filter( 'pre_oembed_result', '__return_empty_string' ); 290 291 $oembed_post_id = $this->wp_embed->find_oembed_post_id( $key_suffix ); 292 293 $this->assertSame( '{{unknown}}', get_post( $oembed_post_id )->post_content ); 294 295 $previous_usecache = $this->wp_embed->usecache; 296 $this->wp_embed->usecache = false; 297 298 // The update cannot be empty because empty responses won't overwrite the cache. 299 add_filter( 'pre_oembed_result', array( $this, '_pre_oembed_result_callback' ) ); 300 $this->wp_embed->shortcode( array(), $url ); 301 remove_filter( 'pre_oembed_result', array( $this, '_pre_oembed_result_callback' ) ); 302 303 $this->assertSame( $embedded, get_post( $oembed_post_id )->post_content ); 304 305 $this->wp_embed->usecache = $previous_usecache; 306 remove_filter( 'oembed_ttl', '__return_zero' ); 307 } 308 275 309 public function test_shortcode_should_get_url_from_src_attribute() { 276 310 $url = 'http://example.com/embed/foo';
Note: See TracChangeset
for help on using the changeset viewer.