Make WordPress Core

Changeset 62229


Ignore:
Timestamp:
04/13/2026 07:29:55 AM (32 hours ago)
Author:
SergeyBiryukov
Message:

Tests: Expand @covers tags for WP_Embed tests.

Includes removing the external-http group for a WP_Embed::run_shortcode() test which does not perform any HTTP requests.

Follow-up to [50448], [62223], [62228].

See #64225.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/oembed/WpEmbed.php

    r62223 r62229  
    44 * @group oembed
    55 *
    6  * @covers WP_Embed
     6 * @coversDefaultClass WP_Embed
    77 */
    88class Tests_WP_Embed extends WP_UnitTestCase {
     
    2525    }
    2626
     27    /**
     28     * @covers ::maybe_run_ajax_cache
     29     */
    2730    public function test_maybe_run_ajax_cache_should_return_nothing_if_there_is_no_post() {
    2831        $this->expectOutputString( '' );
     
    3033    }
    3134
     35    /**
     36     * @covers ::maybe_run_ajax_cache
     37     */
    3238    public function test_maybe_run_ajax_cache_should_return_nothing_if_there_is_no_message() {
    3339        $GLOBALS['post'] = self::factory()->post->create_and_get(
     
    4349    }
    4450
     51    /**
     52     * @covers ::maybe_run_ajax_cache
     53     */
    4554    public function test_maybe_run_ajax_cache_should_return_javascript() {
    4655        $GLOBALS['post'] = self::factory()->post->create_and_get(
     
    6069    }
    6170
     71    /**
     72     * @covers ::wp_maybe_load_embeds
     73     */
    6274    public function test_wp_maybe_load_embeds() {
    6375        $this->assertSameSets( array( 10, 9999 ), array_keys( $GLOBALS['wp_embed']->handlers ) );
     
    7789    }
    7890
     91    /**
     92     * @covers ::wp_embed_register_handler
     93     */
    7994    public function test_wp_embed_register_handler() {
    8095        $handle   = __FUNCTION__;
     
    95110    }
    96111
     112    /**
     113     * @covers ::wp_embed_unregister_handler
     114     */
    97115    public function test_wp_embed_unregister_handler() {
    98116        $this->assertArrayHasKey( 'youtube_embed_url', $GLOBALS['wp_embed']->handlers[10] );
     
    110128    /**
    111129     * @group external-http
     130     *
     131     * @covers ::autoembed
    112132     */
    113133    public function test_autoembed_should_do_nothing_without_matching_handler() {
     
    120140    /**
    121141     * @group external-http
     142     *
     143     * @covers ::autoembed
    122144     */
    123145    public function test_autoembed_should_return_modified_content() {
     
    136158    }
    137159
     160    /**
     161     * @covers ::delete_oembed_caches
     162     */
    138163    public function test_delete_oembed_caches() {
    139164        $post_id = self::factory()->post->create();
     
    149174    }
    150175
     176    /**
     177     * @covers ::cache_oembed
     178     */
    151179    public function test_cache_oembed_invalid_post_type() {
    152180        $post_id = self::factory()->post->create( array( 'post_type' => 'nav_menu_item' ) );
     
    156184    }
    157185
     186    /**
     187     * @covers ::cache_oembed
     188     */
    158189    public function test_cache_oembed_empty_content() {
    159190        $post_id = self::factory()->post->create( array( 'post_content' => '' ) );
     
    163194    }
    164195
     196    /**
     197     * @covers ::cache_oembed
     198     */
    165199    public function test_cache_oembed_for_post() {
    166200        $url           = 'https://example.com/';
     
    181215    }
    182216
     217    /**
     218     * @covers ::shortcode
     219     */
    183220    public function test_shortcode_should_get_cached_data_from_post_meta_for_known_post() {
    184221        global $post;
     
    208245    }
    209246
     247    /**
     248     * @covers ::shortcode
     249     */
    210250    public function test_shortcode_should_get_cached_failure_from_post_meta_for_known_post() {
    211251        global $post;
     
    242282    /**
    243283     * @ticket 34115
     284     *
     285     * @covers ::shortcode
    244286     */
    245287    public function test_shortcode_should_cache_data_in_custom_post() {
     
    268310    /**
    269311     * @ticket 34115
     312     *
     313     * @covers ::shortcode
    270314     */
    271315    public function test_shortcode_should_cache_failure_in_custom_post() {
     
    296340     *
    297341     * @ticket 42310
     342     *
     343     * @covers ::shortcode
    298344     */
    299345    public function test_shortcode_should_update_custom_post() {
     
    328374    /**
    329375     * @group external-http
     376     *
     377     * @covers ::shortcode
    330378     */
    331379    public function test_shortcode_should_get_url_from_src_attribute() {
     
    338386    /**
    339387     * @group external-http
     388     *
     389     * @covers ::shortcode
    340390     */
    341391    public function test_shortcode_should_return_empty_string_for_missing_url() {
     
    345395    /**
    346396     * @group external-http
     397     *
     398     * @covers ::shortcode
    347399     */
    348400    public function test_shortcode_should_make_link_for_unknown_url() {
     
    354406
    355407    /**
    356      * @group external-http
     408     * @covers ::run_shortcode
    357409     */
    358410    public function test_run_shortcode_url_only() {
     
    362414    }
    363415
     416    /**
     417     * @covers ::maybe_make_link
     418     */
    364419    public function test_maybe_make_link() {
    365420        $url    = 'http://example.com/embed/foo';
     
    369424    }
    370425
     426    /**
     427     * @covers ::maybe_make_link
     428     */
    371429    public function test_maybe_make_link_return_false_on_fail() {
    372430        $this->wp_embed->return_false_on_fail = true;
     
    374432    }
    375433
     434    /**
     435     * @covers ::maybe_make_link
     436     */
    376437    public function test_maybe_make_link_do_not_link_if_unknown() {
    377438        $url = 'http://example.com/';
Note: See TracChangeset for help on using the changeset viewer.