File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
tests/phpunit/tests/widgets Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -116,4 +116,47 @@ public function mocked_rss_response() {
116116 'filename ' => null ,
117117 );
118118 }
119+
120+ /**
121+ * @ticket 63611
122+ * @covers wp_widget_rss_output
123+ */
124+ public function test_rss_title_html_entities_decoded () {
125+ $ mock_item = $ this ->getMockBuilder ( 'SimplePie_Item ' )
126+ ->disableOriginalConstructor ()
127+ ->getMock ();
128+
129+ $ mock_item ->method ( 'get_title ' )
130+ ->willReturn ( 'Title with <em>HTML entities</em> ' );
131+
132+ $ mock_item ->method ( 'get_link ' )
133+ ->willReturn ( 'https://example.com ' );
134+
135+ $ mock_item ->method ( 'get_description ' )
136+ ->willReturn ( 'Description ' );
137+
138+ $ mock_item ->method ( 'get_date ' )
139+ ->willReturn ( false );
140+
141+ $ mock_item ->method ( 'get_author ' )
142+ ->willReturn ( false );
143+
144+ $ mock_rss = $ this ->getMockBuilder ( 'SimplePie ' )
145+ ->disableOriginalConstructor ()
146+ ->getMock ();
147+
148+ $ mock_rss ->method ( 'get_item_quantity ' )
149+ ->willReturn ( 1 );
150+
151+ $ mock_rss ->method ( 'get_items ' )
152+ ->willReturn ( array ( $ mock_item ) );
153+
154+ ob_start ();
155+ wp_widget_rss_output ( $ mock_rss );
156+ $ output = ob_get_clean ();
157+
158+ $ this ->assertStringContainsString ( 'Title with HTML entities ' , $ output );
159+ $ this ->assertStringNotContainsString ( '<em> ' , $ output );
160+ $ this ->assertStringNotContainsString ( '</em> ' , $ output );
161+ }
119162}
You can’t perform that action at this time.
0 commit comments