mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Tests: Rename the test for pre_option filter to match the filter name.
Move the method to a more appropriate place, next to the test for `default_option_*` filter. Follow-up to [54145]. See #37930. git-svn-id: https://develop.svn.wordpress.org/trunk@54147 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -45,7 +45,7 @@ class Tests_Option_Option extends WP_UnitTestCase {
|
||||
* @covers ::add_option
|
||||
* @covers ::delete_option
|
||||
*/
|
||||
public function test_default_filter() {
|
||||
public function test_default_option_filter() {
|
||||
$value = 'value';
|
||||
|
||||
$this->assertFalse( get_option( 'doesnotexist' ) );
|
||||
@@ -85,6 +85,21 @@ class Tests_Option_Option extends WP_UnitTestCase {
|
||||
$this->assertSame( 'bar', get_option( 'doesnotexist' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 37930
|
||||
*
|
||||
* @covers ::get_option
|
||||
*/
|
||||
public function test_get_option_should_call_pre_option_filter() {
|
||||
$filter = new MockAction();
|
||||
|
||||
add_filter( 'pre_option', array( $filter, 'filter' ) );
|
||||
|
||||
get_option( 'ignored' );
|
||||
|
||||
$this->assertSame( 1, $filter->get_call_count() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::get_option
|
||||
* @covers ::add_option
|
||||
@@ -297,19 +312,4 @@ class Tests_Option_Option extends WP_UnitTestCase {
|
||||
array( 'autoload_false', false, 'no' ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 37930
|
||||
*
|
||||
* @covers ::get_option
|
||||
*/
|
||||
public function test_filter_pre_option_all_filter_is_called() {
|
||||
$filter = new MockAction();
|
||||
|
||||
add_filter( 'pre_option', array( $filter, 'filter' ) );
|
||||
|
||||
get_option( 'ignored' );
|
||||
|
||||
$this->assertSame( 1, $filter->get_call_count() );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user