- Timestamp:
- 07/07/2021 07:34:33 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-sidebars-controller.php
r51287 r51377 76 76 77 77 private function setup_widget( $option_name, $number, $settings ) { 78 update_option(78 $this->setup_widgets( 79 79 $option_name, 80 80 array( … … 82 82 ) 83 83 ); 84 } 85 86 private function setup_widgets( $option_name, $settings ) { 87 update_option( $option_name, $settings ); 84 88 } 85 89 … … 492 496 493 497 /** 498 * @ticket 53612 499 */ 500 public function test_batch_remove_widgets_from_existing_sidebar() { 501 wp_widgets_init(); 502 503 $this->setup_widgets( 504 'widget_text', 505 array( 506 2 => array( 'text' => 'Text widget' ), 507 3 => array( 'text' => 'Text widget' ), 508 4 => array( 'text' => 'Text widget' ), 509 5 => array( 'text' => 'Text widget' ), 510 6 => array( 'text' => 'Text widget' ), 511 ) 512 ); 513 514 $this->setup_sidebar( 515 'sidebar-1', 516 array( 517 'name' => 'Test sidebar', 518 ), 519 array( 'text-2', 'text-3', 'text-4', 'text-5', 'text-6' ) 520 ); 521 522 $request = new WP_REST_Request( 'POST', '/batch/v1' ); 523 $request->set_body_params( 524 array( 525 'requests' => array( 526 array( 527 'method' => 'DELETE', 528 'path' => '/wp/v2/widgets/text-2?force=1', 529 ), 530 array( 531 'method' => 'DELETE', 532 'path' => '/wp/v2/widgets/text-3?force=1', 533 ), 534 ), 535 ) 536 ); 537 rest_get_server()->dispatch( $request ); 538 539 $this->assertSame( 540 array( 'text-4', 'text-5', 'text-6' ), 541 rest_do_request( '/wp/v2/sidebars/sidebar-1' )->get_data()['widgets'] 542 ); 543 } 544 545 /** 494 546 * @ticket 41683 495 547 */
Note: See TracChangeset
for help on using the changeset viewer.