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/xmlrpc/mw/editPost.php

    r51968 r52010  
    66class Tests_XMLRPC_mw_editPost extends WP_XMLRPC_UnitTestCase {
    77
    8     function test_invalid_username_password() {
     8    public function test_invalid_username_password() {
    99        $post   = array();
    1010        $result = $this->myxmlrpcserver->mw_editPost( array( 1, 'username', 'password', $post ) );
     
    1313    }
    1414
    15     function test_edit_own_post() {
     15    public function test_edit_own_post() {
    1616        $contributor_id = $this->make_user_by_role( 'contributor' );
    1717        $post           = array(
     
    3131    }
    3232
    33     function test_capable_edit_others_post() {
     33    public function test_capable_edit_others_post() {
    3434        $this->make_user_by_role( 'editor' );
    3535        $contributor_id = $this->make_user_by_role( 'contributor' );
     
    5151    }
    5252
    53     function test_incapable_edit_others_post() {
     53    public function test_incapable_edit_others_post() {
    5454        $this->make_user_by_role( 'contributor' );
    5555        $author_id = $this->make_user_by_role( 'author' );
     
    7272    }
    7373
    74     function test_capable_reassign_author() {
     74    public function test_capable_reassign_author() {
    7575        $contributor_id = $this->make_user_by_role( 'contributor' );
    7676        $author_id      = $this->make_user_by_role( 'author' );
     
    9292    }
    9393
    94     function test_incapable_reassign_author() {
     94    public function test_incapable_reassign_author() {
    9595        $contributor_id = $this->make_user_by_role( 'contributor' );
    9696        $author_id      = $this->make_user_by_role( 'author' );
     
    114114     * @ticket 24916
    115115     */
    116     function test_capable_reassign_author_to_self() {
     116    public function test_capable_reassign_author_to_self() {
    117117        $contributor_id = $this->make_user_by_role( 'contributor' );
    118118        $editor_id      = $this->make_user_by_role( 'editor' );
     
    136136     * @requires function imagejpeg
    137137     */
    138     function test_post_thumbnail() {
     138    public function test_post_thumbnail() {
    139139        add_theme_support( 'post-thumbnails' );
    140140
     
    183183    }
    184184
    185     function test_edit_basic_post_info() {
     185    public function test_edit_basic_post_info() {
    186186        $contributor_id = $this->make_user_by_role( 'contributor' );
    187187
     
    234234     * @ticket 20662
    235235     */
    236     function test_make_post_sticky() {
     236    public function test_make_post_sticky() {
    237237        $author_id = $this->make_user_by_role( 'editor' );
    238238
     
    251251
    252252    // Not allowed since [19914].
    253     function test_change_post_type() {
     253    public function test_change_post_type() {
    254254        $contributor_id = $this->make_user_by_role( 'contributor' );
    255255
     
    269269     * @ticket 16980
    270270     */
    271     function test_empty_not_null() {
     271    public function test_empty_not_null() {
    272272        $editor_id = $this->make_user_by_role( 'editor' );
    273273
     
    301301     * @ticket 35874
    302302     */
    303     function test_draft_not_prematurely_published() {
    304         if ( PHP_VERSION_ID >= 80100 ) {
    305             /*
    306              * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in
    307              * via hooked in filter functions until a more structural solution to the
    308              * "missing input validation" conundrum has been architected and implemented.
    309              */
    310             $this->expectDeprecation();
    311             $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' );
    312         }
    313 
     303    public function test_draft_not_prematurely_published() {
    314304        $editor_id = $this->make_user_by_role( 'editor' );
    315305
Note: See TracChangeset for help on using the changeset viewer.