Make WordPress Core


Ignore:
Timestamp:
07/08/2019 12:55:20 AM (6 years ago)
Author:
pento
Message:

Coding Standards: Fix the remaining issues in /tests.

All PHP files in /tests now conform to the PHP coding standards, or have exceptions appropriately marked.

Travis now also runs phpcs on the /tests directory, any future changes to these files must conform entirely to the WordPress PHP coding standards. 🎉

See #47632.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/utils.php

    r45580 r45607  
    153153            $count = 0;
    154154            foreach ( $this->events as $e ) {
    155                 if ( $e['action'] == $tag ) {
     155                if ( $e['action'] === $tag ) {
    156156                    ++$count;
    157157                }
     
    223223
    224224    function data_handler( $parser, $data ) {
    225         $index                             = count( $this->data ) - 1;
    226         @$this->data[ $index ]['content'] .= $data;
     225        $index = count( $this->data ) - 1;
     226
     227        if ( ! isset( $this->data[ $index ]['content'] ) ) {
     228            $this->data[ $index ]['content'] = '';
     229        }
     230        $this->data[ $index ]['content'] .= $data;
    227231    }
    228232
     
    254258        #       echo "checking '{$tree[$i][name]}' == '{$a[0]}'\n";
    255259        #       var_dump($tree[$i]['name'], $a[0]);
    256         if ( $tree[ $i ]['name'] == $a[0] ) {
     260        if ( $tree[ $i ]['name'] === $a[0] ) {
    257261            #           echo "n == {$n}\n";
    258             if ( $n == 1 ) {
     262            if ( 1 === $n ) {
    259263                $out[] = $tree[ $i ];
    260264            } else {
     
    349353    $tables = $wpdb->get_col( 'SHOW TABLES;' );
    350354    foreach ( $tables as $table ) {
     355        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    351356        $wpdb->query( "DROP TABLE IF EXISTS {$table}" );
    352357    }
     
    439444 * Special class for exposing protected wpdb methods we need to access
    440445 */
    441 class wpdb_exposed_methods_for_testing extends wpdb {
     446class WpdbExposedMethodsForTesting extends wpdb {
    442447    public function __construct() {
    443448        global $wpdb;
Note: See TracChangeset for help on using the changeset viewer.