From 5225a99b9d075fd109ee6ba53cc072c704c8623c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 13 Sep 2022 20:19:17 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/option/option.php | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/phpunit/tests/option/option.php b/tests/phpunit/tests/option/option.php index 656fe086a9..d510528e07 100644 --- a/tests/phpunit/tests/option/option.php +++ b/tests/phpunit/tests/option/option.php @@ -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() ); - } }