Make WordPress Core


Ignore:
Timestamp:
05/02/2018 04:20:35 AM (9 years ago)
Author:
SergeyBiryukov
Message:

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

Props TZ-Media, desrosj.
Merges [43055] and [43116] to the 4.9 branch.
See #43547.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/tests/phpunit/tests/user.php

    r41624 r43117  
    2828                        'user_email' => 'blackburn@battlefield3.com',
    2929                        'user_url' => 'http://tacos.com',
    30                         'role' => 'contributor'
     30                        'role' => 'contributor',
     31                        'nickname' => 'Johnny',
     32                        'description' => 'I am a WordPress user that cares about privacy.',
    3133                ) );
    3234
    … …  
    14501452                $this->assertNotContains( ''Test' blog's "name" has <html entities> &', $email->subject, 'Email subject does contains HTML entities' );
    14511453        }
     1454
     1455        /**
     1456         * Testing the `wp_user_personal_data_exporter_no_user` function when no user exists.
     1457         *
     1458         * @ticket 43547
     1459         */
     1460        function test_wp_user_personal_data_exporter_no_user() {
     1461                $actual = wp_user_personal_data_exporter( 'not-a-user-email@test.com' );
     1462
     1463                $expected = array(
     1464                        'data' => array(),
     1465                        'done' => true,
     1466                );
     1467
     1468                $this->assertSame( $expected, $actual );
     1469        }
     1470
     1471        /**
     1472         * Testing the `wp_user_personal_data_exporter_no_user` function when the requested
     1473         * user exists.
     1474         *
     1475         * @ticket 43547
     1476         */
     1477        function test_wp_user_personal_data_exporter() {
     1478                $test_user = new WP_User( self::$contrib_id );
     1479
     1480                $actual = wp_user_personal_data_exporter( $test_user->user_email );
     1481
     1482                $this->assertTrue( $actual['done'] );
     1483
     1484                // Number of exported users.
     1485                $this->assertSame( 1, count( $actual['data'] ) );
     1486
     1487                // Number of exported user properties.
     1488                $this->assertSame( 11, count( $actual['data'][0]['data'] ) );
     1489        }
    14521490}
Note: See TracChangeset for help on using the changeset viewer.