Changeset 42343 for trunk/tests/phpunit/tests/adminbar.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/adminbar.php
r40581 r42343 54 54 $admin_bar = new WP_Admin_Bar; 55 55 56 $admin_bar->add_node( array( 57 'id' => 'test-node', 58 'meta' => array( 'class' => 'test-class' ), 59 ) ); 56 $admin_bar->add_node( 57 array( 58 'id' => 'test-node', 59 'meta' => array( 'class' => 'test-class' ), 60 ) 61 ); 60 62 61 63 $node1 = $admin_bar->get_node( 'test-node' ); 62 64 $this->assertEquals( array( 'class' => 'test-class' ), $node1->meta ); 63 65 64 $admin_bar->add_node( array( 65 'id' => 'test-node', 66 'meta' => array( 'some-meta' => 'value' ), 67 ) ); 66 $admin_bar->add_node( 67 array( 68 'id' => 'test-node', 69 'meta' => array( 'some-meta' => 'value' ), 70 ) 71 ); 68 72 69 73 $node2 = $admin_bar->get_node( 'test-node' ); 70 $this->assertEquals( array( 'class' => 'test-class', 'some-meta' => 'value' ), $node2->meta ); 74 $this->assertEquals( 75 array( 76 'class' => 'test-class', 77 'some-meta' => 'value', 78 ), $node2->meta 79 ); 71 80 } 72 81 … … 129 138 */ 130 139 public function test_admin_bar_contains_correct_links_for_users_with_no_role_on_blog() { 131 $blog_id = self::factory()->blog->create( array( 132 'user_id' => self::$admin_id, 133 ) ); 140 $blog_id = self::factory()->blog->create( 141 array( 142 'user_id' => self::$admin_id, 143 ) 144 ); 134 145 135 146 $this->assertTrue( user_can( self::$admin_id, 'read' ) ); … … 179 190 $this->assertFalse( user_can( self::$no_role_id, 'read' ) ); 180 191 181 $blog_id = self::factory()->blog->create( array( 182 'user_id' => self::$admin_id, 183 ) ); 192 $blog_id = self::factory()->blog->create( 193 array( 194 'user_id' => self::$admin_id, 195 ) 196 ); 184 197 185 198 $this->assertTrue( is_user_member_of_blog( self::$admin_id, $blog_id ) ); … … 273 286 // Empty string. 274 287 array( 275 'id' => 'test-node',288 'id' => 'test-node', 276 289 'meta' => array( 'tabindex' => '' ), 277 290 ), … … 336 349 337 350 $post = array( 338 'post_author' => self::$editor_id,339 'post_status' => 'publish',351 'post_author' => self::$editor_id, 352 'post_status' => 'publish', 340 353 'post_content' => 'Post Content', 341 'post_title' => 'Post Title',342 ); 343 $id = wp_insert_post( $post );354 'post_title' => 'Post Title', 355 ); 356 $id = wp_insert_post( $post ); 344 357 345 358 // Set queried object to the newly created post. 346 359 global $wp_the_query; 347 $wp_the_query->queried_object = (object) array( 'ID' => $id, 'post_type' => 'post' ); 360 $wp_the_query->queried_object = (object) array( 361 'ID' => $id, 362 'post_type' => 'post', 363 ); 348 364 349 365 $wp_admin_bar = $this->get_standard_admin_bar(); … … 361 377 // Set queried object to a non-existing post. 362 378 global $wp_the_query; 363 $wp_the_query->queried_object = (object) array( 'ID' => 0, 'post_type' => 'post' ); 379 $wp_the_query->queried_object = (object) array( 380 'ID' => 0, 381 'post_type' => 'post', 382 ); 364 383 365 384 $wp_admin_bar = $this->get_standard_admin_bar(); … … 472 491 */ 473 492 public function test_admin_bar_has_no_archives_link_for_non_public_cpt() { 474 register_post_type( 'foo-non-public', array( 475 'public' => false, 476 'has_archive' => true, 477 'show_in_admin_bar' => true, 478 ) ); 493 register_post_type( 494 'foo-non-public', array( 495 'public' => false, 496 'has_archive' => true, 497 'show_in_admin_bar' => true, 498 ) 499 ); 479 500 480 501 set_current_screen( 'edit-foo-non-public' ); … … 493 514 */ 494 515 public function test_admin_bar_has_no_archives_link_for_cpt_without_archive() { 495 register_post_type( 'foo-non-public', array( 496 'public' => true, 497 'has_archive' => false, 498 'show_in_admin_bar' => true, 499 ) ); 516 register_post_type( 517 'foo-non-public', array( 518 'public' => true, 519 'has_archive' => false, 520 'show_in_admin_bar' => true, 521 ) 522 ); 500 523 501 524 set_current_screen( 'edit-foo-non-public' ); … … 514 537 */ 515 538 public function test_admin_bar_has_no_archives_link_for_cpt_not_shown_in_admin_bar() { 516 register_post_type( 'foo-non-public', array( 517 'public' => true, 518 'has_archive' => true, 519 'show_in_admin_bar' => false, 520 ) ); 539 register_post_type( 540 'foo-non-public', array( 541 'public' => true, 542 'has_archive' => true, 543 'show_in_admin_bar' => false, 544 ) 545 ); 521 546 522 547 set_current_screen( 'edit-foo-non-public' ); … … 634 659 wp_set_current_user( self::$admin_id ); 635 660 636 $this->factory()->post->create( array( 637 'post_type' => 'customize_changeset', 638 'post_status' => 'auto-draft', 639 'post_name' => $uuid, 640 ) ); 641 $wp_customize = new WP_Customize_Manager( array( 642 'changeset_uuid' => $uuid, 643 ) ); 661 $this->factory()->post->create( 662 array( 663 'post_type' => 'customize_changeset', 664 'post_status' => 'auto-draft', 665 'post_name' => $uuid, 666 ) 667 ); 668 $wp_customize = new WP_Customize_Manager( 669 array( 670 'changeset_uuid' => $uuid, 671 ) 672 ); 644 673 $wp_customize->start_previewing_theme(); 645 674 646 675 set_current_screen( 'front' ); 647 676 $wp_admin_bar = $this->get_standard_admin_bar(); 648 $node = $wp_admin_bar->get_node( 'customize' );677 $node = $wp_admin_bar->get_node( 'customize' ); 649 678 $this->assertNotEmpty( $node ); 650 679 651 $parsed_url = wp_parse_url( $node->href );680 $parsed_url = wp_parse_url( $node->href ); 652 681 $query_params = array(); 653 682 wp_parse_str( $parsed_url['query'], $query_params );
Note: See TracChangeset
for help on using the changeset viewer.