WordPress.org

Make WordPress Core

Changeset 1288 in tests


Ignore:
Timestamp:
05/22/13 17:28:40 (11 months ago)
Author:
ryan
Message:

Test for WP_User::get_data_by( 'id', * ). see #WP23480

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/user.php

    r1245 r1288  
    550550    } 
    551551 
     552    function test_user_get_data_by_id() { 
     553        $user_id   = $this->factory->user->create(); 
     554 
     555        $user = WP_User::get_data_by( 'id', $user_id ); 
     556        $this->assertInstanceOf( 'stdClass', $user ); 
     557        $this->assertEquals( $user_id, $user->ID ); 
     558 
     559        // @ticket 23480 
     560        $user = WP_User::get_data_by( 'id', -1 ); 
     561        $this->assertEquals( false, $user ); 
     562 
     563        $user = WP_User::get_data_by( 'id', 0 ); 
     564        $this->assertEquals( false, $user ); 
     565 
     566        $user = WP_User::get_data_by( 'id', null ); 
     567        $this->assertEquals( false, $user ); 
     568 
     569        $user = WP_User::get_data_by( 'id', '' ); 
     570        $this->assertEquals( false, $user ); 
     571 
     572        $user = WP_User::get_data_by( 'id', false ); 
     573        $this->assertEquals( false, $user ); 
     574 
     575        $user = WP_User::get_data_by( 'id', $user->user_nicename ); 
     576        $this->assertEquals( false, $user ); 
     577 
     578        $user = WP_User::get_data_by( 'id', 99999 ); 
     579        $this->assertEquals( false, $user ); 
     580    } 
     581 
    552582    /** 
    553583     * @ticket 20447 
Note: See TracChangeset for help on using the changeset viewer.