Make WordPress Core


Ignore:
Timestamp:
03/19/2023 12:03:30 PM (19 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use the data_ prefix for various data provider methods.

This aims to bring more consistency to the test suite, as the vast majority of data providers already use that prefix.

Includes moving some data providers next to the tests they are used in.

Follow-up to [55464].

See #57841.

File:
1 edited

Legend:

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

    r54229 r55562  
    77
    88    /**
     9     * @dataProvider data_sanitize_option
     10     *
     11     * @covers ::sanitize_option
     12     */
     13    public function test_sanitize_option( $option_name, $sanitized, $original ) {
     14        $this->assertSame( $sanitized, sanitize_option( $option_name, $original ) );
     15    }
     16    /**
    917     * Data provider to test all of the sanitize_option() case
    1018     *
     
    1321     * @return array
    1422     */
    15     public function sanitize_option_provider() {
     23    public function data_sanitize_option() {
    1624        return array(
    1725            array( 'admin_email', 'mail@example.com', 'mail@example.com' ),
     
    8795
    8896    /**
    89      * @dataProvider sanitize_option_provider
     97     * @dataProvider data_sanitize_option_upload_path
    9098     *
    9199     * @covers ::sanitize_option
    92100     */
    93     public function test_sanitize_option( $option_name, $sanitized, $original ) {
    94         $this->assertSame( $sanitized, sanitize_option( $option_name, $original ) );
     101    public function test_sanitize_option_upload_path( $provided, $expected ) {
     102        $this->assertSame( $expected, sanitize_option( 'upload_path', $provided ) );
    95103    }
    96104
    97     public function upload_path_provider() {
     105    public function data_sanitize_option_upload_path() {
    98106        return array(
    99107            array( '<a href="http://www.example.com">Link</a>', 'Link' ),
     
    102110            array( '\path\to\things', '\path\to\things' ),
    103111        );
    104     }
    105 
    106     /**
    107      * @dataProvider upload_path_provider
    108      *
    109      * @covers ::sanitize_option
    110      */
    111     public function test_sanitize_option_upload_path( $provided, $expected ) {
    112         $this->assertSame( $expected, sanitize_option( 'upload_path', $provided ) );
    113112    }
    114113
     
    134133
    135134    /**
    136      * @dataProvider permalink_structure_provider
     135     * @dataProvider data_sanitize_option_permalink_structure
    137136     *
    138137     * @covers ::sanitize_option
    139138     * @covers ::get_settings_errors
    140139     */
    141     public function test_sanitize_permalink_structure( $provided, $expected, $valid ) {
     140    public function test_sanitize_option_permalink_structure( $provided, $expected, $valid ) {
    142141        global $wp_settings_errors;
    143142
     
    160159    }
    161160
    162     public function permalink_structure_provider() {
     161    public function data_sanitize_option_permalink_structure() {
    163162        return array(
    164163            array( '', '', true ),
Note: See TracChangeset for help on using the changeset viewer.