You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -463,59 +463,20 @@ public function test_callback_comment_duplicate_trigger() {
463
463
]
464
464
);
465
465
466
-
$this->mock->expects( $this->atLeastOnce() )
467
-
->method( 'log' )
468
-
->with(
469
-
$this->equalTo(
470
-
_x(
471
-
'Duplicate %3$s by %1$s prevented on %2$s',
472
-
'1: Comment author, 2: Post title, 3: Comment type',
473
-
'stream'
474
-
)
475
-
),
476
-
$this->equalTo(
477
-
[
478
-
'user_name' => 'Jim Bean',
479
-
'post_title' => '"Test post"',
480
-
'comment_type' => 'comment',
481
-
'post_id' => "$post_id",
482
-
'user_id' => 0,
483
-
]
484
-
),
485
-
$this->equalTo( $comment_id ),
486
-
$this->equalTo( 'post' ),
487
-
$this->equalTo( 'duplicate' )
488
-
);
489
-
490
-
// Do stuff.
466
+
// Create duplicate comment and trigger mock.
491
467
wp_new_comment(
492
-
[
468
+
array(
493
469
'comment_content' => 'Lorem ipsum dolor...',
494
470
'comment_author' => 'Jim Bean',
495
471
'comment_author_email' => 'jim_bean@example.com',
496
472
'comment_author_url' => '',
497
473
'comment_author_IP' => '::1',
498
474
'comment_post_ID' => $post_id,
499
-
],
475
+
'comment_type' => 'post',
476
+
),
500
477
true
501
478
);
502
-
$comment_id = wp_new_comment( $commentdata );
503
-
504
-
// Manually execute SQL query for duplicate comment ID. "$wpdb->last_result[0]" Undefined index error.
505
-
$dupe = $wpdb->prepare(
506
-
"SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = %s AND comment_approved != 'trash' AND ( comment_author = %s AND comment_author_email = %s ) AND comment_content = %s LIMIT 1",
0 commit comments