Make WordPress Core

Changeset 54147


Ignore:
Timestamp:
09/13/2022 08:19:17 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/option/option.php

    r54145 r54147  
    4646         * @covers ::delete_option
    4747         */
    48         public function test_default_filter() {
     48        public function test_default_option_filter() {
    4949                $value = 'value';
    5050
    … …  
    8484                $this->assertTrue( $added );
    8585                $this->assertSame( 'bar', get_option( 'doesnotexist' ) );
     86        }
     87
     88        /**
     89         * @ticket 37930
     90         *
     91         * @covers ::get_option
     92         */
     93        public function test_get_option_should_call_pre_option_filter() {
     94                $filter = new MockAction();
     95
     96                add_filter( 'pre_option', array( $filter, 'filter' ) );
     97
     98                get_option( 'ignored' );
     99
     100                $this->assertSame( 1, $filter->get_call_count() );
    86101        }
    87102
    … …  
    298313                );
    299314        }
    300 
    301         /**
    302          * @ticket 37930
    303          *
    304          * @covers ::get_option
    305          */
    306         public function test_filter_pre_option_all_filter_is_called() {
    307                 $filter = new MockAction();
    308 
    309                 add_filter( 'pre_option', array( $filter, 'filter' ) );
    310 
    311                 get_option( 'ignored' );
    312 
    313                 $this->assertSame( 1, $filter->get_call_count() );
    314         }
    315315}
Note: See TracChangeset for help on using the changeset viewer.