Make WordPress Core


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

    r46612 r47122  
    55 */
    66class Tests_Formatting_Autop extends WP_UnitTestCase {
    7     //From ticket https://core.trac.wordpress.org/ticket/11008
     7
     8    /**
     9     * @ticket 11008
     10     */
    811    function test_first_post() {
    912        $expected  = '<p>Welcome to WordPress!  This post contains important information.  After you read it, you can make it private to hide it from visitors but still have the information handy for future reference.</p>
     
    5760';
    5861
    59         // On windows environments, the EOL-style is \r\n
     62        // On Windows environments, the EOL-style is \r\n.
    6063        $expected = str_replace( "\r\n", "\n", $expected );
    6164
     
    7376        $code = htmlentities( $code );
    7477
    75         // Not wrapped in <p> tags
     78        // Not wrapped in <p> tags.
    7679        $str = "<pre>$code</pre>";
    7780        $this->assertEquals( $str, trim( wpautop( $str ) ) );
    7881
    79         // Text before/after is wrapped in <p> tags
     82        // Text before/after is wrapped in <p> tags.
    8083        $str = "Look at this code\n\n<pre>$code</pre>\n\nIsn't that cool?";
    8184
    82         // Expected text after wpautop
     85        // Expected text after wpautop().
    8386        $expected = '<p>Look at this code</p>' . "\n<pre>" . $code . "</pre>\n" . '<p>Isn\'t that cool?</p>';
    8487        $this->assertEquals( $expected, trim( wpautop( $str ) ) );
    8588
    86         // Make sure HTML breaks are maintained if manually inserted
     89        // Make sure HTML breaks are maintained if manually inserted.
    8790        $str      = "Look at this code\n\n<pre>Line1<br />Line2<br>Line3<br/>Line4\nActual Line 2\nActual Line 3</pre>\n\nCool, huh?";
    8891        $expected = "<p>Look at this code</p>\n<pre>Line1<br />Line2<br>Line3<br/>Line4\nActual Line 2\nActual Line 3</pre>\n<p>Cool, huh?</p>";
     
    143146            "\n\nParagraph two.";
    144147
    145         $expected = "<p>Paragraph one.</p>\n" . // line breaks only after <p>
     148        $expected = "<p>Paragraph one.</p>\n" . // Line breaks only after <p>.
    146149            '<p><video class="wp-video-shortcode" id="video-0-1" width="640" height="360" preload="metadata" controls="controls">' .
    147150            '<source type="video/mp4" src="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4" />' .
     
    158161            '<p>Paragraph two.</p>';
    159162
    160         // When running the content through wpautop() from wp_richedit_pre()
     163        // When running the content through wpautop() from wp_richedit_pre().
    161164        $shortcode_content = "Paragraph one.\n\n" .
    162165            '[video width="720" height="480" mp4="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4"]
     
    172175            "\n\nParagraph two.";
    173176
    174         $shortcode_expected = "<p>Paragraph one.</p>\n" . // line breaks only after <p>
     177        $shortcode_expected = "<p>Paragraph one.</p>\n" . // Line breaks only after <p>.
    175178            '<p>[video width="720" height="480" mp4="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4"]' .
    176179            '<!-- WebM/VP8 for Firefox4, Opera, and Chrome --><source type="video/webm" src="myvideo.webm" />' .
     
    207210Paragraph two.';
    208211
    209         $expected1 = "<p>Paragraph one.</p>\n" . // line breaks only after <p>
     212        $expected1 = "<p>Paragraph one.</p>\n" . // Line breaks only after <p>.
    210213            '<p><object width="400" height="224" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">' .
    211214            '<param name="src" value="http://domain.tld/wp-content/uploads/2013/12/xyz.swf" />' .
     
    243246Paragraph two.';
    244247
    245         $expected2 = "<p>Paragraph one.</p>\n" . // line breaks only after block tags
     248        $expected2 = "<p>Paragraph one.</p>\n" . // Line breaks only after block tags.
    246249            '<div class="video-player" id="x-video-0">' . "\n" .
    247250            '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="640" height="360" id="video-0" standby="Standby text">' .
     
    336339
    337340        $expected = join( "\n", $content );
    338         $input    = join( "\n\n", $content ); // WS difference
     341        $input    = join( "\n\n", $content ); // Whitespace difference.
    339342
    340343        $this->assertEquals( $expected, trim( wpautop( $input ) ) );
    341344
    342         $input = join( '', $content ); // WS difference
     345        $input = join( '', $content ); // Whitespace difference.
    343346
    344347        $this->assertEquals( $expected, trim( wpautop( $input ) ) );
Note: See TracChangeset for help on using the changeset viewer.