Skip to content
Open
Changes from all commits
Commits
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
32 changes: 32 additions & 0 deletions tests/phpunit/tests/feed/commentsLinkFeed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* Tests for comments_link_feed().
*
* @group feed
*
* @covers ::comments_link_feed
*/
class Tests_Feed_CommentsLinkFeed extends WP_UnitTestCase {

/**
* @ticket 65819
*/
public function test_filter_receives_comments_link_and_output_is_escaped() {
$post_id = self::factory()->post->create();
$GLOBALS['post'] = get_post( $post_id );
setup_postdata( $GLOBALS['post'] );

$filter = new MockAction();
add_filter( 'comments_link_feed', array( $filter, 'filter_append' ) );

ob_start();
comments_link_feed();
$output = ob_get_clean();

$comments_link = get_comments_link( $post_id );

$this->assertSame( esc_url( $comments_link . '_append' ), $output );
Comment on lines +20 to +28
$this->assertSame( 1, $filter->get_call_count() );
$this->assertSame( array( $comments_link ), $filter->get_args()[0] );
}
}
Loading