Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (3 years ago)
Author:
hellofromTonya
Message:

Coding Standards: Add visibility to methods in tests/phpunit/tests/.

Adds a public visibility to test fixtures, tests, data providers, and callbacks methods.

Adds a private visibility to helper methods within test classes.

Renames callbacks and helpers that previously started with a _ prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit.

Props costdev, jrf, hellofromTonya.
Fixes #54177.

File:
1 edited

Legend:

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

    r51587 r52010  
    55 */
    66class Tests_Embed_Template extends WP_UnitTestCase {
    7     function test_oembed_output_post() {
     7    public function test_oembed_output_post() {
    88        $user = self::factory()->user->create_and_get(
    99            array(
     
    3737    }
    3838
    39     function test_oembed_output_post_with_thumbnail() {
     39    public function test_oembed_output_post_with_thumbnail() {
    4040        $post_id       = self::factory()->post->create(
    4141            array(
     
    7070    }
    7171
    72     function test_oembed_output_404() {
     72    public function test_oembed_output_404() {
    7373        $this->go_to( home_url( '/?p=123&embed=true' ) );
    7474        $GLOBALS['wp_query']->query_vars['embed'] = true;
     
    8585    }
    8686
    87     function test_oembed_output_attachment() {
     87    public function test_oembed_output_attachment() {
    8888        $post          = self::factory()->post->create_and_get();
    8989        $file          = DIR_TESTDATA . '/images/canola.jpg';
     
    114114    }
    115115
    116     function test_oembed_output_draft_post() {
     116    public function test_oembed_output_draft_post() {
    117117        $post_id = self::factory()->post->create(
    118118            array(
     
    137137    }
    138138
    139     function test_oembed_output_scheduled_post() {
     139    public function test_oembed_output_scheduled_post() {
    140140        $post_id = self::factory()->post->create(
    141141            array(
     
    161161    }
    162162
    163     function test_oembed_output_private_post() {
     163    public function test_oembed_output_private_post() {
    164164        $post_id = self::factory()->post->create(
    165165            array(
     
    184184    }
    185185
    186     function test_oembed_output_private_post_with_permissions() {
     186    public function test_oembed_output_private_post_with_permissions() {
    187187        $user_id = self::factory()->user->create( array( 'role' => 'editor' ) );
    188188        wp_set_current_user( $user_id );
     
    212212    }
    213213
    214     function test_wp_embed_excerpt_more_no_embed() {
     214    public function test_wp_embed_excerpt_more_no_embed() {
    215215        $GLOBALS['wp_query'] = new WP_Query();
    216216
     
    218218    }
    219219
    220     function test_wp_embed_excerpt_more() {
     220    public function test_wp_embed_excerpt_more() {
    221221        $post_id = self::factory()->post->create(
    222222            array(
     
    240240    }
    241241
    242     function test_is_embed_post() {
     242    public function test_is_embed_post() {
    243243        $this->assertFalse( is_embed() );
    244244
     
    248248    }
    249249
    250     function test_is_embed_attachment() {
     250    public function test_is_embed_attachment() {
    251251        $post_id       = self::factory()->post->create();
    252252        $file          = DIR_TESTDATA . '/images/canola.jpg';
     
    262262    }
    263263
    264     function test_is_embed_404() {
     264    public function test_is_embed_404() {
    265265        $this->go_to( home_url( '/?p=12345&embed=true' ) );
    266266        $this->assertTrue( is_embed() );
    267267    }
    268268
    269     function test_get_post_embed_html_non_existent_post() {
     269    public function test_get_post_embed_html_non_existent_post() {
    270270        $this->assertFalse( get_post_embed_html( 200, 200, 0 ) );
    271271        $this->assertFalse( get_post_embed_html( 200, 200 ) );
    272272    }
    273273
    274     function test_get_post_embed_html() {
     274    public function test_get_post_embed_html() {
    275275        $post_id = self::factory()->post->create();
    276276        $title   = esc_attr(
     
    287287    }
    288288
    289     function test_add_host_js() {
     289    public function test_add_host_js() {
    290290        wp_oembed_add_host_js();
    291291
     
    300300     * @ticket 34698
    301301     */
    302     function test_js_no_ampersands() {
     302    public function test_js_no_ampersands() {
    303303        $this->assertStringNotContainsString( '&', file_get_contents( ABSPATH . WPINC . '/js/wp-embed.js' ) );
    304304    }
Note: See TracChangeset for help on using the changeset viewer.