WordPress.org

Make WordPress Core

Changeset 44823


Ignore:
Timestamp:
03/08/2019 08:51:32 PM (3 years ago)
Author:
desrosj
Message:

Built/Test Tools: Add missing access modifiers to abstract-testcase.php.

Fixes #46384.
Props andizer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/abstract-testcase.php

    r44785 r44823  
    2424    protected static $ignore_files;
    2525
    26     function __isset( $name ) {
     26    public function __isset( $name ) {
    2727        return 'factory' === $name;
    2828    }
    2929
    30     function __get( $name ) {
     30    public function __get( $name ) {
    3131        if ( 'factory' === $name ) {
    3232            return self::factory();
     
    100100    }
    101101
    102     function setUp() {
     102    public function setUp() {
    103103        set_time_limit( 0 );
    104104
     
    140140     * After a test method runs, reset any state in WordPress the test method might have changed.
    141141     */
    142     function tearDown() {
     142    public function tearDown() {
    143143        global $wpdb, $wp_query, $wp;
    144144        $wpdb->query( 'ROLLBACK' );
     
    166166    }
    167167
    168     function clean_up_global_scope() {
     168    public function clean_up_global_scope() {
    169169        $_GET  = array();
    170170        $_POST = array();
     
    307307    }
    308308
    309     static function flush_cache() {
     309    public static function flush_cache() {
    310310        global $wp_object_cache;
    311311        $wp_object_cache->group_ops      = array();
     
    328328     * @global array $wp_meta_keys
    329329     */
    330     function unregister_all_meta_keys() {
     330    public function unregister_all_meta_keys() {
    331331        global $wp_meta_keys;
    332332        if ( ! is_array( $wp_meta_keys ) ) {
     
    342342    }
    343343
    344     function start_transaction() {
     344    public function start_transaction() {
    345345        global $wpdb;
    346346        $wpdb->query( 'SET autocommit = 0;' );
     
    360360    }
    361361
    362     function _create_temporary_tables( $query ) {
     362    public function _create_temporary_tables( $query ) {
    363363        if ( 'CREATE TABLE' === substr( trim( $query ), 0, 12 ) ) {
    364364            return substr_replace( trim( $query ), 'CREATE TEMPORARY TABLE', 0, 12 );
     
    367367    }
    368368
    369     function _drop_temporary_tables( $query ) {
     369    public function _drop_temporary_tables( $query ) {
    370370        if ( 'DROP TABLE' === substr( trim( $query ), 0, 10 ) ) {
    371371            return substr_replace( trim( $query ), 'DROP TEMPORARY TABLE', 0, 10 );
     
    374374    }
    375375
    376     function get_wp_die_handler( $handler ) {
     376    public function get_wp_die_handler( $handler ) {
    377377        return array( $this, 'wp_die_handler' );
    378378    }
    379379
    380     function wp_die_handler( $message ) {
     380    public function wp_die_handler( $message ) {
    381381        if ( ! is_scalar( $message ) ) {
    382382            $message = '0';
     
    386386    }
    387387
    388     function expectDeprecated() {
     388    public function expectDeprecated() {
    389389        $annotations = $this->getAnnotations();
    390390        foreach ( array( 'class', 'method' ) as $depth ) {
     
    406406    }
    407407
    408     function expectedDeprecated() {
     408    public function expectedDeprecated() {
    409409        $errors = array();
    410410
     
    494494    }
    495495
    496     function deprecated_function_run( $function ) {
     496    public function deprecated_function_run( $function ) {
    497497        if ( ! in_array( $function, $this->caught_deprecated ) ) {
    498498            $this->caught_deprecated[] = $function;
     
    500500    }
    501501
    502     function doing_it_wrong_run( $function ) {
     502    public function doing_it_wrong_run( $function ) {
    503503        if ( ! in_array( $function, $this->caught_doing_it_wrong ) ) {
    504504            $this->caught_doing_it_wrong[] = $function;
     
    506506    }
    507507
    508     function assertWPError( $actual, $message = '' ) {
     508    public function assertWPError( $actual, $message = '' ) {
    509509        $this->assertInstanceOf( 'WP_Error', $actual, $message );
    510510    }
    511511
    512     function assertNotWPError( $actual, $message = '' ) {
     512    public function assertNotWPError( $actual, $message = '' ) {
    513513        if ( is_wp_error( $actual ) && '' === $message ) {
    514514            $message = $actual->get_error_message();
     
    517517    }
    518518
    519     function assertIXRError( $actual, $message = '' ) {
     519    public function assertIXRError( $actual, $message = '' ) {
    520520        $this->assertInstanceOf( 'IXR_Error', $actual, $message );
    521521    }
    522522
    523     function assertNotIXRError( $actual, $message = '' ) {
     523    public function assertNotIXRError( $actual, $message = '' ) {
    524524        if ( $actual instanceof IXR_Error && '' === $message ) {
    525525            $message = $actual->message;
     
    528528    }
    529529
    530     function assertEqualFields( $object, $fields ) {
     530    public function assertEqualFields( $object, $fields ) {
    531531        foreach ( $fields as $field_name => $field_value ) {
    532532            if ( $object->$field_name != $field_value ) {
     
    536536    }
    537537
    538     function assertDiscardWhitespace( $expected, $actual ) {
     538    public function assertDiscardWhitespace( $expected, $actual ) {
    539539        $this->assertEquals( preg_replace( '/\s*/', '', $expected ), preg_replace( '/\s*/', '', $actual ) );
    540540    }
     
    548548     * @param array $actual   Array to check.
    549549     */
    550     function assertEqualSets( $expected, $actual ) {
     550    public function assertEqualSets( $expected, $actual ) {
    551551        sort( $expected );
    552552        sort( $actual );
     
    562562     * @param array $actual   Array to check.
    563563     */
    564     function assertEqualSetsWithIndex( $expected, $actual ) {
     564    public function assertEqualSetsWithIndex( $expected, $actual ) {
    565565        ksort( $expected );
    566566        ksort( $actual );
     
    575575     * @param array $array Array to check.
    576576     */
    577     function assertNonEmptyMultidimensionalArray( $array ) {
     577    public function assertNonEmptyMultidimensionalArray( $array ) {
    578578        $this->assertTrue( is_array( $array ) );
    579579        $this->assertNotEmpty( $array );
     
    598598     * @param string $url The URL for the request.
    599599     */
    600     function go_to( $url ) {
     600    public function go_to( $url ) {
    601601        // note: the WP and WP_Query classes like to silently fetch parameters
    602602        // from all over the place (globals, GET, etc), which makes it tricky
     
    704704     * @param int $ticket_id Ticket number.
    705705     */
    706     function knownWPBug( $ticket_id ) {
     706    public function knownWPBug( $ticket_id ) {
    707707        if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( $ticket_id, self::$forced_tickets ) ) {
    708708            return;
     
    722722     * @param int $ticket_id Ticket number.
    723723     */
    724     function knownUTBug( $ticket_id ) {
     724    public function knownUTBug( $ticket_id ) {
    725725        return;
    726726    }
     
    733733     * @param int $ticket_id Ticket number.
    734734     */
    735     function knownPluginBug( $ticket_id ) {
     735    public function knownPluginBug( $ticket_id ) {
    736736        if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( 'Plugin' . $ticket_id, self::$forced_tickets ) ) {
    737737            return;
     
    763763     * @param Text_Template $template
    764764     */
    765     function prepareTemplate( Text_Template $template ) {
     765    public function prepareTemplate( Text_Template $template ) {
    766766        $template->setVar( array( 'constants' => '' ) );
    767767        $template->setVar( array( 'wp_constants' => PHPUnit_Util_GlobalState::getConstantsAsString() ) );
     
    778778     * @return string|bool Path on success, else false.
    779779     */
    780     function temp_filename() {
     780    public function temp_filename() {
    781781        $tmp_dir = '';
    782782        $dirs    = array( 'TMP', 'TMPDIR', 'TEMP' );
     
    806806     * @param string $prop,... Any number of WP_Query properties that are expected to be true for the current request.
    807807     */
    808     function assertQueryTrue() {
     808    public function assertQueryTrue() {
    809809        global $wp_query;
    810810        $all  = array(
     
    873873     * @param string $file File path.
    874874     */
    875     function unlink( $file ) {
     875    public function unlink( $file ) {
    876876        $exists = is_file( $file );
    877877        if ( $exists && ! in_array( $file, self::$ignore_files ) ) {
     
    890890     * @param string $path Directory path.
    891891     */
    892     function rmdir( $path ) {
     892    public function rmdir( $path ) {
    893893        $files = $this->files_in_dir( $path );
    894894        foreach ( $files as $file ) {
     
    908908     *   called during `tearDown()` in tests, this will only delete files added during the previously run test.
    909909     */
    910     function remove_added_uploads() {
     910    public function remove_added_uploads() {
    911911        $uploads = wp_upload_dir();
    912912        $this->rmdir( $uploads['basedir'] );
     
    922922     * @return array List of file paths.
    923923     */
    924     function files_in_dir( $dir ) {
     924    public function files_in_dir( $dir ) {
    925925        $files = array();
    926926
     
    943943     * @return array List of file paths.
    944944     */
    945     function scan_user_uploads() {
     945    public function scan_user_uploads() {
    946946        static $files = array();
    947947        if ( ! empty( $files ) ) {
     
    961961     * @param string $path Path to the directory to scan.
    962962     */
    963     function delete_folders( $path ) {
     963    public function delete_folders( $path ) {
    964964        $this->matched_dirs = array();
    965965        if ( ! is_dir( $path ) ) {
     
    984984     * @param string $dir Path to the directory to scan.
    985985     */
    986     function scandir( $dir ) {
     986    public function scandir( $dir ) {
    987987        foreach ( scandir( $dir ) as $path ) {
    988988            if ( 0 !== strpos( $path, '.' ) && is_dir( $dir . '/' . $path ) ) {
     
    10511051     * @return int|WP_Error The attachment ID on success. The value 0 or WP_Error on failure.
    10521052     */
    1053     function _make_attachment( $upload, $parent_post_id = 0 ) {
     1053    public function _make_attachment( $upload, $parent_post_id = 0 ) {
    10541054        $type = '';
    10551055        if ( ! empty( $upload['type'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.