Skip to content

Commit 4e4783f

Browse files
committed
Tests: Cover the get_wp_title_rss filter in get_wp_title_rss().
Add a test that a callback on the `get_wp_title_rss` filter receives the document title and can change the feed title that `get_wp_title_rss()` returns. Developed in: #15370 Props shailu25. Fixes #66474. git-svn-id: https://develop.svn.wordpress.org/trunk@65257 602fd350-edb4-49c9-b593-d223f7449a82
1 parent c1ae72e commit 4e4783f

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Tests for get_wp_title_rss().
4+
*
5+
* @group feed
6+
*
7+
* @covers ::get_wp_title_rss
8+
*/
9+
class Tests_Feed_GetWpTitleRss extends WP_UnitTestCase {
10+
11+
/**
12+
* @ticket 65819
13+
*/
14+
public function test_filter_can_customize_feed_title() {
15+
add_filter(
16+
'pre_get_document_title',
17+
static function () {
18+
return 'Feed Title';
19+
}
20+
);
21+
22+
add_filter(
23+
'get_wp_title_rss',
24+
static function ( $title ) {
25+
return $title . ' Custom';
26+
}
27+
);
28+
29+
$this->assertSame( 'Feed Title Custom', get_wp_title_rss() );
30+
}
31+
}

0 commit comments

Comments
 (0)