WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/12/2013 06:41:36 AM (8 years ago)
Author:
wonderboymusic
Message:
  • sort() returns a boolean, not a sorted set. Move the calls out of the assertions and fix the test methods.
  • Fix instances where Only variables should be passed by reference was being triggered by assigning array_keys() return value to a var

See #25282.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/xmlrpc/wp/getUser.php

    r25002 r25394  
    127127
    128128        $expected_fields = array( 'user_id', 'username', 'email', 'registered', 'display_name', 'nicename' );
    129         $this->assertEquals( sort( $expected_fields ), sort( array_keys( $result ) ) );
     129        $keys = array_keys( $result );
     130        sort( $expected_fields );
     131        sort( $keys );
     132        $this->assertEqualSets( $expected_fields, $keys );
    130133    }
    131134
     
    139142        $this->assertEquals( $editor_id, $result['user_id'] );
    140143
    141         $expected_fields = array_merge( array( 'user_id' ), $fields );
    142         $this->assertEquals( sort( $expected_fields ), sort( array_keys( $result ) ) );
     144        $expected_fields = array( 'user_id', 'email', 'bio' );
     145        $keys = array_keys( $result );
     146        sort( $expected_fields );
     147        sort( $keys );
     148        $this->assertEqualSets( $expected_fields, $keys );
    143149    }
    144150}
Note: See TracChangeset for help on using the changeset viewer.