WordPress.org

Make WordPress Core

Changeset 46145


Ignore:
Timestamp:
09/15/2019 11:55:42 AM (2 months ago)
Author:
SergeyBiryukov
Message:

Code Modernisation: Replace call_user_func_array() in tests/phpunit/tests/db.php with dynamic function calls.

Props jrf.
See #47678.

File:
1 edited

Legend:

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

    r45607 r46145  
    423423        global $wpdb;
    424424
    425         // $query is the first argument to be passed to wpdb::prepare()
    426         array_unshift( $args, $query );
    427 
    428         // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
    429         $prepared = @call_user_func_array( array( $wpdb, 'prepare' ), $args );
     425        // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged,WordPress.DB.PreparedSQL
     426        $prepared = @$wpdb->prepare( $query, ...$args );
    430427        $this->assertEquals( $expected, $prepared );
    431428    }
     
    13671364        }
    13681365
    1369         array_unshift( $values, $sql );
    1370 
    1371         $sql = call_user_func_array( array( $wpdb, 'prepare' ), $values );
     1366        // phpcs:ignore WordPress.DB.PreparedSQL
     1367        $sql = $wpdb->prepare( $sql, ...$values );
    13721368        $this->assertEquals( $expected, $sql );
    13731369    }
     
    13871383        }
    13881384
    1389         $sql = call_user_func_array( array( $wpdb, 'prepare' ), array( $sql, $values ) );
     1385        // phpcs:ignore WordPress.DB.PreparedSQL
     1386        $sql = $wpdb->prepare( $sql, $values );
    13901387        $this->assertEquals( $expected, $sql );
    13911388    }
Note: See TracChangeset for help on using the changeset viewer.