Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/formatting/Autop.php

    r39914 r42343  
    77    //From ticket https://core.trac.wordpress.org/ticket/11008
    88    function test_first_post() {
    9         $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>
     9        $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>
    1010<p>First things first:</p>
    1111<ul>
     
    5858
    5959        // On windows environments, the EOL-style is \r\n
    60         $expected = str_replace( "\r\n", "\n", $expected);
    61 
    62         $this->assertEquals($expected, wpautop($test_data));
     60        $expected = str_replace( "\r\n", "\n", $expected );
     61
     62        $this->assertEquals( $expected, wpautop( $test_data ) );
    6363    }
    6464
     
    8585
    8686        // Make sure HTML breaks are maintained if manually inserted
    87         $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?";
     87        $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?";
    8888        $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>";
    8989        $this->assertEquals( $expected, trim( wpautop( $str ) ) );
     
    337337
    338338        $expected = join( "\n", $content );
    339         $input = join( "\n\n", $content ); // WS difference
     339        $input    = join( "\n\n", $content ); // WS difference
    340340
    341341        $this->assertEquals( $expected, trim( wpautop( $input ) ) );
    342342
    343         $input = join( "", $content ); // WS difference
     343        $input = join( '', $content ); // WS difference
    344344
    345345        $this->assertEquals( $expected, trim( wpautop( $input ) ) );
     
    353353
    354354        $expected = join( "\n", $content );
    355         $input = join( "", $content );
     355        $input    = join( '', $content );
    356356
    357357        $this->assertEquals( $expected, trim( wpautop( $input ) ) );
     
    365365
    366366        $expected = join( "\n", $content );
    367         $input = join( "", $content );
     367        $input    = join( '', $content );
    368368
    369369        $this->assertEquals( $expected, trim( wpautop( $input ) ) );
     
    376376     */
    377377    function test_that_wpautop_does_not_wrap_blockquotes_but_does_autop_their_contents() {
    378         $content  = "<blockquote>foo</blockquote>";
    379         $expected = "<blockquote><p>foo</p></blockquote>";
     378        $content  = '<blockquote>foo</blockquote>';
     379        $expected = '<blockquote><p>foo</p></blockquote>';
    380380
    381381        $this->assertEquals( $expected, trim( wpautop( $content ) ) );
     
    420420
    421421        foreach ( $inlines as $inline ) {
    422             $content[] = "<$inline>foo</$inline>";
     422            $content[]  = "<$inline>foo</$inline>";
    423423            $expected[] = "<p><$inline>foo</$inline></p>";
    424424        }
    425425
    426         $content = join( "\n\n", $content );
     426        $content  = join( "\n\n", $content );
    427427        $expected = join( "\n", $expected );
    428428
     
    458458                "<p>Hello <!-- <object>\n<param/>\n<param/>\n<embed>\n</embed>\n</object>\n --></p>\n",
    459459            ),
    460 /* Block elements inside comments will fail this test in all versions, it's not a regression.
    461             array(
    462                 "Hello <!-- <hr> a\nhref='world' -->",
    463                 "<p>Hello <!-- <hr> a\nhref='world' --></p>\n",
    464             ),
    465             array(
    466                 "Hello <![CDATA[ <hr> a\nhttps://youtu.be/jgz0uSaOZbE\n ]]>",
    467                 "<p>Hello <![CDATA[ <hr> a\nhttps://youtu.be/jgz0uSaOZbE\n ]]></p>\n",
    468             ),
    469 */
    470             array(
    471                 "Hello <![CDATA[ a\nhttps://youtu.be/jgz0uSaOZbE\n ]]>",
    472                 "<p>Hello <![CDATA[ a\nhttps://youtu.be/jgz0uSaOZbE\n ]]></p>\n",
    473             ),
     460            /* Block elements inside comments will fail this test in all versions, it's not a regression.
     461                array(
     462                    "Hello <!-- <hr> a\nhref='world' -->",
     463                    "<p>Hello <!-- <hr> a\nhref='world' --></p>\n",
     464                ),
     465                array(
     466                    "Hello <![CDATA[ <hr> a\nhttps://youtu.be/jgz0uSaOZbE\n ]]>",
     467                    "<p>Hello <![CDATA[ <hr> a\nhttps://youtu.be/jgz0uSaOZbE\n ]]></p>\n",
     468                ),
     469            */
     470                array(
     471                    "Hello <![CDATA[ a\nhttps://youtu.be/jgz0uSaOZbE\n ]]>",
     472                    "<p>Hello <![CDATA[ a\nhttps://youtu.be/jgz0uSaOZbE\n ]]></p>\n",
     473                ),
    474474            array(
    475475                "Hello <![CDATA[ <!-- a\nhttps://youtu.be/jgz0uSaOZbE\n a\n9 ]]> -->",
     
    530530     */
    531531    function test_that_text_before_blocks_is_peed() {
    532         $content = 'a<div>b</div>';
     532        $content  = 'a<div>b</div>';
    533533        $expected = "<p>a</p>\n<div>b</div>";
    534534
Note: See TracChangeset for help on using the changeset viewer.