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/linksAddTarget.php

    r53562 r55562  
    66 */
    77class Tests_Formatting_LinksAddTarget extends WP_UnitTestCase {
     8
     9    /**
     10     * Validate the normalize_whitespace function
     11     *
     12     * @dataProvider data_links_add_target
     13     */
     14    public function test_links_add_target( $content, $target, $tags, $exp_str ) {
     15        if ( true === is_null( $target ) ) {
     16            $this->assertSame( $exp_str, links_add_target( $content ) );
     17        } elseif ( true === is_null( $tags ) ) {
     18            $this->assertSame( $exp_str, links_add_target( $content, $target ) );
     19        } else {
     20            $this->assertSame( $exp_str, links_add_target( $content, $target, $tags ) );
     21        }
     22    }
     23
    824    /**
    925     * Test Content DataProvider
     
    1127     * array ( input_txt, converted_output_txt)
    1228     */
    13     public function get_input_output() {
     29    public function data_links_add_target() {
    1430        return array(
    1531            array(
     
    93109        );
    94110    }
    95 
    96     /**
    97      * Validate the normalize_whitespace function
    98      *
    99      * @dataProvider get_input_output
    100      */
    101     public function test_normalize_whitespace( $content, $target, $tags, $exp_str ) {
    102         if ( true === is_null( $target ) ) {
    103             $this->assertSame( $exp_str, links_add_target( $content ) );
    104         } elseif ( true === is_null( $tags ) ) {
    105             $this->assertSame( $exp_str, links_add_target( $content, $target ) );
    106         } else {
    107             $this->assertSame( $exp_str, links_add_target( $content, $target, $tags ) );
    108         }
    109     }
    110111}
Note: See TracChangeset for help on using the changeset viewer.