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/dependencies/scripts.php

    r51968 r52010  
    1515    protected $wp_scripts_print_translations_output;
    1616
    17     function set_up() {
     17    public function set_up() {
    1818        parent::set_up();
    1919        $this->old_wp_scripts = isset( $GLOBALS['wp_scripts'] ) ? $GLOBALS['wp_scripts'] : null;
     
    3535    }
    3636
    37     function tear_down() {
     37    public function tear_down() {
    3838        $GLOBALS['wp_scripts'] = $this->old_wp_scripts;
    3939        add_action( 'wp_default_scripts', 'wp_default_scripts' );
     
    4646     * @ticket 11315
    4747     */
    48     function test_wp_enqueue_script() {
     48    public function test_wp_enqueue_script() {
    4949        wp_enqueue_script( 'no-deps-no-version', 'example.com', array() );
    5050        wp_enqueue_script( 'empty-deps-no-version', 'example.com' );
     
    6767     * @ticket 42804
    6868     */
    69     function test_wp_enqueue_script_with_html5_support_does_not_contain_type_attribute() {
     69    public function test_wp_enqueue_script_with_html5_support_does_not_contain_type_attribute() {
    7070        add_theme_support( 'html5', array( 'script' ) );
    7171
     
    153153     * @ticket 16024
    154154     */
    155     function test_wp_script_add_data_with_data_key() {
     155    public function test_wp_script_add_data_with_data_key() {
    156156        // Enqueue and add data.
    157157        wp_enqueue_script( 'test-only-data', 'example.com', array(), null );
     
    172172     * @ticket 16024
    173173     */
    174     function test_wp_script_add_data_with_conditional_key() {
     174    public function test_wp_script_add_data_with_conditional_key() {
    175175        // Enqueue and add conditional comments.
    176176        wp_enqueue_script( 'test-only-conditional', 'example.com', array(), null );
     
    190190     * @ticket 16024
    191191     */
    192     function test_wp_script_add_data_with_data_and_conditional_keys() {
     192    public function test_wp_script_add_data_with_data_and_conditional_keys() {
    193193        // Enqueue and add data plus conditional comments for both.
    194194        wp_enqueue_script( 'test-conditional-with-data', 'example.com', array(), null );
     
    210210     * @ticket 16024
    211211     */
    212     function test_wp_script_add_data_with_invalid_key() {
     212    public function test_wp_script_add_data_with_invalid_key() {
    213213        // Enqueue and add an invalid key.
    214214        wp_enqueue_script( 'test-invalid', 'example.com', array(), null );
     
    228228     * @ticket 31126
    229229     */
    230     function test_wp_register_script() {
     230    public function test_wp_register_script() {
    231231        $this->assertTrue( wp_register_script( 'duplicate-handler', 'http://example.com' ) );
    232232        $this->assertFalse( wp_register_script( 'duplicate-handler', 'http://example.com' ) );
     
    236236     * @ticket 35229
    237237     */
    238     function test_wp_register_script_with_handle_without_source() {
     238    public function test_wp_register_script_with_handle_without_source() {
    239239        $expected  = "<script type='text/javascript' src='http://example.com?ver=1' id='handle-one-js'></script>\n";
    240240        $expected .= "<script type='text/javascript' src='http://example.com?ver=2' id='handle-two-js'></script>\n";
     
    252252     * @ticket 35643
    253253     */
    254     function test_wp_enqueue_script_footer_alias() {
     254    public function test_wp_enqueue_script_footer_alias() {
    255255        wp_register_script( 'foo', false, array( 'bar', 'baz' ), '1.0', true );
    256256        wp_register_script( 'bar', home_url( 'bar.js' ), array(), '1.0', true );
     
    320320     * @ticket 35873
    321321     */
    322     function test_wp_register_script_with_dependencies_in_head_and_footer() {
     322    public function test_wp_register_script_with_dependencies_in_head_and_footer() {
    323323        wp_register_script( 'parent', '/parent.js', array( 'child-head' ), null, true );            // In footer.
    324324        wp_register_script( 'child-head', '/child-head.js', array( 'child-footer' ), null, false ); // In head.
     
    341341     * @ticket 35956
    342342     */
    343     function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order() {
     343    public function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order() {
    344344        wp_register_script( 'child-head', '/child-head.js', array(), null, false );                      // In head.
    345345        wp_register_script( 'child-footer', '/child-footer.js', array(), null, true );                   // In footer.
     
    362362     * @ticket 35956
    363363     */
    364     function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order_and_two_parent_scripts() {
     364    public function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order_and_two_parent_scripts() {
    365365        wp_register_script( 'grandchild-head', '/grandchild-head.js', array(), null, false );             // In head.
    366366        wp_register_script( 'child-head', '/child-head.js', array(), null, false );                       // In head.
     
    393393     * @ticket 14853
    394394     */
    395     function test_wp_add_inline_script_returns_bool() {
     395    public function test_wp_add_inline_script_returns_bool() {
    396396        $this->assertFalse( wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ) );
    397397        wp_enqueue_script( 'test-example', 'example.com', array(), null );
     
    402402     * @ticket 14853
    403403     */
    404     function test_wp_add_inline_script_unknown_handle() {
     404    public function test_wp_add_inline_script_unknown_handle() {
    405405        $this->assertFalse( wp_add_inline_script( 'test-invalid', 'console.log("before");', 'before' ) );
    406406        $this->assertSame( '', get_echo( 'wp_print_scripts' ) );
     
    410410     * @ticket 14853
    411411     */
    412     function test_wp_add_inline_script_before() {
     412    public function test_wp_add_inline_script_before() {
    413413        wp_enqueue_script( 'test-example', 'example.com', array(), null );
    414414        wp_add_inline_script( 'test-example', 'console.log("before");', 'before' );
     
    423423     * @ticket 14853
    424424     */
    425     function test_wp_add_inline_script_after() {
     425    public function test_wp_add_inline_script_after() {
    426426        wp_enqueue_script( 'test-example', 'example.com', array(), null );
    427427        wp_add_inline_script( 'test-example', 'console.log("after");' );
     
    436436     * @ticket 14853
    437437     */
    438     function test_wp_add_inline_script_before_and_after() {
     438    public function test_wp_add_inline_script_before_and_after() {
    439439        wp_enqueue_script( 'test-example', 'example.com', array(), null );
    440440        wp_add_inline_script( 'test-example', 'console.log("before");', 'before' );
     
    451451     * @ticket 44551
    452452     */
    453     function test_wp_add_inline_script_before_for_handle_without_source() {
     453    public function test_wp_add_inline_script_before_for_handle_without_source() {
    454454        wp_register_script( 'test-example', '' );
    455455        wp_enqueue_script( 'test-example' );
     
    464464     * @ticket 44551
    465465     */
    466     function test_wp_add_inline_script_after_for_handle_without_source() {
     466    public function test_wp_add_inline_script_after_for_handle_without_source() {
    467467        wp_register_script( 'test-example', '' );
    468468        wp_enqueue_script( 'test-example' );
     
    477477     * @ticket 44551
    478478     */
    479     function test_wp_add_inline_script_before_and_after_for_handle_without_source() {
     479    public function test_wp_add_inline_script_before_and_after_for_handle_without_source() {
    480480        wp_register_script( 'test-example', '' );
    481481        wp_enqueue_script( 'test-example' );
     
    492492     * @ticket 14853
    493493     */
    494     function test_wp_add_inline_script_multiple() {
     494    public function test_wp_add_inline_script_multiple() {
    495495        wp_enqueue_script( 'test-example', 'example.com', array(), null );
    496496        wp_add_inline_script( 'test-example', 'console.log("before");', 'before' );
     
    509509     * @ticket 14853
    510510     */
    511     function test_wp_add_inline_script_localized_data_is_added_first() {
     511    public function test_wp_add_inline_script_localized_data_is_added_first() {
    512512        wp_enqueue_script( 'test-example', 'example.com', array(), null );
    513513        wp_localize_script( 'test-example', 'testExample', array( 'foo' => 'bar' ) );
Note: See TracChangeset for help on using the changeset viewer.