WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/01/2018 01:58:02 PM (2 years ago)
Author:
azaozz
Message:

Privacy: add user information to the personal data export file.

Props TZ-Media, desrosj.
See #43547.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user.php

    r42855 r43055  
    3030                'user_url'      => 'http://tacos.com',
    3131                'role'          => 'contributor',
     32                'nickname'      => 'Johnny',
     33                'description'   => 'I am a WordPress user that cares about privacy.',
    3234            )
    3335        );
     
    15811583        $this->assertSame( array( 'administrator' ), get_userdata( $editor )->roles );
    15821584    }
     1585
     1586    /**
     1587     * Testing the `wp_user_personal_data_exporter_no_user` function when no user exists.
     1588     *
     1589     * @ticket 43547
     1590     */
     1591    function test_wp_user_personal_data_exporter_no_user() {
     1592        $actual = wp_user_personal_data_exporter( 'not-a-user-email@test.com' );
     1593
     1594        $expected = array(
     1595            'data' => array(),
     1596            'done' => true,
     1597        );
     1598
     1599        $this->assertSame( $expected, $actual );
     1600    }
     1601
     1602    /**
     1603     * Testing the `wp_user_personal_data_exporter_no_user` function when the requested
     1604     * user exists.
     1605     *
     1606     * @ticket 43547
     1607     */
     1608    function test_wp_user_personal_data_exporter() {
     1609        $test_user = new WP_User( self::$contrib_id );
     1610
     1611        $actual = wp_user_personal_data_exporter( $test_user->user_email );
     1612
     1613        $this->assertTrue( $actual['done'] );
     1614
     1615        // Number of exported users.
     1616        $this->assertSame( 1, count( $actual['data'] ) );
     1617
     1618        // Number of exported user properties.
     1619        $this->assertSame( 12, count( $actual['data'][0]['data'] ) );
     1620    }
    15831621}
Note: See TracChangeset for help on using the changeset viewer.