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

    r51331 r52010  
    4848    }
    4949
    50     function test_valid_comment() {
     50    public function test_valid_comment() {
    5151        $result = $this->myxmlrpcserver->wp_newComment(
    5252            array(
     
    6464    }
    6565
    66     function test_empty_comment() {
     66    public function test_empty_comment() {
    6767        $result = $this->myxmlrpcserver->wp_newComment(
    6868            array(
     
    140140    }
    141141
    142     function test_new_comment_post_closed() {
     142    public function test_new_comment_post_closed() {
    143143        $post = self::factory()->post->create_and_get(
    144144            array(
     
    165165    }
    166166
    167     function test_new_comment_duplicated() {
     167    public function test_new_comment_duplicated() {
    168168        $comment_args = array(
    169169            1,
     
    192192     * @ticket 51595
    193193     */
    194     function test_allowed_anon_comments() {
     194    public function test_allowed_anon_comments() {
    195195        add_filter( 'xmlrpc_allow_anonymous_comments', '__return_true' );
    196196
     
    217217     * @ticket 51595
    218218     */
    219     function test_anon_comments_require_email() {
     219    public function test_anon_comments_require_email() {
    220220        add_filter( 'xmlrpc_allow_anonymous_comments', '__return_true' );
    221221
     
    242242     * @ticket 51595
    243243     */
    244     function test_username_avoids_anon_flow() {
     244    public function test_username_avoids_anon_flow() {
    245245        add_filter( 'xmlrpc_allow_anonymous_comments', '__return_true' );
    246246
     
    274274     * @param string $anon_callback Optional. Allow anonymous comment callback. Default __return_false.
    275275     */
    276     function test_comments_observe_post_permissions( $post_key, $username, $expected, $anon_callback = '__return_false' ) {
     276    public function test_comments_observe_post_permissions( $post_key, $username, $expected, $anon_callback = '__return_false' ) {
    277277        add_filter( 'xmlrpc_allow_anonymous_comments', $anon_callback );
    278278
     
    309309     * }
    310310     */
    311     function data_comments_observe_post_permissions() {
     311    public function data_comments_observe_post_permissions() {
    312312        return array(
    313313            // 0: Post author, password protected public post.
Note: See TracChangeset for help on using the changeset viewer.