Make WordPress Core

Changeset 25394


Ignore:
Timestamp:
09/12/2013 06:41:36 AM (11 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.

Location:
trunk/tests/phpunit/tests/xmlrpc/wp
Files:
2 edited

Legend:

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

    r25002 r25394  
    4040        $this->assertEquals( $editor_id, $result['user_id'] );
    4141
    42         $expected_fields = array_merge( array( 'user_id' ), $fields );
    43         $this->assertEquals( sort( $expected_fields ), sort( array_keys( $result ) ) );
     42        $expected_fields = array( 'user_id', 'email', 'bio' );
     43        $keys = array_keys( $result );
     44        sort( $expected_fields );
     45        sort( $keys );
     46        $this->assertEqualSets( $expected_fields, $keys );
    4447    }
    4548}
  • 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.