summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/wp-includes/comment.php4
-rw-r--r--tests/phpunit/tests/comment/wpCommentsPersonalDataEraser.php29
-rw-r--r--tests/phpunit/tests/comment/wpCommentsPersonalDataExporter.php29
3 files changed, 60 insertions, 2 deletions
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index d09dc4967c..a16a33c132 100644
--- a/src/wp-includes/comment.php
+++ b/src/wp-includes/comment.php
@@ -3692,7 +3692,7 @@ function wp_comments_personal_data_exporter( $email_address, $page = 1 ) {
'author_email' => $email_address,
'number' => $number,
'paged' => $page,
- 'order_by' => 'comment_ID',
+ 'orderby' => 'comment_ID',
'order' => 'ASC',
'update_comment_meta_cache' => false,
)
@@ -3815,7 +3815,7 @@ function wp_comments_personal_data_eraser( $email_address, $page = 1 ) {
'author_email' => $email_address,
'number' => $number,
'paged' => $page,
- 'order_by' => 'comment_ID',
+ 'orderby' => 'comment_ID',
'order' => 'ASC',
'include_unapproved' => true,
)
diff --git a/tests/phpunit/tests/comment/wpCommentsPersonalDataEraser.php b/tests/phpunit/tests/comment/wpCommentsPersonalDataEraser.php
index c5d3312e79..ef7ccc4091 100644
--- a/tests/phpunit/tests/comment/wpCommentsPersonalDataEraser.php
+++ b/tests/phpunit/tests/comment/wpCommentsPersonalDataEraser.php
@@ -229,4 +229,33 @@ class Tests_Comment_wpCommentsPersonalDataEraser extends WP_UnitTestCase {
public function wp_anonymize_comment_custom_message( $anonymize, $comment, $anonymized_comment ) {
return sprintf( 'Some custom message for comment %d.', $comment->comment_ID );
}
+
+ /**
+ * Testing that `wp_comments_personal_data_eraser()` orders comments by ID.
+ *
+ * @ticket 57700
+ */
+ public function test_wp_comments_personal_data_eraser_orders_comments_by_id() {
+
+ $args = array(
+ 'comment_post_ID' => self::$post_id,
+ 'comment_author' => 'Comment Author',
+ 'comment_author_email' => 'personal@local.host',
+ 'comment_author_url' => 'https://local.host/',
+ 'comment_author_IP' => '192.168.0.1',
+ 'comment_date' => '2018-04-14 17:20:00',
+ 'comment_agent' => 'COMMENT_AGENT',
+ 'comment_content' => 'Comment Content',
+ );
+ self::factory()->comment->create( $args );
+
+ $filter = new MockAction();
+ add_filter( 'comments_clauses', array( &$filter, 'filter' ) );
+
+ wp_comments_personal_data_eraser( $args['comment_author_email'] );
+
+ $clauses = $filter->get_args()[0][0];
+
+ $this->assertStringContainsString( 'comment_ID', $clauses['orderby'] );
+ }
}
diff --git a/tests/phpunit/tests/comment/wpCommentsPersonalDataExporter.php b/tests/phpunit/tests/comment/wpCommentsPersonalDataExporter.php
index ad60ccceeb..f3fce0f804 100644
--- a/tests/phpunit/tests/comment/wpCommentsPersonalDataExporter.php
+++ b/tests/phpunit/tests/comment/wpCommentsPersonalDataExporter.php
@@ -132,4 +132,33 @@ class Tests_Comment_wpCommentsPersonalDataExporter extends WP_UnitTestCase {
// Number of exported comments.
$this->assertCount( 0, $actual['data'] );
}
+
+ /**
+ * Testing that `wp_comments_personal_data_exporter()` orders comments by ID.
+ *
+ * @ticket 57700
+ */
+ public function test_wp_comments_personal_data_exporter_orders_comments_by_id() {
+
+ $args = array(
+ 'comment_post_ID' => self::$post_id,
+ 'comment_author' => 'Comment Author',
+ 'comment_author_email' => 'personal@local.host',
+ 'comment_author_url' => 'https://local.host/',
+ 'comment_author_IP' => '192.168.0.1',
+ 'comment_date' => '2018-03-28 20:05:00',
+ 'comment_agent' => 'SOME_AGENT',
+ 'comment_content' => 'Comment',
+ );
+ self::factory()->comment->create( $args );
+
+ $filter = new MockAction();
+ add_filter( 'comments_clauses', array( &$filter, 'filter' ) );
+
+ wp_comments_personal_data_exporter( $args['comment_author_email'] );
+
+ $clauses = $filter->get_args()[0][0];
+
+ $this->assertStringContainsString( 'comment_ID', $clauses['orderby'] );
+ }
}