Make WordPress Core


Ignore:
Timestamp:
03/19/2023 12:03:30 PM (21 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/formatting/redirect.php

    r53571 r55562  
    1919     * @ticket 44317
    2020     *
    21      * @dataProvider get_bad_status_codes
     21     * @dataProvider data_wp_redirect_bad_status_code
    2222     *
    2323     * @covers ::wp_redirect
     
    3232    }
    3333
    34     public function get_bad_status_codes() {
     34    public function data_wp_redirect_bad_status_code() {
    3535        return array(
    3636            // Tests for bad arguments.
     
    7474
    7575    /**
    76      * @dataProvider valid_url_provider
     76     * @dataProvider data_wp_validate_redirect_valid_url
    7777     *
    7878     * @covers ::wp_validate_redirect
     
    8282    }
    8383
    84     /**
    85      * @dataProvider invalid_url_provider
    86      *
    87      * @covers ::wp_validate_redirect
    88      */
    89     public function test_wp_validate_redirect_invalid_url( $url ) {
    90         $this->assertEquals( false, wp_validate_redirect( $url, false ) );
    91     }
    92 
    93     public function valid_url_provider() {
     84    public function data_wp_validate_redirect_valid_url() {
    9485        return array(
    9586            array( 'http://example.com', 'http://example.com' ),
     
    10798    }
    10899
    109     public function invalid_url_provider() {
     100    /**
     101     * @dataProvider data_wp_validate_redirect_invalid_url
     102     *
     103     * @covers ::wp_validate_redirect
     104     */
     105    public function test_wp_validate_redirect_invalid_url( $url ) {
     106        $this->assertEquals( false, wp_validate_redirect( $url, false ) );
     107    }
     108
     109    public function data_wp_validate_redirect_invalid_url() {
    110110        return array(
    111111            // parse_url() fails.
     
    177177    /**
    178178     * @ticket 47980
    179      * @dataProvider relative_url_provider
     179     * @dataProvider data_wp_validate_redirect_relative_url
    180180     *
    181181     * @covers ::wp_validate_redirect
     
    212212     * }
    213213     */
    214     public function relative_url_provider() {
     214    public function data_wp_validate_redirect_relative_url() {
    215215        return array(
    216216            array(
Note: See TracChangeset for help on using the changeset viewer.