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/comment/slashes.php

    r46586 r47122  
    99    function setUp() {
    1010        parent::setUp();
    11         // we need an admin user to bypass comment flood protection
     11        // We need an admin user to bypass comment flood protection.
    1212        $this->author_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
    1313        wp_set_current_user( $this->author_id );
    1414
    15         // it is important to test with both even and odd numbered slashes as
    16         // kses does a strip-then-add slashes in some of its function calls
     15        // It is important to test with both even and odd numbered slashes,
     16        // as KSES does a strip-then-add slashes in some of its function calls.
    1717        $this->slash_1 = 'String with 1 slash \\';
    1818        $this->slash_2 = 'String with 2 slashes \\\\';
     
    2525
    2626    /**
    27      * Tests the extended model function that expects slashed data
     27     * Tests the extended model function that expects slashed data.
    2828     */
    2929    function test_wp_new_comment() {
    3030        $post_id = self::factory()->post->create();
    3131
    32         // not testing comment_author_email or comment_author_url
    33         // as slashes are not permitted in that data
     32        // Not testing comment_author_email or comment_author_url
     33        // as slashes are not permitted in that data.
    3434        $data = array(
    3535            'comment_post_ID'      => $post_id,
     
    6464
    6565    /**
    66      * Tests the controller function that expects slashed data
     66     * Tests the controller function that expects slashed data.
    6767     */
    6868    function test_edit_comment() {
     
    7474        );
    7575
    76         // not testing comment_author_email or comment_author_url
    77         // as slashes are not permitted in that data
     76        // Not testing comment_author_email or comment_author_url
     77        // as slashes are not permitted in that data.
    7878        $_POST                            = array();
    7979        $_POST['comment_ID']              = $comment_id;
     
    8383        $_POST['newcomment_author_email'] = '';
    8484        $_POST['content']                 = $this->slash_7;
    85         $_POST                            = add_magic_quotes( $_POST );
     85
     86        $_POST = add_magic_quotes( $_POST ); // The edit_comment() function will strip slashes.
    8687
    8788        edit_comment();
     
    9899        $_POST['newcomment_author_email'] = '';
    99100        $_POST['content']                 = $this->slash_4;
    100         $_POST                            = add_magic_quotes( $_POST );
     101
     102        $_POST = add_magic_quotes( $_POST ); // The edit_comment() function will strip slashes.
    101103
    102104        edit_comment();
     
    108110
    109111    /**
    110      * Tests the model function that expects slashed data
     112     * Tests the model function that expects slashed data.
    111113     */
    112114    function test_wp_insert_comment() {
     
    139141
    140142    /**
    141      * Tests the model function that expects slashed data
     143     * Tests the model function that expects slashed data.
    142144     */
    143145    function test_wp_update_comment() {
Note: See TracChangeset for help on using the changeset viewer.