mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-10 23:54:33 +00:00
Add remove_option(), remove_options(), and get_options() methods to WP_Screen, along with unit tests. props ocean90, DrewAPicture. fixes #25799.
git-svn-id: https://develop.svn.wordpress.org/trunk@26456 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -175,6 +175,32 @@ class Tests_Admin_includesScreen extends WP_UnitTestCase {
|
||||
$this->assertEquals( $screen->get_help_tabs(), array() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 25799
|
||||
*/
|
||||
function test_options() {
|
||||
$option = rand_str();
|
||||
$option_args = array(
|
||||
'label' => 'Option',
|
||||
'default' => 10,
|
||||
'option' => $option
|
||||
);
|
||||
|
||||
$screen = get_current_screen();
|
||||
|
||||
$screen->add_option( $option, $option_args );
|
||||
$this->assertEquals( $screen->get_option( $option ), $option_args );
|
||||
|
||||
$options = $screen->get_options();
|
||||
$this->assertArrayHasKey( $option, $options );
|
||||
|
||||
$screen->remove_option( $option );
|
||||
$this->assertNull( $screen->get_option( $option ) );
|
||||
|
||||
$screen->remove_options();
|
||||
$this->assertEquals( $screen->get_options(), array() );
|
||||
}
|
||||
|
||||
function test_in_admin() {
|
||||
$screen = get_current_screen();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user