Changeset 51079
- Timestamp:
- 06/07/2021 11:16:29 AM (3 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/block-template-utils.php
r51003 r51079 41 41 42 42 $this->assertNotWPError( $template ); 43 $this->assert Equals( get_stylesheet() . '//my_template', $template->id );44 $this->assert Equals( get_stylesheet(), $template->theme );45 $this->assert Equals( 'my_template', $template->slug );46 $this->assert Equals( 'publish', $template->status );47 $this->assert Equals( 'custom', $template->source );48 $this->assert Equals( 'My Template', $template->title );49 $this->assert Equals( 'Description of my template', $template->description );50 $this->assert Equals( 'wp_template', $template->type );43 $this->assertSame( get_stylesheet() . '//my_template', $template->id ); 44 $this->assertSame( get_stylesheet(), $template->theme ); 45 $this->assertSame( 'my_template', $template->slug ); 46 $this->assertSame( 'publish', $template->status ); 47 $this->assertSame( 'custom', $template->source ); 48 $this->assertSame( 'My Template', $template->title ); 49 $this->assertSame( 'Description of my template', $template->description ); 50 $this->assertSame( 'wp_template', $template->type ); 51 51 } 52 52 … … 57 57 $id = get_stylesheet() . '//' . 'my_template'; 58 58 $template = get_block_template( $id, 'wp_template' ); 59 $this->assert Equals( $id, $template->id );60 $this->assert Equals( get_stylesheet(), $template->theme );61 $this->assert Equals( 'my_template', $template->slug );62 $this->assert Equals( 'publish', $template->status );63 $this->assert Equals( 'custom', $template->source );64 $this->assert Equals( 'wp_template', $template->type );59 $this->assertSame( $id, $template->id ); 60 $this->assertSame( get_stylesheet(), $template->theme ); 61 $this->assertSame( 'my_template', $template->slug ); 62 $this->assertSame( 'publish', $template->status ); 63 $this->assertSame( 'custom', $template->source ); 64 $this->assertSame( 'wp_template', $template->type ); 65 65 } 66 66 … … 88 88 $templates = get_block_templates( array( 'slug__in' => array( 'my_template' ) ), 'wp_template' ); 89 89 $template_ids = get_template_ids( $templates ); 90 $this->assert Equals( array( get_stylesheet() . '//' . 'my_template' ), $template_ids );90 $this->assertSame( array( get_stylesheet() . '//' . 'my_template' ), $template_ids ); 91 91 92 92 // Filter by CPT ID. 93 93 $templates = get_block_templates( array( 'wp_id' => self::$post->ID ), 'wp_template' ); 94 94 $template_ids = get_template_ids( $templates ); 95 $this->assert Equals( array( get_stylesheet() . '//' . 'my_template' ), $template_ids );95 $this->assertSame( array( get_stylesheet() . '//' . 'my_template' ), $template_ids ); 96 96 } 97 97 } -
trunk/tests/phpunit/tests/block-template.php
r51003 r51079 55 55 ); 56 56 $resolved_template_path = locate_block_template( $custom_page_template_path, $type, $templates ); 57 $this->assert Equals( $custom_page_template_path, $resolved_template_path );57 $this->assertSame( $custom_page_template_path, $resolved_template_path ); 58 58 } 59 59 … … 74 74 ); 75 75 $resolved_template_path = locate_block_template( $page_template_path, $type, $templates ); 76 $this->assert Equals( self::$template_canvas_path, $resolved_template_path );77 $this->assert Equals( self::$post->post_content, $_wp_current_template_content );76 $this->assertSame( self::$template_canvas_path, $resolved_template_path ); 77 $this->assertSame( self::$post->post_content, $_wp_current_template_content ); 78 78 } 79 79 … … 83 83 function test_template_remains_unchanged_if_templates_array_is_empty() { 84 84 $resolved_template_path = locate_block_template( '', 'search', array() ); 85 $this->assert Equals( '', $resolved_template_path );85 $this->assertSame( '', $resolved_template_path ); 86 86 } 87 87 } -
trunk/tests/phpunit/tests/bookmark/getBookmark.php
r50936 r51079 229 229 230 230 /* 231 * For non-array output type, use asse tEquals. Why? The object pulled from cache will have the same232 * property values but will be a different object than the expected object.231 * For non-array output type, use assertEquals(). Why? The object pulled from the cache 232 * will have the same property values but will be a different object than the expected object. 233 233 */ 234 234 if ( is_object( $expected ) ) { … … 287 287 288 288 /* 289 * For non-array output type, use asse tEquals. Why? The object pulled from the database will have the same290 * property values but will be a different object than the expected object.289 * For non-array output type, use assertEquals(). Why? The object pulled from the database 290 * will have the same property values but will be a different object than the expected object. 291 291 */ 292 292 if ( is_object( $expected ) ) { -
trunk/tests/phpunit/tests/post.php
r50384 r51079 1783 1783 update_option( 'sticky_posts', array( 1, 2, 2 ) ); 1784 1784 stick_post( 2 ); 1785 $this->assert Equals( array( 1, 2, 2 ), get_option( 'sticky_posts' ) );1785 $this->assertSameSets( array( 1, 2, 2 ), get_option( 'sticky_posts' ) ); 1786 1786 } 1787 1787 … … 1795 1795 update_option( 'sticky_posts', array( 1, 2, 2 ) ); 1796 1796 unstick_post( 3 ); 1797 $this->assert Equals( array( 1, 2, 2 ), get_option( 'sticky_posts' ) );1797 $this->assertSameSets( array( 1, 2, 2 ), get_option( 'sticky_posts' ) ); 1798 1798 } 1799 1799 } -
trunk/tests/phpunit/tests/rest-api/rest-sidebars-controller.php
r50995 r51079 133 133 $data = $response->get_data(); 134 134 135 $this->assert Equals( array(), $data );135 $this->assertSame( array(), $data ); 136 136 } 137 137 … … 171 171 $data = $response->get_data(); 172 172 $data = $this->remove_links( $data ); 173 $this->assert Equals(173 $this->assertSame( 174 174 array( 175 175 array( … … 177 177 'name' => 'Test sidebar', 178 178 'description' => '', 179 'status' => 'active',180 'widgets' => array(),181 179 'class' => '', 182 180 'before_widget' => '', … … 184 182 'before_title' => '', 185 183 'after_title' => '', 184 'status' => 'active', 185 'widgets' => array(), 186 186 ), 187 187 ), … … 220 220 $data = $response->get_data(); 221 221 $data = $this->remove_links( $data ); 222 $this->assert Equals(222 $this->assertSame( 223 223 array( 224 224 array( … … 226 226 'name' => 'Test sidebar', 227 227 'description' => '', 228 'class' => '', 229 'before_widget' => '', 230 'after_widget' => '', 231 'before_title' => '', 232 'after_title' => '', 228 233 'status' => 'active', 229 234 'widgets' => array( … … 231 236 'rss-1', 232 237 ), 233 'class' => '',234 'before_widget' => '',235 'after_widget' => '',236 'before_title' => '',237 'after_title' => '',238 238 ), 239 239 ), … … 257 257 $data = $response->get_data(); 258 258 $data = $this->remove_links( $data ); 259 $this->assert Equals(259 $this->assertSame( 260 260 array( 261 261 'id' => 'sidebar-1', 262 262 'name' => 'Test sidebar', 263 263 'description' => '', 264 'status' => 'active',265 'widgets' => array(),266 264 'class' => '', 267 265 'before_widget' => '', … … 269 267 'before_title' => '', 270 268 'after_title' => '', 269 'status' => 'active', 270 'widgets' => array(), 271 271 ), 272 272 $data … … 359 359 $data = $response->get_data(); 360 360 $data = $this->remove_links( $data ); 361 $this->assert Equals(361 $this->assertSame( 362 362 array( 363 363 'id' => 'sidebar-1', 364 364 'name' => 'Test sidebar', 365 365 'description' => '', 366 'status' => 'active',367 'widgets' => array(368 'text-1',369 'text-2',370 ),371 366 'class' => '', 372 367 'before_widget' => '', … … 374 369 'before_title' => '', 375 370 'after_title' => '', 371 'status' => 'active', 372 'widgets' => array( 373 'text-1', 374 'text-2', 375 ), 376 376 ), 377 377 $data … … 502 502 $data = $response->get_data(); 503 503 $data = $this->remove_links( $data ); 504 $this->assert Equals(504 $this->assertSame( 505 505 array( 506 506 array( … … 508 508 'name' => 'Test sidebar', 509 509 'description' => '', 510 'status' => 'active',511 'widgets' => array(512 'text-1',513 ),514 510 'class' => '', 515 511 'before_widget' => '', … … 517 513 'before_title' => '', 518 514 'after_title' => '', 515 'status' => 'active', 516 'widgets' => array( 517 'text-1', 518 ), 519 519 ), 520 520 array( … … 522 522 'name' => 'Inactive widgets', 523 523 'description' => '', 524 'status' => 'inactive',525 'widgets' => array(526 'rss-1',527 ),528 524 'class' => '', 529 525 'before_widget' => '', … … 531 527 'before_title' => '', 532 528 'after_title' => '', 529 'status' => 'inactive', 530 'widgets' => array( 531 'rss-1', 532 ), 533 533 ), 534 534 ), -
trunk/tests/phpunit/tests/rest-api/rest-templates-controller.php
r51003 r51079 81 81 $data = $response->get_data(); 82 82 83 $this->assert Equals(83 $this->assertSame( 84 84 array( 85 85 'id' => 'default//my_template', 86 86 'theme' => 'default', 87 87 'slug' => 'my_template', 88 'source' => 'custom', 89 'type' => 'wp_template', 90 'description' => 'Description of my template.', 88 91 'title' => array( 89 92 'raw' => 'My Template', 90 93 'rendered' => 'My Template', 91 94 ), 92 'description' => 'Description of my template.',93 95 'status' => 'publish', 94 'source' => 'custom',95 'type' => 'wp_template',96 96 'wp_id' => self::$post->ID, 97 97 'has_theme_file' => false, … … 109 109 unset( $data['_links'] ); 110 110 111 $this->assert Equals(111 $this->assertSame( 112 112 array( 113 113 'id' => 'default//my_template', 114 114 'theme' => 'default', 115 115 'slug' => 'my_template', 116 'source' => 'custom', 117 'type' => 'wp_template', 118 'description' => 'Description of my template.', 116 119 'title' => array( 117 120 'raw' => 'My Template', 118 121 'rendered' => 'My Template', 119 122 ), 120 'description' => 'Description of my template.',121 123 'status' => 'publish', 122 'source' => 'custom',123 'type' => 'wp_template',124 124 'wp_id' => self::$post->ID, 125 125 'has_theme_file' => false, … … 135 135 array( 136 136 'slug' => 'my_custom_template', 137 'description' => 'Just a description', 137 138 'title' => 'My Template', 138 'description' => 'Just a description',139 139 'content' => 'Content', 140 140 ) … … 145 145 unset( $data['wp_id'] ); 146 146 147 $this->assert Equals(147 $this->assertSame( 148 148 array( 149 149 'id' => 'default//my_custom_template', 150 150 'theme' => 'default', 151 'content' => array( 152 'raw' => 'Content', 153 ), 151 154 'slug' => 'my_custom_template', 155 'source' => 'custom', 156 'type' => 'wp_template', 157 'description' => 'Just a description', 152 158 'title' => array( 153 159 'raw' => 'My Template', 154 160 'rendered' => 'My Template', 155 161 ), 156 'description' => 'Just a description',157 162 'status' => 'publish', 158 'source' => 'custom',159 'type' => 'wp_template',160 'content' => array(161 'raw' => 'Content',162 ),163 163 'has_theme_file' => false, 164 164 ), … … 177 177 $response = rest_get_server()->dispatch( $request ); 178 178 $data = $response->get_data(); 179 $this->assert Equals( 'My new Index Title', $data['title']['raw'] );180 $this->assert Equals( 'custom', $data['source'] );179 $this->assertSame( 'My new Index Title', $data['title']['raw'] ); 180 $this->assertSame( 'custom', $data['source'] ); 181 181 } 182 182 -
trunk/tests/phpunit/tests/rest-api/rest-widget-types-controller.php
r51049 r51079 308 308 $response = rest_get_server()->dispatch( $request ); 309 309 $data = $response->get_data(); 310 $this->assert Equals(310 $this->assertSame( 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->assert Equals(346 $this->assertSame( 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->assert Equals(388 $this->assertSame( 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->assert Equals(424 $this->assertSame( 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->assert Equals(468 $this->assertSame( 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
r51059 r51079 212 212 $data = $response->get_data(); 213 213 214 $this->assert Equals( array(), $data );214 $this->assertSame( array(), $data ); 215 215 } 216 216 … … 277 277 array( 278 278 'id' => 'block-1', 279 'id_base' => 'block', 279 280 'sidebar' => 'sidebar-1', 280 281 'instance' => array( … … 297 298 ), 298 299 ), 299 'id_base' => 'block',300 300 'rendered' => '<p>Block test</p>', 301 301 ), 302 302 array( 303 303 'id' => 'rss-1', 304 'id_base' => 'rss', 304 305 'sidebar' => 'sidebar-1', 305 306 'instance' => array( … … 321 322 ), 322 323 ), 323 'id_base' => 'rss',324 324 'rendered' => '<a class="rsswidget" href="https://wordpress.org/news/feed"><img class="rss-widget-icon" style="border:0" width="14" height="14" src="http://example.org/wp-includes/images/rss.png" alt="RSS" /></a> <a class="rsswidget" href="https://wordpress.org/news">RSS test</a><ul><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/introducing-learn-wordpress/\'>Introducing Learn WordPress</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/simone/\'>WordPress 5.6 “Simone”</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/state-of-the-word-2020/\'>State of the Word 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/the-month-in-wordpress-november-2020/\'>The Month in WordPress: November 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/12/wordpress-5-6-release-candidate-2/\'>WordPress 5.6 Release Candidate 2</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-release-candidate/\'>WordPress 5.6 Release Candidate</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-4/\'>WordPress 5.6 Beta 4</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/wordpress-5-6-beta-3/\'>WordPress 5.6 Beta 3</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/11/the-month-in-wordpress-october-2020/\'>The Month in WordPress: October 2020</a></li><li><a class=\'rsswidget\' href=\'https://wordpress.org/news/2020/10/wordpress-5-5-3-maintenance-release/\'>WordPress 5.5.3 Maintenance Release</a></li></ul>', 325 325 ), 326 326 array( 327 327 'id' => 'testwidget', 328 'id_base' => 'testwidget', 328 329 'sidebar' => 'sidebar-1', 329 330 'instance' => null, 330 'id_base' => 'testwidget',331 331 'rendered' => '<h1>Default id</h1><span>Default text</span>', 332 332 ), … … 386 386 array( 387 387 'id' => 'text-1', 388 'id_base' => 'text', 388 389 'sidebar' => 'sidebar-1', 389 390 'instance' => array( … … 406 407 ), 407 408 ), 408 'id_base' => 'text',409 409 'rendered' => '<div class="textwidget">Custom text test</div>', 410 410 'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" . … … 415 415 array( 416 416 'id' => 'testwidget', 417 'id_base' => 'testwidget', 417 418 'sidebar' => 'sidebar-1', 418 'instance' => null,419 'id_base' => 'testwidget',420 419 'rendered' => '<h1>Default id</h1><span>Default text</span>', 421 420 'rendered_form' => 'WP test widget form', 421 'instance' => null, 422 422 ), 423 423 ), … … 451 451 array( 452 452 'id' => 'text-1', 453 'id_base' => 'text', 453 454 'sidebar' => 'sidebar-1', 454 455 'instance' => array( … … 471 472 ), 472 473 ), 473 'id_base' => 'text',474 474 'rendered' => '<div class="textwidget">Custom text test</div>', 475 475 ), … … 542 542 $request->set_body_params( 543 543 array( 544 'id_base' => 'text', 544 545 'sidebar' => 'sidebar-1', 545 546 'instance' => array( … … 559 560 ), 560 561 ), 561 'id_base' => 'text',562 562 ) 563 563 ); 564 564 $response = rest_get_server()->dispatch( $request ); 565 565 $data = $response->get_data(); 566 $this->assert Equals( 'text-2', $data['id'] );567 $this->assert Equals( 'sidebar-1', $data['sidebar'] );566 $this->assertSame( 'text-2', $data['id'] ); 567 $this->assertSame( 'sidebar-1', $data['sidebar'] ); 568 568 $this->assertEqualSets( 569 569 array( … … 590 590 $request->set_body_params( 591 591 array( 592 'id_base' => 'text', 592 593 'sidebar' => 'sidebar-1', 593 594 'instance' => array( … … 601 602 'hash' => 'badhash', 602 603 ), 604 ) 605 ); 606 $response = rest_get_server()->dispatch( $request ); 607 $this->assertErrorResponse( 'rest_invalid_widget', $response, 400 ); 608 } 609 610 /** 611 * @ticket 41683 612 */ 613 public function test_create_item_bad_instance() { 614 $this->setup_sidebar( 615 'sidebar-1', 616 array( 617 'name' => 'Test sidebar', 618 ) 619 ); 620 621 $request = new WP_REST_Request( 'POST', '/wp/v2/widgets' ); 622 $request->set_body_params( 623 array( 603 624 'id_base' => 'text', 604 )605 );606 $response = rest_get_server()->dispatch( $request );607 $this->assertErrorResponse( 'rest_invalid_widget', $response, 400 );608 }609 610 /**611 * @ticket 41683612 */613 public function test_create_item_bad_instance() {614 $this->setup_sidebar(615 'sidebar-1',616 array(617 'name' => 'Test sidebar',618 )619 );620 621 $request = new WP_REST_Request( 'POST', '/wp/v2/widgets' );622 $request->set_body_params(623 array(624 625 'sidebar' => 'sidebar-1', 625 626 'instance' => array(), 626 'id_base' => 'text',627 627 ) 628 628 ); … … 645 645 $request->set_body_params( 646 646 array( 647 'id_base' => 'block', 647 648 'sidebar' => 'sidebar-1', 648 649 'instance' => array( … … 651 652 ), 652 653 ), 653 'id_base' => 'block',654 654 ) 655 655 ); 656 656 $response = rest_get_server()->dispatch( $request ); 657 657 $data = $response->get_data(); 658 $this->assert Equals( 'block-2', $data['id'] );659 $this->assert Equals( 'sidebar-1', $data['sidebar'] );658 $this->assertSame( 'block-2', $data['id'] ); 659 $this->assertSame( 'sidebar-1', $data['sidebar'] ); 660 660 $this->assertEqualSets( 661 661 array( … … 684 684 $request->set_body_params( 685 685 array( 686 'id_base' => 'text', 686 687 'sidebar' => 'sidebar-1', 687 688 'instance' => array( … … 690 691 ), 691 692 ), 692 'id_base' => 'text',693 693 ) 694 694 ); … … 713 713 $request->set_body_params( 714 714 array( 715 'id_base' => 'text', 715 716 'sidebar' => 'sidebar-1', 716 717 'form_data' => 'widget-text[2][text]=Updated+text+test', 717 'id_base' => 'text',718 718 ) 719 719 ); 720 720 $response = rest_get_server()->dispatch( $request ); 721 721 $data = $response->get_data(); 722 $this->assert Equals( 'text-2', $data['id'] );723 $this->assert Equals( 'sidebar-1', $data['sidebar'] );722 $this->assertSame( 'text-2', $data['id'] ); 723 $this->assertSame( 'sidebar-1', $data['sidebar'] ); 724 724 $this->assertEqualSets( 725 725 array( … … 746 746 $request->set_body_params( 747 747 array( 748 'id_base' => 'text', 748 749 'sidebar' => 'sidebar-1', 749 750 'instance' => array( 750 751 'raw' => array( 'text' => 'Text 1' ), 751 752 ), 752 'id_base' => 'text',753 753 ) 754 754 ); 755 755 $response = rest_get_server()->dispatch( $request ); 756 756 $data = $response->get_data(); 757 $this->assert Equals( 'text-2', $data['id'] );758 $this->assert Equals( 'sidebar-1', $data['sidebar'] );757 $this->assertSame( 'text-2', $data['id'] ); 758 $this->assertSame( 'sidebar-1', $data['sidebar'] ); 759 759 $this->assertEqualSets( 760 760 array( … … 769 769 $request->set_body_params( 770 770 array( 771 'id_base' => 'text', 771 772 'sidebar' => 'sidebar-1', 772 773 'instance' => array( 773 774 'raw' => array( 'text' => 'Text 2' ), 774 775 ), 775 'id_base' => 'text',776 776 ) 777 777 ); 778 778 $response = rest_get_server()->dispatch( $request ); 779 779 $data = $response->get_data(); 780 $this->assert Equals( 'text-3', $data['id'] );781 $this->assert Equals( 'sidebar-1', $data['sidebar'] );780 $this->assertSame( 'text-3', $data['id'] ); 781 $this->assertSame( 'sidebar-1', $data['sidebar'] ); 782 782 $this->assertEqualSets( 783 783 array( … … 815 815 $request->set_body_params( 816 816 array( 817 'id_base' => 'text', 817 818 'sidebar' => 'sidebar-1', 818 819 'instance' => array( … … 821 822 ), 822 823 ), 823 'id_base' => 'text',824 824 ) 825 825 ); 826 826 $response = rest_get_server()->dispatch( $request ); 827 827 $data = $response->get_data(); 828 $this->assert Equals( 'text-2', $data['id'] );829 $this->assert Equals( 'sidebar-1', $data['sidebar'] );828 $this->assertSame( 'text-2', $data['id'] ); 829 $this->assertSame( 'sidebar-1', $data['sidebar'] ); 830 830 $this->assertEqualSets( 831 831 array( … … 861 861 array( 862 862 'id' => 'text-1', 863 'id_base' => 'text', 863 864 'sidebar' => 'sidebar-1', 864 865 'instance' => array( … … 867 868 ), 868 869 ), 869 'id_base' => 'text',870 870 ) 871 871 ); … … 873 873 $data = $response->get_data(); 874 874 875 $this->assert Equals( 'text-1', $data['id'] );876 $this->assert Equals( 'sidebar-1', $data['sidebar'] );875 $this->assertSame( 'text-1', $data['id'] ); 876 $this->assertSame( 'sidebar-1', $data['sidebar'] ); 877 877 $this->assertEqualSets( 878 878 array( … … 920 920 $error = $response->as_error(); 921 921 $this->assertNotWPError( $error, $error ? $error->get_error_message() : '' ); 922 $this->assert Equals( 'sidebar-2', $response->get_data()['sidebar'] );922 $this->assertSame( 'sidebar-2', $response->get_data()['sidebar'] ); 923 923 924 924 $sidebar1 = rest_do_request( '/wp/v2/sidebars/sidebar-1' ); … … 962 962 $data = $response->get_data(); 963 963 964 $this->assert Equals( 'text-1', $data['id'] );965 $this->assert Equals( 'sidebar-1', $data['sidebar'] );964 $this->assertSame( 'text-1', $data['id'] ); 965 $this->assertSame( 'sidebar-1', $data['sidebar'] ); 966 966 $this->assertEqualSets( 967 967 array( … … 979 979 public function test_store_html_as_admin() { 980 980 if ( is_multisite() ) { 981 $this->assert Equals(981 $this->assertSame( 982 982 '<div class="textwidget">alert(1)</div>', 983 983 $this->update_text_widget_with_raw_html( '<script>alert(1)</script>' ) 984 984 ); 985 985 } else { 986 $this->assert Equals(986 $this->assertSame( 987 987 '<div class="textwidget"><script>alert(1)</script></div>', 988 988 $this->update_text_widget_with_raw_html( '<script>alert(1)</script>' ) … … 997 997 wp_set_current_user( self::$superadmin_id ); 998 998 if ( is_multisite() ) { 999 $this->assert Equals(999 $this->assertSame( 1000 1000 '<div class="textwidget"><script>alert(1)</script></div>', 1001 1001 $this->update_text_widget_with_raw_html( '<script>alert(1)</script>' ) 1002 1002 ); 1003 1003 } else { 1004 $this->assert Equals(1004 $this->assertSame( 1005 1005 '<div class="textwidget"><script>alert(1)</script></div>', 1006 1006 $this->update_text_widget_with_raw_html( '<script>alert(1)</script>' ) … … 1029 1029 array( 1030 1030 'id' => 'text-1', 1031 'id_base' => 'text', 1031 1032 'instance' => array( 1032 1033 'raw' => array( … … 1034 1035 ), 1035 1036 ), 1036 'id_base' => 'text',1037 1037 ) 1038 1038 ); … … 1066 1066 $data = $response->get_data(); 1067 1067 $data = $this->remove_links( $data ); 1068 $this->assert Equals(1068 $this->assertSame( 1069 1069 array( 1070 1070 'id' => 'testwidget', 1071 'id_base' => 'testwidget', 1071 1072 'sidebar' => 'sidebar-1', 1072 'instance' => null,1073 1073 'rendered' => '<h1>My test id</h1><span>My test title</span>', 1074 1074 'rendered_form' => 'WP test widget form', 1075 'i d_base' => 'testwidget',1075 'instance' => null, 1076 1076 ), 1077 1077 $data … … 1103 1103 $data = $response->get_data(); 1104 1104 $data = $this->remove_links( $data ); 1105 $this->assert Equals(1105 $this->assertSame( 1106 1106 array( 1107 1107 'id' => 'testwidget', 1108 'id_base' => 'testwidget', 1108 1109 'sidebar' => 'sidebar-1', 1109 'instance' => null,1110 1110 'rendered' => '<h1>My test id</h1><span>My test title</span>', 1111 1111 'rendered_form' => 'WP test widget form', 1112 'i d_base' => 'testwidget',1112 'instance' => null, 1113 1113 ), 1114 1114 $data … … 1159 1159 array( 1160 1160 'id' => 'text-1', 1161 'id_base' => 'text', 1161 1162 'sidebar' => 'sidebar-1', 1162 1163 'instance' => array( … … 1165 1166 ), 1166 1167 ), 1167 'id_base' => 'text',1168 1168 ) 1169 1169 ); … … 1180 1180 ); 1181 1181 1182 $this->assert Equals(1182 $this->assertSame( 1183 1183 '<div class="textwidget">Updated \\" \\\' text test</div>', 1184 1184 $data['rendered'] … … 1211 1211 array( 1212 1212 'id' => 'text-1', 1213 'id_base' => 'text', 1213 1214 'sidebar' => 'wp_inactive_widgets', 1214 1215 'instance' => array( … … 1231 1232 ), 1232 1233 ), 1233 'id_base' => 'text',1234 1234 'rendered' => '', 1235 1235 'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" . … … 1271 1271 1272 1272 'id' => 'text-1', 1273 'id_base' => 'text', 1273 1274 'sidebar' => 'sidebar-1', 1274 1275 'instance' => array( … … 1291 1292 ), 1292 1293 ), 1293 'id_base' => 'text',1294 1294 'rendered' => '<div class="textwidget">Custom text test</div>', 1295 1295 'rendered_form' => '<input id="widget-text-1-title" name="widget-text[1][title]" class="title sync-input" type="hidden" value="">' . "\n" . … … 1304 1304 1305 1305 $response = rest_do_request( '/wp/v2/widgets/text-1' ); 1306 $this->assert Equals( 404, $response->get_status() );1306 $this->assertSame( 404, $response->get_status() ); 1307 1307 1308 1308 $this->assertArrayNotHasKey( 'text-1', get_option( 'sidebars_widgets' )['sidebar-1'] ); … … 1380 1380 $properties = $data['schema']['properties']; 1381 1381 1382 $this->assert Equals( 7, count( $properties ) );1382 $this->assertSame( 7, count( $properties ) ); 1383 1383 $this->assertArrayHasKey( 'id', $properties ); 1384 1384 $this->assertArrayHasKey( 'id_base', $properties ); -
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r51054 r51079 157 157 ); 158 158 159 $this->assert Equals(159 $this->assertSame( 160 160 'body{--wp--preset--color--grey: grey;}.wp-block-group{--wp--custom--base-font: 16;--wp--custom--line-height--small: 1.2;--wp--custom--line-height--medium: 1.4;--wp--custom--line-height--large: 1.8;}body{color: var(--wp--preset--color--grey);}a{background-color: #333;color: #111;}.wp-block-group{padding-top: 12px;padding-bottom: 24px;}.wp-block-group a{color: #111;}h1,h2,h3,h4,h5,h6{color: #123456;}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{background-color: #333;color: #111;font-size: 60px;}.wp-block-post-date{color: #123456;}.wp-block-post-date a{background-color: #777;color: #555;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}', 161 161 $theme_json->get_stylesheet() 162 162 ); 163 $this->assert Equals(163 $this->assertSame( 164 164 'body{color: var(--wp--preset--color--grey);}a{background-color: #333;color: #111;}.wp-block-group{padding-top: 12px;padding-bottom: 24px;}.wp-block-group a{color: #111;}h1,h2,h3,h4,h5,h6{color: #123456;}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{background-color: #333;color: #111;font-size: 60px;}.wp-block-post-date{color: #123456;}.wp-block-post-date a{background-color: #777;color: #555;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}', 165 165 $theme_json->get_stylesheet( 'block_styles' ) 166 166 ); 167 $this->assert Equals(167 $this->assertSame( 168 168 'body{--wp--preset--color--grey: grey;}.wp-block-group{--wp--custom--base-font: 16;--wp--custom--line-height--small: 1.2;--wp--custom--line-height--medium: 1.4;--wp--custom--line-height--large: 1.8;}', 169 169 $theme_json->get_stylesheet( 'css_variables' ) … … 192 192 ); 193 193 194 $this->assert Equals(194 $this->assertSame( 195 195 'h1.has-white-color,h2.has-white-color,h3.has-white-color,h4.has-white-color,h5.has-white-color,h6.has-white-color{color: #fff !important;}h1.has-white-background-color,h2.has-white-background-color,h3.has-white-background-color,h4.has-white-background-color,h5.has-white-background-color,h6.has-white-background-color{background-color: #fff !important;}', 196 196 $theme_json->get_stylesheet( 'block_styles' ) … … 228 228 ); 229 229 230 $this->assert Equals(230 $this->assertSame( 231 231 '.wp-block-group{--wp--preset--color--grey: grey;}.wp-block-group{color: red;}.wp-block-group.has-grey-color{color: grey !important;}.wp-block-group.has-grey-background-color{background-color: grey !important;}', 232 232 $theme_json->get_stylesheet() 233 233 ); 234 $this->assert Equals(234 $this->assertSame( 235 235 '.wp-block-group{color: red;}.wp-block-group.has-grey-color{color: grey !important;}.wp-block-group.has-grey-background-color{background-color: grey !important;}', 236 236 $theme_json->get_stylesheet( 'block_styles' ) … … 269 269 ); 270 270 271 $this->assert Equals(271 $this->assertSame( 272 272 'body{--wp--preset--color--grey: grey;}p{background-color: blue;color: red;font-size: 12px;line-height: 1.3;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}', 273 273 $theme_json->get_stylesheet() -
trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php
r51003 r51079 89 89 ); 90 90 91 $this->assert Equals( $expected, $actual );91 $this->assertSame( $expected, $actual ); 92 92 } 93 93
Note: See TracChangeset
for help on using the changeset viewer.