Changeset 34951 for trunk/tests/phpunit/tests/admin/includesTemplate.php
- Timestamp:
- 10/08/2015 07:06:32 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesTemplate.php
r25002 r34951 46 46 $this->assertEquals('', checked(0,false,false)); 47 47 } 48 49 public function test_add_meta_box() { 50 global $wp_meta_boxes; 51 52 add_meta_box( 'testbox1', 'Test Metabox', '__return_false', 'post' ); 53 54 $this->assertArrayHasKey( 'testbox1', $wp_meta_boxes['post']['advanced']['default'] ); 55 } 56 57 public function test_remove_meta_box() { 58 global $wp_meta_boxes; 59 60 // Add a meta boxes to remove. 61 add_meta_box( 'testbox1', 'Test Metabox', '__return_false', $current_screen = 'post' ); 62 63 // Confirm it's there. 64 $this->assertArrayHasKey( 'testbox1', $wp_meta_boxes[ $current_screen ]['advanced']['default'] ); 65 66 // Remove the meta box. 67 remove_meta_box( 'testbox1', $current_screen, 'advanced' ); 68 69 // Check that it was removed properly (The meta box should be set to false once that it has been removed) 70 $this->assertFalse( $wp_meta_boxes[ $current_screen ]['advanced']['default']['testbox1'] ); 71 } 72 73 /** 74 * @ticket 15000 75 */ 76 public function test_add_meta_box_on_multiple_screens() { 77 global $wp_meta_boxes; 78 79 // Add a meta box to three different post types 80 add_meta_box( 'testbox1', 'Test Metabox', '__return_false', array( 'post', 'comment', 'attachment' ) ); 81 82 $this->assertArrayHasKey( 'testbox1', $wp_meta_boxes['post']['advanced']['default'] ); 83 $this->assertArrayHasKey( 'testbox1', $wp_meta_boxes['comment']['advanced']['default'] ); 84 $this->assertArrayHasKey( 'testbox1', $wp_meta_boxes['attachment']['advanced']['default'] ); 85 } 86 87 /** 88 * @ticket 15000 89 */ 90 public function test_remove_meta_box_from_multiple_screens() { 91 global $wp_meta_boxes; 92 93 // Add a meta box to three different screens. 94 add_meta_box( 'testbox1', 'Test Metabox', '__return_false', array( 'post', 'comment', 'attachment' ) ); 95 96 // Remove meta box from posts. 97 remove_meta_box( 'testbox1', 'post', 'advanced' ); 98 99 // Check that we have removed the meta boxes only from posts 100 $this->assertFalse( $wp_meta_boxes['post']['advanced']['default']['testbox1'] ); 101 $this->assertArrayHasKey( 'testbox1', $wp_meta_boxes['comment']['advanced']['default'] ); 102 $this->assertArrayHasKey( 'testbox1', $wp_meta_boxes['attachment']['advanced']['default'] ); 103 104 // Remove the meta box from the other screens. 105 remove_meta_box( 'testbox1', array( 'comment', 'attachment' ), 'advanced' ); 106 107 $this->assertFalse( $wp_meta_boxes['comment']['advanced']['default']['testbox1'] ); 108 $this->assertFalse( $wp_meta_boxes['attachment']['advanced']['default']['testbox1'] ); 109 } 110 48 111 }
Note: See TracChangeset
for help on using the changeset viewer.