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

    r45588 r45607  
    8282        foreach ( $user_list as $user ) {
    8383            // only include the users we just created - there might be some others that existed previously
    84             if ( in_array( $user->ID, $nusers ) ) {
     84            if ( in_array( $user->ID, $nusers, true ) ) {
    8585                $found[] = $user->ID;
    8686            }
     
    162162        // so we'll just check to make sure our values are included somewhere.
    163163        foreach ( $vals as $k => $v ) {
    164             $this->assertTrue( isset( $out[ $k ] ) && $out[ $k ][0] == $v );
     164            $this->assertTrue( isset( $out[ $k ] ) && $out[ $k ][0] === $v );
    165165        }
    166166        // delete one key and check again
     
    171171        // make sure that key is excluded from the results
    172172        foreach ( $vals as $k => $v ) {
    173             if ( $k == $key_to_delete ) {
     173            if ( $k === $key_to_delete ) {
    174174                $this->assertFalse( isset( $out[ $k ] ) );
    175175            } else {
    176                 $this->assertTrue( isset( $out[ $k ] ) && $out[ $k ][0] == $v );
     176                $this->assertTrue( isset( $out[ $k ] ) && $out[ $k ][0] === $v );
    177177            }
    178178        }
     
    600600        }
    601601
    602         @update_user_meta( $id2, 'key', 'value' );
     602        update_user_meta( $id2, 'key', 'value' );
    603603
    604604        $metas = array_keys( get_user_meta( 1 ) );
     
    10231023        );
    10241024
    1025         $this->assertTrue( in_array( self::$contrib_id, $users ) );
     1025        $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
    10261026    }
    10271027
     
    10341034        );
    10351035
    1036         $this->assertTrue( in_array( self::$contrib_id, $users ) );
     1036        $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
    10371037    }
    10381038
     
    10451045        );
    10461046
    1047         $this->assertTrue( in_array( self::$contrib_id, $users ) );
     1047        $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
    10481048    }
    10491049
     
    10561056        );
    10571057
    1058         $this->assertTrue( in_array( self::$contrib_id, $users ) );
     1058        $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
    10591059    }
    10601060
     
    10671067        );
    10681068
    1069         $this->assertTrue( in_array( self::$contrib_id, $users ) );
     1069        $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
    10701070    }
    10711071
     
    12021202         */
    12031203        if ( ! empty( $GLOBALS['phpmailer']->mock_sent ) ) {
    1204             $was_admin_email_sent = ( isset( $GLOBALS['phpmailer']->mock_sent[0] ) && WP_TESTS_EMAIL == $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] );
    1205             $was_user_email_sent  = ( isset( $GLOBALS['phpmailer']->mock_sent[1] ) && 'blackburn@battlefield3.com' == $GLOBALS['phpmailer']->mock_sent[1]['to'][0][0] );
     1204            $was_admin_email_sent = ( isset( $GLOBALS['phpmailer']->mock_sent[0] ) && WP_TESTS_EMAIL === $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] );
     1205            $was_user_email_sent  = ( isset( $GLOBALS['phpmailer']->mock_sent[1] ) && 'blackburn@battlefield3.com' === $GLOBALS['phpmailer']->mock_sent[1]['to'][0][0] );
    12061206        }
    12071207
     
    12271227         */
    12281228        if ( ! empty( $GLOBALS['phpmailer']->mock_sent ) ) {
    1229             $was_admin_email_sent = ( isset( $GLOBALS['phpmailer']->mock_sent[0] ) && WP_TESTS_EMAIL == $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] );
    1230             $was_user_email_sent  = ( isset( $GLOBALS['phpmailer']->mock_sent[1] ) && 'blackburn@battlefield3.com' == $GLOBALS['phpmailer']->mock_sent[1]['to'][0][0] );
     1229            $was_admin_email_sent = ( isset( $GLOBALS['phpmailer']->mock_sent[0] ) && WP_TESTS_EMAIL === $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] );
     1230            $was_user_email_sent  = ( isset( $GLOBALS['phpmailer']->mock_sent[1] ) && 'blackburn@battlefield3.com' === $GLOBALS['phpmailer']->mock_sent[1]['to'][0][0] );
    12311231        }
    12321232
     
    14661466
    14671467        if ( ! empty( $GLOBALS['phpmailer']->mock_sent ) ) {
    1468             $was_confirmation_email_sent = ( isset( $GLOBALS['phpmailer']->mock_sent[0] ) && 'after@example.com' == $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] );
     1468            $was_confirmation_email_sent = ( isset( $GLOBALS['phpmailer']->mock_sent[0] ) && 'after@example.com' === $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] );
    14691469        }
    14701470
     
    15031503
    15041504        if ( ! empty( $GLOBALS['phpmailer']->mock_sent ) ) {
    1505             $was_confirmation_email_sent = ( isset( $GLOBALS['phpmailer']->mock_sent[0] ) && 'after@example.com' == $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] );
     1505            $was_confirmation_email_sent = ( isset( $GLOBALS['phpmailer']->mock_sent[0] ) && 'after@example.com' === $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0] );
    15061506        }
    15071507
Note: See TracChangeset for help on using the changeset viewer.