Make WordPress Core

Ticket #49661: 49661.patch

File 49661.patch, 1.4 KB (added by SirLouen, 6 months ago)

Adding Unit Tests for PR 9543

  • tests/phpunit/tests/comment.php

    diff --git tests/phpunit/tests/comment.php tests/phpunit/tests/comment.php
    index a8f15e1dea..dc89f9ab99 100644
    class Tests_Comment extends WP_UnitTestCase { 
    11621162                $this->assertStringContainsString( admin_url( "comment.php?action=editcomment&c={$c1}" ), self::$notify_message );
    11631163        }
    11641164
     1165        /**
     1166         * Check Reply-To Header is set correctly for reply comments.
     1167         *
     1168         * @group 49661
     1169         * @covers ::wp_new_comment_notify_postauthor
     1170         */
     1171        public function test_reply_comment_notification_includes_reply_to_header() {
     1172                $parent = self::factory()->comment->create(
     1173                        array(
     1174                                'comment_post_ID' => self::$post_id,
     1175                        )
     1176                );
     1177
     1178                $reply_author_name  = 'Jane Doe';
     1179                $reply_author_email = 'jane@example.com';
     1180
     1181                $reply = self::factory()->comment->create(
     1182                        array(
     1183                                'comment_post_ID'      => self::$post_id,
     1184                                'comment_parent'       => $parent,
     1185                                'comment_author'       => $reply_author_name,
     1186                                'comment_author_email' => $reply_author_email,
     1187                                'comment_approved'     => '1',
     1188                        )
     1189                );
     1190
     1191                wp_new_comment_notify_postauthor( $reply );
     1192                $mailer = tests_retrieve_phpmailer_instance();
     1193                $header = $mailer->get_sent()->header;
     1194                $this->assertStringContainsString( 'Reply-To: ' . $reply_author_name . ' <' . $reply_author_email . '>', $header );
     1195        }
     1196
    11651197        /**
    11661198         * Callback for the `comment_notification_text` & `comment_moderation_text` filters.
    11671199         *