Skip to content

Commit 44047d3

Browse files
committed
Test fetch and merge of multiple feeds.
1 parent dd1897c commit 44047d3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/phpunit/tests/feed/fetchFeed.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,28 @@ public function test_empty_charset_does_not_trigger_fatal_error() {
3333
$this->assertStringContainsString( '<a href="https://learn.wordpress.org/">Learn WordPress</a> is a learning resource providing workshops, quizzes, courses, lesson plans, and discussion groups so that anyone, from beginners to advanced users, can learn to do more with WordPress.', $content );
3434
}
3535

36+
/**
37+
* Ensure fetch_feed() accepts multiple feeds.
38+
*
39+
* The main purpose of this test is to ensure that the SimplePie deprecation warning
40+
* is not thrown when requesting multiple feeds.
41+
*
42+
* Secondly it confirms that the markup of the first two items match as they will
43+
* both be from the same feed URL as the array contains the WordPress News feed twice.
44+
*
45+
* @ticket 64136
46+
*/
47+
public function test_fetch_feed_supports_multiple_feeds() {
48+
$feed = fetch_feed( array( 'https://wordpress.org/news/feed/', 'https://wordpress.org/news/feed/' ) );
49+
$content = array();
50+
51+
foreach ( $feed->get_items( 0, 2 ) as $item ) {
52+
$content[] = $item->get_content();
53+
}
54+
55+
$this->assertEqualHTML( $content[0], $content[1], null, 'The contents of both items should be identical.' );
56+
}
57+
3658
/**
3759
* Ensure that fetch_feed() is cached on second and subsequent calls.
3860
*

0 commit comments

Comments
 (0)