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

    r51968 r52010  
    66class Tests_XMLRPC_wp_editPost extends WP_XMLRPC_UnitTestCase {
    77
    8     function test_invalid_username_password() {
     8    public function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'username', 'password', 0, array() ) );
    1010        $this->assertIXRError( $result );
     
    1212    }
    1313
    14     function test_edit_own_post() {
     14    public function test_edit_own_post() {
    1515        $contributor_id = $this->make_user_by_role( 'contributor' );
    1616
     
    3131    }
    3232
    33     function test_capable_edit_others_post() {
     33    public function test_capable_edit_others_post() {
    3434        $contributor_id = $this->make_user_by_role( 'contributor' );
    3535        $this->make_user_by_role( 'editor' );
     
    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
     
    196196    }
    197197
    198     function test_edit_custom_fields() {
     198    public function test_edit_custom_fields() {
    199199        $contributor_id = $this->make_user_by_role( 'contributor' );
    200200
     
    240240    }
    241241
    242     function test_capable_unsticky() {
     242    public function test_capable_unsticky() {
    243243        $editor_id = $this->make_user_by_role( 'editor' );
    244244
     
    252252    }
    253253
    254     function test_password_transition_unsticky() {
     254    public function test_password_transition_unsticky() {
    255255        // When transitioning to private status or adding a post password, post should be un-stuck.
    256256        $editor_id = $this->make_user_by_role( 'editor' );
     
    267267    }
    268268
    269     function test_if_not_modified_since() {
     269    public function test_if_not_modified_since() {
    270270        $editor_id = $this->make_user_by_role( 'editor' );
    271271
     
    306306    }
    307307
    308     function test_edit_attachment() {
     308    public function test_edit_attachment() {
    309309        $editor_id = $this->make_user_by_role( 'editor' );
    310310
     
    327327    }
    328328
    329     function test_use_invalid_post_status() {
     329    public function test_use_invalid_post_status() {
    330330        $editor_id = $this->make_user_by_role( 'editor' );
    331331
     
    349349     * @ticket 22220
    350350     */
    351     function test_loss_of_categories_on_edit() {
     351    public function test_loss_of_categories_on_edit() {
    352352        $editor_id = $this->make_user_by_role( 'editor' );
    353353
     
    380380     * @ticket 26686
    381381     */
    382     function test_clear_categories_on_edit() {
     382    public function test_clear_categories_on_edit() {
    383383        $editor_id = $this->make_user_by_role( 'editor' );
    384384
     
    407407     * @ticket 23219
    408408     */
    409     function test_add_enclosure_if_new() {
     409    public function test_add_enclosure_if_new() {
    410410        // Sample enclosure data.
    411411        $enclosure = array(
     
    468468     * @ticket 35874
    469469     */
    470     function test_draft_not_prematurely_published() {
    471         if ( PHP_VERSION_ID >= 80100 ) {
    472             /*
    473              * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in
    474              * via hooked in filter functions until a more structural solution to the
    475              * "missing input validation" conundrum has been architected and implemented.
    476              */
    477             $this->expectDeprecation();
    478             $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' );
    479         }
    480 
     470    public function test_draft_not_prematurely_published() {
    481471        $editor_id = $this->make_user_by_role( 'editor' );
    482472
     
    514504     * @ticket 45322
    515505     */
    516     function test_draft_not_assigned_published_date() {
    517         if ( PHP_VERSION_ID >= 80100 ) {
    518             /*
    519              * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in
    520              * via hooked in filter functions until a more structural solution to the
    521              * "missing input validation" conundrum has been architected and implemented.
    522              */
    523             $this->expectDeprecation();
    524             $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' );
    525         }
    526 
     506    public function test_draft_not_assigned_published_date() {
    527507        $editor_id = $this->make_user_by_role( 'editor' );
    528508
Note: See TracChangeset for help on using the changeset viewer.