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/tests/dbdelta.php

    r43571 r45607  
    3434        // Forcing MyISAM, because InnoDB only started supporting FULLTEXT indexes in MySQL 5.7.
    3535        $wpdb->query(
    36             "
    37             CREATE TABLE {$wpdb->prefix}dbdelta_test (
    38                 id bigint(20) NOT NULL AUTO_INCREMENT,
    39                 column_1 varchar(255) NOT NULL,
    40                 column_2 text,
    41                 column_3 blob,
    42                 PRIMARY KEY  (id),
    43                 KEY key_1 (column_1($this->max_index_length)),
    44                 KEY compound_key (id,column_1($this->max_index_length)),
    45                 FULLTEXT KEY fulltext_key (column_1)
    46             ) ENGINE=MyISAM
    47             "
     36            $wpdb->prepare(
     37                "
     38                CREATE TABLE {$wpdb->prefix}dbdelta_test (
     39                    id bigint(20) NOT NULL AUTO_INCREMENT,
     40                    column_1 varchar(255) NOT NULL,
     41                    column_2 text,
     42                    column_3 blob,
     43                    PRIMARY KEY  (id),
     44                    KEY key_1 (column_1(%d)),
     45                    KEY compound_key (id,column_1(%d)),
     46                    FULLTEXT KEY fulltext_key (column_1)
     47                ) ENGINE=MyISAM
     48                ",
     49                $this->max_index_length,
     50                $this->max_index_length
     51            )
    4852        );
    4953
     
    300304        global $wpdb;
    301305
     306        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    302307        $table_row = $wpdb->get_row( "select $column from {$table} where $column = '$value'" );
    303308
     
    318323        global $wpdb;
    319324
    320         $table_fields = $wpdb->get_results( "DESCRIBE {$table}" );
     325        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
     326        $table_fields = $wpdb->get_results( "DESCRIBE $table" );
    321327
    322328        $this->assertCount( 1, wp_list_filter( $table_fields, array( 'Field' => $column ) ) );
     
    334340        global $wpdb;
    335341
    336         $table_indices = $wpdb->get_results( "SHOW INDEX FROM {$table}" );
     342        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
     343        $table_indices = $wpdb->get_results( "SHOW INDEX FROM $table" );
    337344
    338345        $this->assertCount(
     
    359366        global $wpdb;
    360367
    361         $table_fields = $wpdb->get_results( "DESCRIBE {$table}" );
     368        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
     369        $table_fields = $wpdb->get_results( "DESCRIBE $table" );
    362370
    363371        $this->assertCount( 0, wp_list_filter( $table_fields, array( 'Field' => $column ) ) );
     
    386394            ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC";
    387395
     396        // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
    388397        $wpdb->query( $create );
    389398
     399        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    390400        $index = $wpdb->get_row( "SHOW INDEXES FROM $table_name WHERE Key_name='a_key';" );
    391401
    392402        $actual = dbDelta( $create, false );
    393403
     404        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    394405        $wpdb->query( "DROP TABLE IF EXISTS $table_name;" );
    395406
    396         if ( 191 != $index->Sub_part ) {
     407        if ( 191 !== $index->Sub_part ) {
    397408            $this->markTestSkipped( 'This test requires the index to be truncated.' );
    398409        }
     
    528539        ";
    529540
     541        // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
    530542        $wpdb->query( $schema );
    531543
     
    557569            ";
    558570
     571        // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
    559572        $wpdb->query( $schema );
    560573
     
    603616        ";
    604617
     618        // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
    605619        $wpdb->query( $schema );
    606620
     
    9991013        ";
    10001014
     1015        // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
    10011016        $wpdb->query( $schema );
    10021017
Note: See TracChangeset for help on using the changeset viewer.