Changeset 46612
- Timestamp:
- 10/29/2019 02:26:41 PM (5 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/abstract-testcase.php
r46586 r46612 634 634 public function assertDiscardWhitespace( $expected, $actual ) { 635 635 $this->assertEquals( preg_replace( '/\s*/', '', $expected ), preg_replace( '/\s*/', '', $actual ) ); 636 } 637 638 /** 639 * Asserts that two values are equal, with EOL differences discarded. 640 * 641 * @since 5.4.0 642 * 643 * @param string $expected The expected value. 644 * @param string $actual The actual value. 645 */ 646 public function assertEqualsIgnoreEOL( $expected, $actual ) { 647 $this->assertEquals( str_replace( "\r\n", "\n", $expected ), str_replace( "\r\n", "\n", $actual ) ); 636 648 } 637 649 -
trunk/tests/phpunit/tests/blocks/render.php
r46586 r46612 61 61 $actual_html = do_blocks( $original_html ); 62 62 63 $this->assertEquals ( $expected_html, $actual_html );63 $this->assertEqualsIgnoreEOL( $expected_html, $actual_html ); 64 64 } 65 65 -
trunk/tests/phpunit/tests/dependencies/scripts.php
r46586 r46612 847 847 $expected .= "<script type='text/javascript' src='/wp-includes/js/script.js'></script>\n"; 848 848 849 $this->assertEquals ( $expected, get_echo( 'wp_print_scripts' ) );849 $this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) ); 850 850 } 851 851 … … 872 872 $expected .= "<script type='text/javascript' src='/wp-content/plugins/my-plugin/js/script.js'></script>\n"; 873 873 874 $this->assertEquals ( $expected, get_echo( 'wp_print_scripts' ) );874 $this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) ); 875 875 } 876 876 … … 897 897 $expected .= "<script type='text/javascript' src='/wp-content/themes/my-theme/js/script.js'></script>\n"; 898 898 899 $this->assertEquals ( $expected, get_echo( 'wp_print_scripts' ) );899 $this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) ); 900 900 } 901 901 … … 922 922 $expected .= "<script type='text/javascript' src='/wp-admin/js/script.js'></script>\n"; 923 923 924 $this->assertEquals ( $expected, get_echo( 'wp_print_scripts' ) );924 $this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) ); 925 925 } 926 926 … … 962 962 $expected .= "<script type='text/javascript' src='/wp-admin/js/script.js'></script>\n"; 963 963 964 $this->assertEquals ( $expected, get_echo( 'wp_print_scripts' ) );964 $this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) ); 965 965 } 966 966 … … 989 989 $expected .= "<script type='text/javascript' src='/wp-includes/js/script.js'></script>\n"; 990 990 991 $this->assertEquals ( $expected, get_echo( 'wp_print_scripts' ) );991 $this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) ); 992 992 } 993 993 … … 1017 1017 $expected .= "<script type='text/javascript' src='/wp-includes/js/script2.js'></script>\n"; 1018 1018 1019 $this->assertEquals ( $expected, get_echo( 'wp_print_scripts' ) );1019 $this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_scripts' ) ); 1020 1020 } 1021 1021 -
trunk/tests/phpunit/tests/dependencies/styles.php
r46586 r46612 273 273 wp_add_inline_style( 'handle', 'a { color: blue; }' ); 274 274 275 $this->assertEquals ( $expected, get_echo( 'wp_print_styles' ) );275 $this->assertEqualsIgnoreEOL( $expected, get_echo( 'wp_print_styles' ) ); 276 276 } 277 277 -
trunk/tests/phpunit/tests/formatting/Autop.php
r46586 r46612 503 503 line 5</p>'; 504 504 505 $this->assertEquals ( $expected, trim( wpautop( $content ) ) );505 $this->assertEqualsIgnoreEOL( $expected, trim( wpautop( $content ) ) ); 506 506 } 507 507 … … 522 522 <p>line 2</p>'; 523 523 524 $this->assertEquals ( $expected, trim( wpautop( $content ) ) );524 $this->assertEqualsIgnoreEOL( $expected, trim( wpautop( $content ) ) ); 525 525 } 526 526 … … 544 544 * @ticket 39307 545 545 */ 546 function test_that_wpautop_do ses_not_add_extra_closing_p_in_figure() {546 function test_that_wpautop_does_not_add_extra_closing_p_in_figure() { 547 547 $content1 = '<figure><img src="example.jpg" /><figcaption>Caption</figcaption></figure>'; 548 548 $expected1 = $content1; … … 557 557 558 558 $this->assertEquals( $expected1, trim( wpautop( $content1 ) ) ); 559 $this->assertEquals ( $expected2, trim( wpautop( $content2 ) ) );559 $this->assertEqualsIgnoreEOL( $expected2, trim( wpautop( $content2 ) ) ); 560 560 } 561 561 … … 585 585 $expected = '<p>' . $content . '</p>'; 586 586 587 $this->assertEquals ( $expected, trim( wpautop( $content ) ) );587 $this->assertEqualsIgnoreEOL( $expected, trim( wpautop( $content ) ) ); 588 588 } 589 589 … … 601 601 $expected = '<p>' . $content . '</p>'; 602 602 603 $this->assertEquals ( $expected, trim( wpautop( $content ) ) );603 $this->assertEqualsIgnoreEOL( $expected, trim( wpautop( $content ) ) ); 604 604 } 605 605 } -
trunk/tests/phpunit/tests/formatting/EscUrl.php
r46586 r46612 210 210 I thought you might want to sign up for this newsletter 211 211 EOT; 212 $body = str_replace( "\r\n", "\n", $body ); 212 213 $email_link = 'mailto:?body=' . rawurlencode( $body ); 213 214 $email_link = esc_url( $email_link ); … … 224 225 I thought you might want to sign up for this newsletter 225 226 EOT; 227 $body = str_replace( "\r\n", "\n", $body ); 226 228 $email_link = 'http://example.com/mailto:?body=' . rawurlencode( $body ); 227 229 $email_link = esc_url( $email_link ); -
trunk/tests/phpunit/tests/formatting/SanitizeTextField.php
r46586 r46612 138 138 } 139 139 $this->assertEquals( $expected_oneline, sanitize_text_field( $string ) ); 140 $this->assertEquals ( $expected_multiline, sanitize_textarea_field( $string ) );140 $this->assertEqualsIgnoreEOL( $expected_multiline, sanitize_textarea_field( $string ) ); 141 141 142 142 } -
trunk/tests/phpunit/tests/functions/getArchives.php
r46586 r46612 72 72 <li><a href='$link5'>$title5</a></li> 73 73 EOF; 74 $this->assertEquals (74 $this->assertEqualsIgnoreEOL( 75 75 $expected['limit'], 76 76 trim( … … 154 154 <li><a href='{$this->month_url}'>$date_full</a></li> 155 155 EOF; 156 $this->assertEquals (156 $this->assertEqualsIgnoreEOL( 157 157 $expected['order_asc'], 158 158 trim( … … 170 170 <li><a href='{$oct_url}'>October 2012</a></li> 171 171 EOF; 172 $this->assertEquals (172 $this->assertEqualsIgnoreEOL( 173 173 $expected['order_desc'], 174 174 trim( -
trunk/tests/phpunit/tests/general/paginateLinks.php
r46586 r46612 26 26 27 27 $links = paginate_links( array( 'total' => 50 ) ); 28 $this->assertEquals ( $expected, $links );28 $this->assertEqualsIgnoreEOL( $expected, $links ); 29 29 } 30 30 … … 49 49 ) 50 50 ); 51 $this->assertEquals ( $expected, $links );51 $this->assertEqualsIgnoreEOL( $expected, $links ); 52 52 } 53 53 … … 74 74 ) 75 75 ); 76 $this->assertEquals ( $expected, $links );76 $this->assertEqualsIgnoreEOL( $expected, $links ); 77 77 } 78 78 … … 101 101 ) 102 102 ); 103 $this->assertEquals ( $expected, $links );103 $this->assertEqualsIgnoreEOL( $expected, $links ); 104 104 } 105 105 -
trunk/tests/phpunit/tests/media.php
r46586 r46612 1250 1250 1251 1251 $result = apply_filters( 'the_content', $content ); 1252 $this->assertEquals ( $expected, $result );1252 $this->assertEqualsIgnoreEOL( $expected, $result ); 1253 1253 } 1254 1254 -
trunk/tests/phpunit/tests/pomo/po.php
r46586 r46612 23 23 http://wordpress.org/ 24 24 '; 25 $this->mail = str_replace( "\r\n", "\n", $this->mail ); 25 26 $this->po_mail = '"" 26 27 "Your new WordPress blog has been successfully set up at:\n" … … 64 65 $this->assertEquals( '"Categories can be selectively converted to tags using the <a href=\\"%s\\">category to tag converter</a>."', $po->poify( $src ) ); 65 66 66 $this->assertEquals ( $this->po_mail, $po->poify( $this->mail ) );67 $this->assertEqualsIgnoreEOL( $this->po_mail, $po->poify( $this->mail ) ); 67 68 } 68 69 … … 75 76 // wordwrapped 76 77 $this->assertEquals( 'babadyado', $po->unpoify( "\"\"\n\"baba\"\n\"dyado\"" ) ); 77 $this->assertEquals ( $this->mail, $po->unpoify( $this->po_mail ) );78 $this->assertEqualsIgnoreEOL( $this->mail, $po->unpoify( $this->po_mail ) ); 78 79 } 79 80 … … 89 90 ) 90 91 ); 91 $this->assertEquals (92 $this->assertEqualsIgnoreEOL( 92 93 'msgid "baba" 93 94 msgid_plural "babas" … … 102 103 ) 103 104 ); 104 $this->assertEquals (105 $this->assertEqualsIgnoreEOL( 105 106 '# baba 106 107 # dyado … … 115 116 ) 116 117 ); 117 $this->assertEquals (118 $this->assertEqualsIgnoreEOL( 118 119 '#. baba 119 120 msgid "baba" … … 128 129 ) 129 130 ); 130 $this->assertEquals (131 $this->assertEqualsIgnoreEOL( 131 132 '#. baba 132 133 #: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 … … 159 160 ) 160 161 ); 161 $this->assertEquals (162 $this->assertEqualsIgnoreEOL( 162 163 'msgid "baba" 163 164 msgid_plural "babas" … … 173 174 ) 174 175 ); 175 $this->assertEquals (176 $this->assertEqualsIgnoreEOL( 176 177 'msgid "baba" 177 178 msgid_plural "babas" … … 191 192 ) 192 193 ); 193 $this->assertEquals (194 $this->assertEqualsIgnoreEOL( 194 195 '#, fuzzy, php-format 195 196 msgctxt "ctxt" -
trunk/tests/phpunit/tests/post/listPages.php
r46586 r46612 135 135 </ul></li>'; 136 136 137 $this-> AssertEquals( $expected, wp_list_pages( $args ) );137 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 138 138 } 139 139 … … 149 149 </ul></li>'; 150 150 151 $this-> AssertEquals( $expected, wp_list_pages( $args ) );151 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 152 152 } 153 153 … … 165 165 </ul></li>'; 166 166 167 $this-> AssertEquals( $expected, wp_list_pages( $args ) );167 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 168 168 } 169 169 … … 199 199 </ul></li>'; 200 200 201 $this-> AssertEquals( $expected, wp_list_pages( $args ) );201 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 202 202 } 203 203 … … 213 213 </ul></li>'; 214 214 215 $this-> AssertEquals( $expected, wp_list_pages( $args ) );215 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 216 216 } 217 217 … … 241 241 </ul></li>'; 242 242 243 $this-> AssertEquals( $expected, wp_list_pages( $args ) );243 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 244 244 } 245 245 … … 256 256 </ul></li>'; 257 257 258 $this-> AssertEquals( $expected, wp_list_pages( $args ) );258 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 259 259 } 260 260 … … 269 269 <li class="page_item page-item-' . self::$parent_3 . ' page_item_has_children"><a href="' . get_permalink( self::$parent_3 ) . '">Parent 3</a></li> 270 270 </ul></li>'; 271 $expected = str_replace( "\r\n", "\n", $expected ); 271 272 $this->expectOutputString( $expected ); 272 273 wp_list_pages( $args ); … … 282 283 </ul></li>'; 283 284 284 $this-> AssertEquals( $expected, wp_list_pages( $args ) );285 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 285 286 } 286 287 … … 294 295 </ul></li>'; 295 296 296 $this-> AssertEquals( $expected, wp_list_pages( $args ) );297 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 297 298 } 298 299 … … 327 328 </ul></li>'; 328 329 329 $this-> AssertEquals( $expected, wp_list_pages( $args ) );330 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 330 331 } 331 332 … … 359 360 </ul></li>'; 360 361 361 $this-> AssertEquals( $expected, wp_list_pages( $args ) );362 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 362 363 } 363 364 … … 391 392 </ul></li>'; 392 393 393 $this-> AssertEquals( $expected, wp_list_pages( $args ) );394 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 394 395 } 395 396 … … 405 406 </ul></li>'; 406 407 407 $this-> AssertEquals( $expected, wp_list_pages( $args ) );408 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 408 409 } 409 410 … … 423 424 </ul></li>'; 424 425 425 $this-> AssertEquals( $expected, wp_list_pages( $args ) );426 $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) ); 426 427 } 427 428 … … 434 435 $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>'; 435 436 436 $this-> AssertEquals( $expected, wp_list_pages( $args ) );437 $this->assertEquals( $expected, wp_list_pages( $args ) ); 437 438 } 438 439 } -
trunk/tests/phpunit/tests/post/template.php
r46586 r46612 165 165 166 166 $output = wp_dropdown_pages( array( 'echo' => 0 ) ); 167 $this->assertEquals ( $lineage, $output );167 $this->assertEqualsIgnoreEOL( $lineage, $output ); 168 168 169 169 $depth = <<<DEPTH … … 180 180 ) 181 181 ); 182 $this->assertEquals ( $depth, $output );182 $this->assertEqualsIgnoreEOL( $depth, $output ); 183 183 184 184 $option_none = <<<NONE … … 198 198 ) 199 199 ); 200 $this->assertEquals ( $option_none, $output );200 $this->assertEqualsIgnoreEOL( $option_none, $output ); 201 201 202 202 $option_no_change = <<<NO … … 208 208 209 209 NO; 210 $output = wp_dropdown_pages( 210 211 $output = wp_dropdown_pages( 211 212 array( 212 213 'echo' => 0, … … 217 218 ) 218 219 ); 219 $this->assertEquals ( $option_no_change, $output );220 $this->assertEqualsIgnoreEOL( $option_no_change, $output ); 220 221 } 221 222
Note: See TracChangeset
for help on using the changeset viewer.