Make WordPress Core

Ticket #15000: 15000-tests.diff

File 15000-tests.diff, 1.3 KB (added by mordauk, 11 years ago)
  • tests/phpunit/tests/admin/includesTemplate.php

     
    4545                $this->assertEquals('', selected(0,false,false));
    4646                $this->assertEquals('', checked(0,false,false));
    4747        }
    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