Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
56df70d
wp-admin/includes/privacy-tools.php: Fix a PHP 8.0 fatal "Parameter #…
xknown Nov 9, 2020
c44e87a
Sends json error when '_export_data_grouped' exists but not array.
hellofromtonya Nov 29, 2020
2ac2209
Removes extra fix to keep this PR focused on one function.
hellofromtonya Nov 29, 2020
f8edbcc
Merge branch 'master' into fix/php8.0/51423-wp-admin/includes/privacy…
hellofromtonya Nov 29, 2020
a1185ff
Adds tests for array_merge warning json error.
hellofromtonya Nov 29, 2020
79ac839
Abstracts setup for export contents to make it easier to add tests.
hellofromtonya Nov 29, 2020
901ff24
Adds tests to validate groups json behavior.
hellofromtonya Nov 29, 2020
00e73a0
Adds tests for json export to validate export data grouped.
hellofromtonya Nov 29, 2020
8ab0d23
Merge branch 'master' into fix/php8.0/51423-wp-admin/includes/privacy…
hellofromtonya Feb 5, 2021
324af66
Adds _doing_it_wrong when meta value exists but is not an array.
Mar 18, 2021
2f242e1
Updates the tests.
Mar 18, 2021
5baeff0
Fixes test naming.
Mar 18, 2021
ef28395
Fixes closing ) placement for __().
Mar 19, 2021
11551b8
Cast to array when not an array.
Mar 19, 2021
ae22009
Skip array_merge when not an array.
Mar 19, 2021
3a9db91
Make json contents test more robust.
Mar 19, 2021
47f7ba0
Remove extra fix (new PR).
Mar 22, 2021
2483915
Sets vars to match current values to ensure same report output results.
Mar 22, 2021
44d9507
Fixes tests.
Mar 22, 2021
11361ca
Adds more test data for invalid type.
Mar 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds tests for array_merge warning json error.
  • Loading branch information
hellofromtonya committed Nov 29, 2020
commit a1185ff1a0074e6b5ae39b43af3392c6c5a2d4d7
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,87 @@ public function test_detect_cannot_create_folder() {
wp_privacy_generate_personal_data_export_file( self::$export_request_id );
}

/**
* @dataProvider data_invalid_export_data_grouped_type_error
*
* @ticket 51423
*
* @param mixed $groups '_export_data_grouped' post meta value.
* @param string $type Expected groups data type.
*/
public function test_invalid_export_data_grouped_type_error( $groups, $type ) {
update_post_meta( self::$export_request_id, '_export_data_grouped', $groups );

$this->expectException( 'WPDieException' );
$this->expectOutputString( '{"success":false,"data":"Warning: array_merge(): Expected parameter 2 to be an array, ' . $type . ' given."}' );

wp_privacy_generate_personal_data_export_file( self::$export_request_id );
}

public function data_invalid_export_data_grouped_type_error() {
return array(
array(
'groups' => 10,
'type' => 'string',
),
array(
'groups' => '10',
'type' => 'string',
),
array(
'groups' => true,
'type' => 'string',
),
array(
'groups' => new stdClass(),
'type' => 'object',
),
array(
'groups' => json_encode(
array(
'user' => array(
'group_label' => 'User',
'group_description' => 'User’s profile data.',
'items' => array(
'user-1' => array(
array(
'name' => 'User ID',
'value' => 1,
),
array(
'name' => 'User Login Name',
'value' => 'user_login',
),
array(
'name' => 'User Nice Name',
'value' => 'User Name',
),
array(
'name' => 'User Email',
'value' => '[email protected]',
),
array(
'name' => 'User Registration Date',
'value' => '2020-01-31 19:29:29',
),
array(
'name' => 'User Display Name',
'value' => 'User Name',
),
array(
'name' => 'User Nickname',
'value' => 'User',
),
),
),
),
)
),
'type' => 'string',
),
);
}

/**
* Test that an index.html file can be added to the export directory.
*
Expand Down