Changeset 51135
- Timestamp:
- 06/09/2021 07:41:47 PM (3 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/abstract-testcase.php
r50913 r51135 661 661 * 662 662 * @since 5.6.0 663 * 664 * @param string $expected The expected value. 665 * @param string $actual The actual value. 663 * @since 5.8.0 Added support for nested arrays. 664 * 665 * @param string|array $expected The expected value. 666 * @param string|array $actual The actual value. 666 667 */ 667 668 public function assertSameIgnoreEOL( $expected, $actual ) { 668 $this->assertSame( str_replace( "\r\n", "\n", $expected ), str_replace( "\r\n", "\n", $actual ) ); 669 $expected = map_deep( 670 $expected, 671 function ( $value ) { 672 return str_replace( "\r\n", "\n", $value ); 673 } 674 ); 675 676 $actual = map_deep( 677 $actual, 678 function ( $value ) { 679 return str_replace( "\r\n", "\n", $value ); 680 } 681 ); 682 683 $this->assertSame( $expected, $actual ); 669 684 } 670 685 -
trunk/tests/phpunit/tests/rest-api/rest-widget-types-controller.php
r51079 r51135 308 308 $response = rest_get_server()->dispatch( $request ); 309 309 $data = $response->get_data(); 310 $this->assertSame (310 $this->assertSameIgnoreEOL( 311 311 "<p>\n" . 312 312 "\t\t\t<label for=\"widget-search--1-title\">Title:</label>\n" . … … 344 344 $response = rest_get_server()->dispatch( $request ); 345 345 $data = $response->get_data(); 346 $this->assertSame (346 $this->assertSameIgnoreEOL( 347 347 "<p>\n" . 348 348 "\t\t\t<label for=\"widget-search-8-title\">Title:</label>\n" . … … 386 386 $response = rest_get_server()->dispatch( $request ); 387 387 $data = $response->get_data(); 388 $this->assertSame (388 $this->assertSameIgnoreEOL( 389 389 "<p>\n" . 390 390 "\t\t\t<label for=\"widget-search--1-title\">Title:</label>\n" . … … 422 422 $response = rest_get_server()->dispatch( $request ); 423 423 $data = $response->get_data(); 424 $this->assertSame (424 $this->assertSameIgnoreEOL( 425 425 "<p>\n" . 426 426 "\t\t\t<label for=\"widget-search--1-title\">Title:</label>\n" . … … 466 466 $response = rest_get_server()->dispatch( $request ); 467 467 $data = $response->get_data(); 468 $this->assertSame (468 $this->assertSameIgnoreEOL( 469 469 "<p>\n" . 470 470 "\t\t\t<label for=\"widget-search--1-title\">Title:</label>\n" . -
trunk/tests/phpunit/tests/rest-api/rest-widgets-controller.php
r51088 r51135 382 382 $data = $response->get_data(); 383 383 $data = $this->remove_links( $data ); 384 $this->assert EqualSets(384 $this->assertSameIgnoreEOL( 385 385 array( 386 386 array( … … 388 388 'id_base' => 'text', 389 389 'sidebar' => 'sidebar-1', 390 'rendered' => '<div class="textwidget">Custom text test</div>', 391 'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" . 392 ' <textarea id="widget-text-1-text" name="widget-text[1][text]" class="text sync-input" hidden>Custom text test</textarea>' . "\n" . 393 ' <input id="widget-text-1-filter" name="widget-text[1][filter]" class="filter sync-input" type="hidden" value="on">' . "\n" . 394 ' <input id="widget-text-1-visual" name="widget-text[1][visual]" class="visual sync-input" type="hidden" value="on">', 390 395 'instance' => array( 391 396 'encoded' => base64_encode( … … 407 412 ), 408 413 ), 409 'rendered' => '<div class="textwidget">Custom text test</div>',410 'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" .411 ' <textarea id="widget-text-1-text" name="widget-text[1][text]" class="text sync-input" hidden>Custom text test</textarea>' . "\n" .412 ' <input id="widget-text-1-filter" name="widget-text[1][filter]" class="filter sync-input" type="hidden" value="on">' . "\n" .413 ' <input id="widget-text-1-visual" name="widget-text[1][visual]" class="visual sync-input" type="hidden" value="on">',414 414 ), 415 415 array( … … 1208 1208 $response = rest_do_request( $request ); 1209 1209 1210 $this->assert EqualSets(1210 $this->assertSameIgnoreEOL( 1211 1211 array( 1212 1212 'id' => 'text-1', 1213 1213 'id_base' => 'text', 1214 1214 'sidebar' => 'wp_inactive_widgets', 1215 'rendered' => '', 1216 'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" . 1217 ' <textarea id="widget-text-1-text" name="widget-text[1][text]" class="text sync-input" hidden>Custom text test</textarea>' . "\n" . 1218 ' <input id="widget-text-1-filter" name="widget-text[1][filter]" class="filter sync-input" type="hidden" value="on">' . "\n" . 1219 ' <input id="widget-text-1-visual" name="widget-text[1][visual]" class="visual sync-input" type="hidden" value="on">', 1215 1220 'instance' => array( 1216 1221 'encoded' => base64_encode( … … 1232 1237 ), 1233 1238 ), 1234 'rendered' => '',1235 'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" .1236 ' <textarea id="widget-text-1-text" name="widget-text[1][text]" class="text sync-input" hidden>Custom text test</textarea>' . "\n" .1237 ' <input id="widget-text-1-filter" name="widget-text[1][filter]" class="filter sync-input" type="hidden" value="on">' . "\n" .1238 ' <input id="widget-text-1-visual" name="widget-text[1][visual]" class="visual sync-input" type="hidden" value="on">',1239 1239 ), 1240 1240 $response->get_data() … … 1265 1265 $response = rest_do_request( $request ); 1266 1266 1267 $this->assert EqualSets(1267 $this->assertSameIgnoreEOL( 1268 1268 array( 1269 1269 'deleted' => true, … … 1273 1273 'id_base' => 'text', 1274 1274 'sidebar' => 'sidebar-1', 1275 'rendered' => '<div class="textwidget">Custom text test</div>', 1276 'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" . 1277 ' <textarea id="widget-text-1-text" name="widget-text[1][text]" class="text sync-input" hidden>Custom text test</textarea>' . "\n" . 1278 ' <input id="widget-text-1-filter" name="widget-text[1][filter]" class="filter sync-input" type="hidden" value="on">' . "\n" . 1279 ' <input id="widget-text-1-visual" name="widget-text[1][visual]" class="visual sync-input" type="hidden" value="on">', 1275 1280 'instance' => array( 1276 1281 'encoded' => base64_encode( … … 1292 1297 ), 1293 1298 ), 1294 'rendered' => '<div class="textwidget">Custom text test</div>',1295 'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" .1296 ' <textarea id="widget-text-1-text" name="widget-text[1][text]" class="text sync-input" hidden>Custom text test</textarea>' . "\n" .1297 ' <input id="widget-text-1-filter" name="widget-text[1][filter]" class="filter sync-input" type="hidden" value="on">' . "\n" .1298 ' <input id="widget-text-1-visual" name="widget-text[1][visual]" class="visual sync-input" type="hidden" value="on">',1299 1299 1300 1300 ),
Note: See TracChangeset
for help on using the changeset viewer.