Make WordPress Core


Ignore:
Timestamp:
06/13/2022 03:24:11 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Rename classes in phpunit/tests/option/ per the naming conventions.

https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646], [51650], [51651], [51860], [52264], [52265], [53489].

See #55652.

File:
1 edited

Legend:

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

    r52010 r53494  
    225225    }
    226226
     227    /**
     228     * Options should be autoloaded unless they were added with "no" or `false`.
     229     *
     230     * @ticket 31119
     231     * @dataProvider data_option_autoloading
     232     */
     233    public function test_option_autoloading( $name, $autoload_value, $expected ) {
     234        global $wpdb;
     235        $added = add_option( $name, 'Autoload test', '', $autoload_value );
     236        $this->assertTrue( $added );
     237
     238        $actual = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s LIMIT 1", $name ) );
     239        $this->assertSame( $expected, $actual->autoload );
     240    }
     241
     242    /**
     243     * Data provider.
     244     *
     245     * @return array
     246     */
    227247    public function data_option_autoloading() {
    228248        return array(
     
    236256        );
    237257    }
    238     /**
    239      * Options should be autoloaded unless they were added with "no" or `false`.
    240      *
    241      * @ticket 31119
    242      * @dataProvider data_option_autoloading
    243      */
    244     public function test_option_autoloading( $name, $autoload_value, $expected ) {
    245         global $wpdb;
    246         $added = add_option( $name, 'Autoload test', '', $autoload_value );
    247         $this->assertTrue( $added );
    248 
    249         $actual = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s LIMIT 1", $name ) );
    250         $this->assertSame( $expected, $actual->autoload );
    251     }
    252258}
Note: See TracChangeset for help on using the changeset viewer.