WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/29/2015 12:01:22 AM (5 years ago)
Author:
azaozz
Message:

Use the embed_maybe_make_link filter to test WP_Embed::autoembed().
See #33106.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r33469 r33470  
    656656     * @ticket 33016
    657657     */
    658     function filter_wp_embed_shortcode_custom( $custom, $attr, $url ) {
     658    function filter_wp_embed_shortcode_custom( $content, $url ) {
    659659        if ( 'https://www.example.com/?video=1' == $url ) {
    660             $custom = "<iframe src='$url'></iframe>";
     660            $content = '@embed URL was replaced@';
    661661        }
    662         return $custom;
     662        return $content;
    663663    }
    664664
     
    668668    function test_oembed_explicit_media_link() {
    669669        global $wp_embed;
    670         add_filter( 'wp_embed_shortcode_custom', array( $this, 'filter_wp_embed_shortcode_custom' ), 10, 3 );
     670        add_filter( 'embed_maybe_make_link', array( $this, 'filter_wp_embed_shortcode_custom' ), 10, 2 );
    671671
    672672        $content = <<<EOF
     
    675675
    676676        $expected = <<<EOF
    677 <iframe src='https://www.example.com/?video=1'></iframe>
     677@embed URL was replaced@
    678678EOF;
    679679
     
    687687myvar = 'Hello world
    688688https://www.example.com/?video=1
    689 don't break this';
     689do not break this';
    690690// ]]>
    691691</script>
     
    695695        $this->assertEquals( $content, $result );
    696696
    697         remove_filter( 'wp_embed_shortcode_custom', array( $this, 'filter_wp_embed_shortcode_custom' ), 10 );
     697        remove_filter( 'embed_maybe_make_link', array( $this, 'filter_wp_embed_shortcode_custom' ), 10 );
    698698    }
    699699}
Note: See TracChangeset for help on using the changeset viewer.