Fix PHP notice in `Tests_Feed_RSS2::test_items()`.

A notice was being thrown when `get_the_tags()` returned false, and `foreach()`
was run over that return value.

See [30283].

git-svn-id: https://develop.svn.wordpress.org/trunk@30295 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2014-11-10 02:04:22 +00:00
parent d011f4ef00
commit 3c360968ef
1 changed files with 6 additions and 2 deletions

View File

@ -125,8 +125,12 @@ class Tests_Feed_RSS2 extends WP_UnitTestCase {
foreach ( get_the_category( $post->ID ) as $term ) {
$cats[] = $term->name;
}
foreach ( get_the_tags( $post->ID ) as $term ) {
$cats[] = $term->name;
$tags = get_the_tags( $post->ID );
if ( $tags ) {
foreach ( get_the_tags( $post->ID ) as $term ) {
$cats[] = $term->name;
}
}
$cats = array_filter( $cats );
// should be the same number of categories