| 48 | | } |
| | 48 | |
| | 49 | function test_add_metabox() { |
| | 50 | |
| | 51 | global $wp_meta_boxes; |
| | 52 | |
| | 53 | add_meta_box( 'testbox1', 'Test Metabox', '__return_false', 'post' ); |
| | 54 | |
| | 55 | $this->assertTrue( array_key_exists( 'testbox1', $wp_meta_boxes['post']['advanced']['default'] ) ); |
| | 56 | |
| | 57 | add_meta_box( 'testbox2', 'Test Metabox', '__return_false', array( 'post', 'page' ) ); |
| | 58 | |
| | 59 | $this->assertTrue( array_key_exists( 'testbox2', $wp_meta_boxes['post']['advanced']['default'] ) ); |
| | 60 | $this->assertTrue( array_key_exists( 'testbox2', $wp_meta_boxes['page']['advanced']['default'] ) ); |
| | 61 | } |
| | 62 | |
| | 63 | function test_remove_metabox() { |
| | 64 | |
| | 65 | global $wp_meta_boxes; |
| | 66 | |
| | 67 | // Add some meta boxes to remove |
| | 68 | add_meta_box( 'testbox1', 'Test Metabox', '__return_false', 'post' ); |
| | 69 | |
| | 70 | // Remove one |
| | 71 | remove_meta_box( 'testbox1', 'post', 'advanced' ); |
| | 72 | |
| | 73 | // Check that it was removed properly |
| | 74 | $this->assertFalse( array_key_exists( 'testbox1', $wp_meta_boxes['post']['advanced']['default'] ) ); |
| | 75 | |
| | 76 | } |
| | 77 | |
| | 78 | } |
| | 79 | No newline at end of file |