Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php

    r47036 r47122  
    169169
    170170    public function test_context_param() {
    171         // Collection
     171        // Collection.
    172172        $request  = new WP_REST_Request( 'OPTIONS', '/wp/v2/comments' );
    173173        $response = rest_get_server()->dispatch( $request );
     
    175175        $this->assertEquals( 'view', $data['endpoints'][0]['args']['context']['default'] );
    176176        $this->assertEquals( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] );
    177         // Single
     177        // Single.
    178178        $request  = new WP_REST_Request( 'OPTIONS', '/wp/v2/comments/' . self::$approved_id );
    179179        $response = rest_get_server()->dispatch( $request );
     
    980980
    981981        $comment = get_comment( self::$approved_id );
    982         /**
    983          * Ignore the subdomain, since 'get_avatar_url randomly sets the Gravatar
    984          * server when building the url string.
    985          */
     982        // Ignore the subdomain, since get_avatar_url() randomly sets
     983        // the Gravatar server when building the URL string.
    986984        $this->assertEquals( substr( get_avatar_url( $comment->comment_author_email ), 9 ), substr( $data['author_avatar_urls'][96], 9 ) );
    987985    }
     
    15661564        $this->assertEquals( $user_id, $data['author'] );
    15671565
    1568         // Check author data matches
     1566        // Check author data matches.
    15691567        $author  = get_user_by( 'id', $user_id );
    15701568        $comment = get_comment( $data['id'] );
     
    20732071
    20742072    public function anonymous_comments_callback_null() {
    2075         // I'm a plugin developer who forgot to include a return value for some
    2076         // code path in my 'rest_allow_anonymous_comments' filter.
     2073        // I'm a plugin developer who forgot to include a return value
     2074        // for some code path in my 'rest_allow_anonymous_comments' filter.
    20772075    }
    20782076
     
    23332331        $request->set_param( 'post', $comment->comment_post_ID );
    23342332
    2335         // Run twice to make sure that the update still succeeds even if no DB
    2336         // rows are updated.
     2333        // Run twice to make sure that the update still succeeds
     2334        // even if no DB rows are updated.
    23372335        $response = rest_get_server()->dispatch( $request );
    23382336        $this->assertEquals( 200, $response->get_status() );
     
    27942792
    27952793    public function verify_comment_roundtrip( $input = array(), $expected_output = array() ) {
    2796         // Create the comment
     2794        // Create the comment.
    27972795        $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    27982796        $request->set_param( 'author_email', 'cbg@androidsdungeon.com' );
     
    28052803        $actual_output = $response->get_data();
    28062804
    2807         // Compare expected API output to actual API output
     2805        // Compare expected API output to actual API output.
    28082806        $this->assertInternalType( 'array', $actual_output['content'] );
    28092807        $this->assertArrayHasKey( 'raw', $actual_output['content'] );
     
    28132811        $this->assertEquals( $expected_output['author_user_agent'], $actual_output['author_user_agent'] );
    28142812
    2815         // Compare expected API output to WP internal values
     2813        // Compare expected API output to WP internal values.
    28162814        $comment = get_comment( $actual_output['id'] );
    28172815        $this->assertEquals( $expected_output['content']['raw'], $comment->comment_content );
     
    28192817        $this->assertEquals( $expected_output['author_user_agent'], $comment->comment_agent );
    28202818
    2821         // Update the comment
     2819        // Update the comment.
    28222820        $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', $actual_output['id'] ) );
    28232821        foreach ( $input as $name => $value ) {
    28242822            $request->set_param( $name, $value );
    28252823        }
    2826         // FIXME at least one value must change, or update fails
     2824        // FIXME At least one value must change, or update fails.
    28272825        // See https://core.trac.wordpress.org/ticket/38700
    28282826        $request->set_param( 'author_ip', '127.0.0.2' );
     
    28312829        $actual_output = $response->get_data();
    28322830
    2833         // Compare expected API output to actual API output
     2831        // Compare expected API output to actual API output.
    28342832        $this->assertEquals( $expected_output['content']['raw'], $actual_output['content']['raw'] );
    28352833        $this->assertEquals( $expected_output['content']['rendered'], trim( $actual_output['content']['rendered'] ) );
     
    28372835        $this->assertEquals( $expected_output['author_user_agent'], $actual_output['author_user_agent'] );
    28382836
    2839         // Compare expected API output to WP internal values
     2837        // Compare expected API output to WP internal values.
    28402838        $comment = get_comment( $actual_output['id'] );
    28412839        $this->assertEquals( $expected_output['content']['raw'], $comment->comment_content );
Note: See TracChangeset for help on using the changeset viewer.