Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 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/ajax/Autosave.php

    r46586 r47122  
    22
    33/**
    4  * Admin ajax functions to be tested
     4 * Admin Ajax functions to be tested.
    55 */
    66require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
    77
    88/**
    9  * Testing ajax save draft functionality
     9 * Testing Ajax save draft functionality.
    1010 *
    1111 * @package    WordPress
    … …  
    4444        public function setUp() {
    4545                parent::setUp();
    46                 // Set a user so the $post has 'post_author'
     46                // Set a user so the $post has 'post_author'.
    4747                wp_set_current_user( self::$admin_id );
    4848        }
    … …  
    5454         */
    5555        public function test_autosave_post() {
    56                 // The original post_author
     56                // The original post_author.
    5757                wp_set_current_user( self::$admin_id );
    5858
    59                 // Set up the $_POST request
     59                // Set up the $_POST request.
    6060                $md5   = md5( uniqid() );
    6161                $_POST = array(
    … …  
    7272                );
    7373
    74                 // Make the request
     74                // Make the request.
    7575                try {
    7676                        $this->_handleAjax( 'heartbeat' );
    … …  
    7979                }
    8080
    81                 // Get the response, it is in heartbeat's response
     81                // Get the response, it is in heartbeat's response.
    8282                $response = json_decode( $this->_last_response, true );
    8383
    84                 // Ensure everything is correct
     84                // Ensure everything is correct.
    8585                $this->assertNotEmpty( $response['wp_autosave'] );
    8686                $this->assertTrue( $response['wp_autosave']['success'] );
    8787
    88                 // Check that the edit happened
     88                // Check that the edit happened.
    8989                $post = get_post( self::$post_id );
    9090                $this->assertGreaterThanOrEqual( 0, strpos( self::$post->post_content, $md5 ) );
    … …  
    9797         */
    9898        public function test_autosave_locked_post() {
    99                 // Lock the post to another user
     99                // Lock the post to another user.
    100100                wp_set_current_user( self::$editor_id );
    101101                wp_set_post_lock( self::$post_id );
    … …  
    103103                wp_set_current_user( self::$admin_id );
    104104
    105                 // Ensure post is locked
     105                // Ensure post is locked.
    106106                $this->assertEquals( self::$editor_id, wp_check_post_lock( self::$post_id ) );
    107107
    108                 // Set up the $_POST request
     108                // Set up the $_POST request.
    109109                $md5   = md5( uniqid() );
    110110                $_POST = array(
    … …  
    121121                );
    122122
    123                 // Make the request
     123                // Make the request.
    124124                try {
    125125                        $this->_handleAjax( 'heartbeat' );
    … …  
    130130                $response = json_decode( $this->_last_response, true );
    131131
    132                 // Ensure everything is correct
     132                // Ensure everything is correct.
    133133                $this->assertNotEmpty( $response['wp_autosave'] );
    134134                $this->assertTrue( $response['wp_autosave']['success'] );
    135135
    136                 // Check that the original post was NOT edited
     136                // Check that the original post was NOT edited.
    137137                $post = get_post( self::$post_id );
    138138                $this->assertFalse( strpos( $post->post_content, $md5 ) );
    139139
    140                 // Check if the autosave post was created
     140                // Check if the autosave post was created.
    141141                $autosave = wp_get_post_autosave( self::$post_id, get_current_user_id() );
    142142                $this->assertNotEmpty( $autosave );
    … …  
    153153                wp_set_current_user( self::$admin_id );
    154154
    155                 // Set up the $_POST request
     155                // Set up the $_POST request.
    156156                $_POST = array(
    157157                        'action' => 'heartbeat',
    … …  
    165165                );
    166166
    167                 // Make the request
     167                // Make the request.
    168168                try {
    169169                        $this->_handleAjax( 'heartbeat' );
Note: See TracChangeset for help on using the changeset viewer.