Make WordPress Core


Ignore:
Timestamp:
10/29/2019 02:26:41 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Ignore EOL differences in tests using multiline string assertions.

Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (<<<) or multiline strings as the expected result.

Fixes #31432. See #42594, #47411.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/listPages.php

    r46586 r46612  
    135135</ul></li>';
    136136
    137                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     137                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    138138        }
    139139
     
    149149</ul></li>';
    150150
    151                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     151                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    152152        }
    153153
     
    165165</ul></li>';
    166166
    167                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     167                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    168168        }
    169169
     
    199199</ul></li>';
    200200
    201                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     201                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    202202        }
    203203
     
    213213</ul></li>';
    214214
    215                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     215                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    216216        }
    217217
     
    241241</ul></li>';
    242242
    243                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     243                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    244244        }
    245245
     
    256256</ul></li>';
    257257
    258                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     258                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    259259        }
    260260
     
    269269<li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li>
    270270</ul></li>';
     271                $expected = str_replace( "\r\n", "\n", $expected );
    271272                $this->expectOutputString( $expected );
    272273                wp_list_pages( $args );
     
    282283</ul></li>';
    283284
    284                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     285                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    285286        }
    286287
     
    294295</ul></li>';
    295296
    296                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     297                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    297298        }
    298299
     
    327328</ul></li>';
    328329
    329                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     330                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    330331        }
    331332
     
    359360</ul></li>';
    360361
    361                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     362                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    362363        }
    363364
     
    391392</ul></li>';
    392393
    393                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     394                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    394395        }
    395396
     
    405406</ul></li>';
    406407
    407                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     408                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    408409        }
    409410
     
    423424</ul></li>';
    424425
    425                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     426                $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
    426427        }
    427428
     
    434435                $expected = '<li class="pagenav">Pages<ul><li class="page_item page-item-' . self::$parent_1 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_1 ) . '">Parent 1</a><ul class=\'children\'><li class="page_item page-item-' . self::$children[ self::$parent_1 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][0] ) . '">Child 1</a></li><li class="page_item page-item-' . self::$children[ self::$parent_1 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][1] ) . '">Child 2</a></li><li class="page_item page-item-' . self::$children[ self::$parent_1 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_1 ][2] ) . '">Child 3</a></li></ul></li><li class="page_item page-item-' . self::$parent_2 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_2 ) . '">Parent 2</a><ul class=\'children\'><li class="page_item page-item-' . self::$children[ self::$parent_2 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][0] ) . '">Child 1</a></li><li class="page_item page-item-' . self::$children[ self::$parent_2 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][1] ) . '">Child 2</a></li><li class="page_item page-item-' . self::$children[ self::$parent_2 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_2 ][2] ) . '">Child 3</a></li></ul></li><li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a><ul class=\'children\'><li class="page_item page-item-' . self::$children[ self::$parent_3 ][0] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][0] ) . '">Child 1</a></li><li class="page_item page-item-' . self::$children[ self::$parent_3 ][1] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][1] ) . '">Child 2</a></li><li class="page_item page-item-' . self::$children[ self::$parent_3 ][2] . '"><a href="' . get_permalink( self::$children[ self::$parent_3 ][2] ) . '">Child 3</a></li></ul></li></ul></li>';
    435436
    436                 $this->AssertEquals( $expected, wp_list_pages( $args ) );
     437                $this->assertEquals( $expected, wp_list_pages( $args ) );
    437438        }
    438439}
Note: See TracChangeset for help on using the changeset viewer.