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/filterResult.php

    r51397 r52010  
    55 */
    66class Tests_Filter_oEmbed_Result extends WP_UnitTestCase {
    7     function test_filter_oembed_result_trusted_malicious_iframe() {
     7    public function test_filter_oembed_result_trusted_malicious_iframe() {
    88        $html = '<p></p><iframe onload="alert(1)"></iframe>';
    99
     
    1313    }
    1414
    15     function test_filter_oembed_result_with_untrusted_provider() {
     15    public function test_filter_oembed_result_with_untrusted_provider() {
    1616        $html   = '<p></p><iframe onload="alert(1)" src="http://example.com/sample-page/"></iframe>';
    1717        $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), 'http://example.com/sample-page/' );
     
    2525    }
    2626
    27     function test_filter_oembed_result_only_one_iframe_is_allowed() {
     27    public function test_filter_oembed_result_only_one_iframe_is_allowed() {
    2828        $html   = '<div><iframe></iframe><iframe></iframe><p></p></div>';
    2929        $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
     
    3232    }
    3333
    34     function test_filter_oembed_result_with_newlines() {
     34    public function test_filter_oembed_result_with_newlines() {
    3535        $html = <<<EOD
    3636<script>var = 1;</script>
     
    4545    }
    4646
    47     function test_filter_oembed_result_without_iframe() {
     47    public function test_filter_oembed_result_without_iframe() {
    4848        $html   = '<span>Hello</span><p>World</p>';
    4949        $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
     
    5757    }
    5858
    59     function test_filter_oembed_result_secret_param_available() {
     59    public function test_filter_oembed_result_secret_param_available() {
    6060        $html   = '<iframe src="https://wordpress.org"></iframe>';
    6161        $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
     
    6969    }
    7070
    71     function test_filter_oembed_result_wrong_type_provided() {
     71    public function test_filter_oembed_result_wrong_type_provided() {
    7272        $actual = wp_filter_oembed_result( 'some string', (object) array( 'type' => 'link' ), '' );
    7373
     
    7575    }
    7676
    77     function test_filter_oembed_result_invalid_result() {
     77    public function test_filter_oembed_result_invalid_result() {
    7878        $this->assertFalse( wp_filter_oembed_result( false, (object) array( 'type' => 'rich' ), '' ) );
    7979        $this->assertFalse( wp_filter_oembed_result( '', (object) array( 'type' => 'rich' ), '' ) );
    8080    }
    8181
    82     function test_filter_oembed_result_blockquote_adds_style_to_iframe() {
     82    public function test_filter_oembed_result_blockquote_adds_style_to_iframe() {
    8383        $html   = '<blockquote></blockquote><iframe></iframe>';
    8484        $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
     
    8787    }
    8888
    89     function test_filter_oembed_result_allowed_html() {
     89    public function test_filter_oembed_result_allowed_html() {
    9090        $html   = '<blockquote class="foo" id="bar"><strong><a href="" target=""></a></strong></blockquote><iframe></iframe>';
    9191        $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
     
    131131     * @group feed
    132132     */
    133     function test_filter_feed_content() {
     133    public function test_filter_feed_content() {
    134134        $html   = '<blockquote></blockquote><iframe></iframe>';
    135135        $actual = _oembed_filter_feed_content( wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' ) );
Note: See TracChangeset for help on using the changeset viewer.