WordPress.org

Make WordPress Core

Changeset 390 in tests


Ignore:
Timestamp:
08/03/11 22:25:23 (3 years ago)
Author:
ryan
Message:

User property tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_user.php

    r366 r390  
    168168        $this->assertEquals(strip_ws($expected), strip_ws($out)); 
    169169    } 
     170 
     171    // Test property magic functions for property get/set/isset. 
     172    function test_user_properties() { 
     173        $user = new WP_User( 1 ); 
     174        foreach ( $user->data as $key => $data ) { 
     175            $this->assertEquals( $data, $user->$key ); 
     176        } 
     177 
     178        $this->assertTrue( isset( $user->$key ) ); 
     179        $this->assertFalse( isset( $user->fooooooooo ) ); 
     180 
     181        $user->$key = 'foo'; 
     182        $this->assertEquals( 'foo', $user->$key ); 
     183        $this->assertEquals( 'foo', $user->data->$key );  // This will fail with WP < 3.3 
     184    } 
    170185} 
    171186 
Note: See TracChangeset for help on using the changeset viewer.